Ejemplo n.º 1
0
        private async Task RestartAGame(StartGameResponse result)
        {
            _logger.LogInformation("Attempting to restart a game");

            var battle = await _battleRepository.GetInProgressBattleAsync();

            if (battle is null)
            {
                result.ErrorMessages.Add("There is no battle in progress.");
            }
            else
            {
                _jobClient.Delete(battle.JobId);
                await _battleRepository.UpdateBattleAsync(battle.Id, Entities.Enums.BattleStatus.Initializing);

                _jobClient.Schedule <IGameService>(x => x.StartGameAsync(null, battle.Id), TimeSpan.FromSeconds(1));

                result.BattleId = battle.Id;
            }
        }