| Line | |
|---|
| 1 | using AllocsFixes.PersistentData;
|
|---|
| 2 | using System;
|
|---|
| 3 | using System.Collections.Generic;
|
|---|
| 4 | using UnityEngine;
|
|---|
| 5 |
|
|---|
| 6 | namespace AllocsFixes
|
|---|
| 7 | {
|
|---|
| 8 | public class AllocsLogFunctions
|
|---|
| 9 | {
|
|---|
| 10 | public static void RequestToSpawnPlayer (int _clientId, string _name, int _chunkViewDim, PlayerProfile _playerProfile)
|
|---|
| 11 | {
|
|---|
| 12 | try {
|
|---|
| 13 | ClientInfo ci = ConnectionManager.Instance.GetClient (_clientId);
|
|---|
| 14 |
|
|---|
| 15 | Log.Out ("Player connected, clientid=" + _clientId +
|
|---|
| 16 | ", entityid=" + ci.entityId +
|
|---|
| 17 | ", name=" + ci.playerName +
|
|---|
| 18 | ", steamid=" + ci.playerId +
|
|---|
| 19 | ", ip=" + ci.ip
|
|---|
| 20 | );
|
|---|
| 21 |
|
|---|
| 22 | PersistentContainer.Instance.Players [ci.playerId].SetOnline (ci);
|
|---|
| 23 | PersistentData.PersistentContainer.Instance.Save ();
|
|---|
| 24 | } catch (Exception e) {
|
|---|
| 25 | Log.Out ("Error in AllocsLogFunctions.RequestToSpawnPlayer: " + e);
|
|---|
| 26 | }
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | public static void PlayerDisconnected (ClientInfo _cInfo, bool _bShutdown)
|
|---|
| 30 | {
|
|---|
| 31 | try {
|
|---|
| 32 | Player p = PersistentContainer.Instance.Players [_cInfo.playerId];
|
|---|
| 33 | if (p != null) {
|
|---|
| 34 | p.SetOffline ();
|
|---|
| 35 | } else {
|
|---|
| 36 | Log.Out ("Disconnected player not found in client list...");
|
|---|
| 37 | }
|
|---|
| 38 | PersistentData.PersistentContainer.Instance.Save ();
|
|---|
| 39 | } catch (Exception e) {
|
|---|
| 40 | Log.Out ("Error in AllocsLogFunctions.PlayerDisconnected: " + e);
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.