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

Last change on this file since 235 was 233, checked in by alloc, 10 years ago

Fixes for 11.4

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