예제 #1
0
        // creates a BingoUser with random colour and adds it to this room
        // returns hex colour
        public string AddUser(string connectionID, string username)
        {
            string hexColour = BingoUtils.PickAndRemoveString(_possibleHexColours);

            Users.Add(connectionID, new BingoUser(connectionID, username, hexColour));
            return(hexColour);
        }
예제 #2
0
        /// <summary>
        /// Creates a room with a random three character ID, and returns its room ID.
        /// </summary>
        /// <returns>The ID of the newly created room.</returns>
        public string CreateRoom()
        {
            string roomID = null;

            do
            {
                roomID = BingoUtils.RandomString(RoomIDLength);
            } while (Rooms.ContainsKey(roomID));

            Rooms.Add(roomID, new BingoRoom(roomID));

            return(roomID);
        }