source: binary-improvements/7dtd-server-fixes/src/AllocsLogFunctions.cs@ 231

Last change on this file since 231 was 230, checked in by alloc, 10 years ago

Binary improvements

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