示例#1
0
        private void NewGamePlayer(NetTunnel tunnel, string ticket)
        {
            if (string.IsNullOrEmpty(ticket))
            {
                Logger.Log(LogType.Error, "Received an empty ticket");
                tunnel.Destroy();
                return;
            }

            if (ticketRoomList.ContainsKey(ticket) && ticketPlayerList.ContainsKey(ticket))
            {
                LobbyPlayer lobbyPlayer = ticketPlayerList[ticket];
                CGameRoom   room        = ticketRoomList[ticket];

                room.JoinGame(lobbyPlayer, tunnel);

                ticketPlayerList.Remove(ticket);
                ticketRoomList.Remove(ticket);

                Logger.Log(LogType.Event, "Player " + lobbyPlayer.Name + " joined " + room.Name);
            }
            else
            {
                Logger.Log(LogType.Error, "Received an invalid ticket");
                tunnel.Destroy();
                return;
            }
        }