Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public Room CreateNewRoom(Client host)
        {
            var newRoom = new Room(host);

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

            return newRoom;
        }