예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        private static void HandleRemovePlayer(NetworkMessage msg)
        {
            MsgRemovePlayer rp = msg as MsgRemovePlayer;

            WriteLine("Player Removed " + rp.PlayerID.ToString());
        }