コード例 #1
0
ファイル: PlayerManager.cs プロジェクト: mariuszsokal/gtan
 /// <summary>
 /// Save players and release all the data held by player manager.
 /// </summary>
 public void Dispose()
 {
     foreach (KeyValuePair <NetHandle, Player> kv in playersDict)
     {
         Player player = kv.Value;
         player.Save();
         player.Dispose();
     }
     playersDict.Clear();
 }
コード例 #2
0
ファイル: PlayerManager.cs プロジェクト: mariuszsokal/gtan
        /// <summary>
        /// Unregister player by net handle from players manager.
        /// </summary>
        /// <param name="handle">The handle of the player to unregister</param>
        /// <returns>Return true if player was registered false otherwise</returns>
        public bool unregisterPlayer(NetHandle handle)
        {
            Player player = findPlayerByHandle(handle);

            if (player != null)
            {
                player.Save();
                player.Dispose();
                playersDict.Remove(handle);
            }
            return(false);
        }