public static void CreatePlayer(Player player) { Player older = null; lock (syc_obj) { player.LastTime = DateTime.Now.Ticks; if (m_players.ContainsKey(player.Id)) { older = m_players[player.Id]; player.State = older.State; player.CurrentServer = older.CurrentServer; m_players[player.Id] = player; } else { older = LoginMgr.GetPlayerByName(player.Name); if (older != null && m_players.ContainsKey(older.Id)) { m_players.Remove(older.Id); } player.State = ePlayerState.NotLogin; m_players.Add(player.Id, player); } } if (older != null && older.CurrentServer != null) { older.CurrentServer.SendKitoffUser(older.Id); } }
public static void CreatePlayer(Player player) { Player player2 = null; object obj; Monitor.Enter(obj = LoginMgr.syc_obj); try { player.LastTime = DateTime.Now.Ticks; if (LoginMgr.m_players.ContainsKey(player.Id)) { player2 = LoginMgr.m_players[player.Id]; player.State = player2.State; player.CurrentServer = player2.CurrentServer; LoginMgr.m_players[player.Id] = player; } else { player2 = LoginMgr.GetPlayerByName(player.Name); if (player2 != null && LoginMgr.m_players.ContainsKey(player2.Id)) { LoginMgr.m_players.Remove(player2.Id); } player.State = ePlayerState.NotLogin; LoginMgr.m_players.Add(player.Id, player); } } finally { Monitor.Exit(obj); } if (player2 != null && player2.CurrentServer != null) { player2.CurrentServer.SendKitoffUser(player2.Id); } }