Exemple #1
0
        public async Task <Room> CreateRoom(string roomName, string playerName)
        {
            var room = new Room()
            {
                id            = Guid.NewGuid().ToString(),
                name          = roomName,
                players       = new Dictionary <string, string>(),
                answers       = new Dictionary <string, string>(),
                playerChoices = new Dictionary <string, int>()
            };

            room.players[Context.ConnectionId] = playerName;
            await redis.AddAsync(room.id, room);

            await Groups.AddToGroupAsync(Context.ConnectionId, room.id);

            return(room);
        }