Esempio n. 1
0
        public async Task StartNextRoundAsync(Guid gameId)
        {
            await _gameManager.StartRoundAsync(gameId, async (createdRound, playersIdsInRound) =>
            {
                var connectionsIds = GetPlayersConnectionsIds(gameId, playersIdsInRound);
                await Groups.AddConnectionsToGameRoundGroupAsync(gameId, createdRound.Number, connectionsIds);
                await Clients.GameRoundGroup(gameId, createdRound.Number).SendAsync("round_started", new
                {
                    roundNumber  = createdRound.Number,
                    sortedLetter = createdRound.SortedLetter
                });

                _gameTimer.StartRoundTimer(gameId, createdRound.Number);
                await _lobbyHubContext.Clients.All.SendAsync("round_started", gameId);
            });
        }