public void HandleRemovePlayer(NetworkMessage msg) { MsgRemovePlayer rp = msg as MsgRemovePlayer; var player = GetPlayerByID(rp.PlayerID); if (player == null) { return; } PlayerList.Remove(player.PlayerID); if (PlayerRemoved != null) { PlayerRemoved.Invoke(this, player); } if (player.IsLocalPlayer) //oh shit it's us! { Me = null; if (SelfRemoved != null) { SelfRemoved.Invoke(this, player); } } }
private void Player_Exited(object sender, Networking.Common.Peer e) { ServerPlayer sp = e as ServerPlayer; if (sp == null || !PlayerList.Contains(sp)) { return; } lock (PlayerList) PlayerList.Remove(sp); MsgRemovePlayer exit = new MsgRemovePlayer(); exit.PlayerID = sp.PlayerID; SendToAll(exit, false); if (Teams.ContainsKey(sp.ActualTeam)) { Teams[sp.ActualTeam].Remove(sp); } }
private static void HandleRemovePlayer(NetworkMessage msg) { MsgRemovePlayer rp = msg as MsgRemovePlayer; WriteLine("Player Removed " + rp.PlayerID.ToString()); }