コード例 #1
0
        private void HandleRemoveAllBots()
        {
            var countPlayers = lobbyReader.ReadInt32();

            for (var i = 0; i < countPlayers; i++)
            {
                var playerID = lobbyReader.ReadInt32();
                ConnectedServer.RemovePlayer(playerID);
                OnPlayerDisconnectedLobby.Invoke(playerID);
            }
        }
コード例 #2
0
        private void HandlePlayerDisconnected()
        {
            var playerID = lobbyReader.ReadInt32();
            var isLeave  = lobbyReader.ReadBoolean();
            var isBot    = lobbyReader.ReadBoolean();

            Chat.MutedPlayers.Remove(ConnectedServer.Players[playerID].IPAddress);

            if (ConnectedServer.State == ServerState.InGame)
            {
                ConnectedServer.Players[playerID].IsBot = isBot;
                OnPlayerDisconnectedGame.Invoke(playerID, isLeave, isBot);
                OnPlayerKicked.Invoke();
            }
            else
            {
                ConnectedServer.RemovePlayer(playerID);
                OnPlayerDisconnectedLobby.Invoke(playerID);
            }
        }