示例#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;
            }
        }
示例#2
0
 public void RemoveGame(CGameRoom room)
 {
     for (int i = 0; i < MAX_GAME_NUM; i++)
     {
         if (roomList.ContainsKey(i))
         {
             if (roomList[i] == room)
             {
                 roomList.Remove(i);
             }
         }
     }
 }
        protected CGamePlayer(LobbyPlayer lobbyPlayer, NetTunnel tunnel, CGameRoom gameRoom)
        {
            this.name = lobbyPlayer.Name;
            this.tunnel = tunnel;
            this.tunnel.Identifier = this.name + " (GamePlayer)";
            this.bank = lobbyPlayer.Bank;

            this.lobbyEntity = lobbyPlayer;
            this.lobbyEntity.GameRoomPlayers.Add(this);

            this.gameRoom = gameRoom;

            this.tunnel.OnUnexpectedDisconnectEvent += new NetTunnel.OnUnexpectedDisconnectCall(OnUnexpectedDisconnectEvent);
        }
示例#4
0
        protected CGamePlayer(LobbyPlayer lobbyPlayer, NetTunnel tunnel, CGameRoom gameRoom)
        {
            this.name              = lobbyPlayer.Name;
            this.tunnel            = tunnel;
            this.tunnel.Identifier = this.name + " (GamePlayer)";
            this.bank              = lobbyPlayer.Bank;

            this.lobbyEntity = lobbyPlayer;
            this.lobbyEntity.GameRoomPlayers.Add(this);

            this.gameRoom = gameRoom;

            this.tunnel.OnUnexpectedDisconnectEvent += new NetTunnel.OnUnexpectedDisconnectCall(OnUnexpectedDisconnectEvent);
        }
示例#5
0
        public void OnRequestGameListEvent(LobbyPlayer lobbyPlayer)
        {
            lobbyPlayer.Tunnel.SendMessage("clrgames");

            for (int i = 0, j = 0; i < roomList.Count; j++)
            {
                if (roomList.ContainsKey(j))
                {
                    CGameRoom room = roomList[j];
                    lobbyPlayer.Tunnel.SendMessage(
                        String.Format(
                            "gameinfo:{0:0},{1},{2}/{3},{4}",
                            j,
                            room.Name,
                            room.PlayerCount,
                            room.MaxSeatNum,
                            room.ChipsInPlay
                            )
                        );

                    i++;
                }
            }
        }
 public THPlayer(LobbyPlayer lobbyPlayer, NetTunnel tunnel, CGameRoom gameRoom)
     : base(lobbyPlayer, tunnel, gameRoom)
 {
     tunnel.OnMessageReceivedEvent += new NetTunnel.OnMessageReceivedCall(OnMessageReceivedEvent);
 }
示例#7
0
 public THPlayer(LobbyPlayer lobbyPlayer, NetTunnel tunnel, CGameRoom gameRoom) : base(lobbyPlayer, tunnel, gameRoom)
 {
     tunnel.OnMessageReceivedEvent += new NetTunnel.OnMessageReceivedCall(OnMessageReceivedEvent);
 }
 public void RemoveGame(CGameRoom room)
 {
     for (int i = 0; i < MAX_GAME_NUM; i++)
     {
         if (roomList.ContainsKey(i))
         {
             if (roomList[i] == room)
             {
                 roomList.Remove(i);
             }
         }
     }
 }