Exemple #1
0
        public Client(Socket client)
        {
            _socket = client;

            //
            // Create a new room for the new connecting client.
            //

            var roomManager = RoomManager.GetInstance();
            Room = roomManager.CreateNewRoom(this);

            //
            // Start the heartbeat timer.
            //

            _heartBeatTimer = new Timer(CheckHeartBeatTimer, null, 20000, TimerInterval);

            //
            // Set the client user state to default value.
            //

            _clientUserState = ClientUserState.InLobby;
        }
Exemple #2
0
        public Room CreateNewRoom(Client host)
        {
            var newRoom = new Room(host);

            lock (_roomListLock)
            {
                _roomList.Add(newRoom);
            }

            return newRoom;
        }