Skip to content

Commit

Permalink
Исправления финала
Browse files Browse the repository at this point in the history
  • Loading branch information
Fooxboy committed Oct 31, 2023
1 parent b0632f1 commit 1f31b88
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions MyOwnGame.Backend/Services/SessionCallbackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public async Task FinalThemeRemoved(long sessionId, List<RoundTheme> themes)
await _hubContext.Clients.Group(sessionId.ToString()).SendAsync(
SessionEvents.FinalThemeRemoved.ToString(), themes);
}


public async Task GamePaused(long sessionId, Session session)
{
Expand Down
16 changes: 15 additions & 1 deletion MyOwnGame.Backend/Services/SessionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,23 @@ public async Task RemoveFinalTheme(int position, string connectionId)
}

var nextPlayer = session.Players[indexPlayer];

await _callbackService.FinalThemeRemoved(player.SessionId, session.CurrentRound.Themes);
await _callbackService.ChangeSelectQuestionPlayer(player.SessionId, nextPlayer);

if (session.CurrentRound.Themes.Count == 1)
{
var currentRound = session.Package.Rounds.Round[session.CurrentRound.Number];

var question =
currentRound.Themes.Theme.FirstOrDefault(x => session.CurrentRound.Themes.FirstOrDefault().Name == x.Name).Questions.Question.FirstOrDefault();

var admin = session.Players.FirstOrDefault(x => x.IsAdmin);

var questionInfo = _questionParser.Parse(question);
await _callbackService.QuestionSelected(player.SessionId, questionInfo.Questions, new QuestionPackInfo(), 0, 0, 0);
await _callbackService.QuestionSelectedAdmin(admin.ConnectionId, questionInfo.Answer);
}
}

public async Task SendFinalAnswer(string message, int price, string connectionId)
Expand Down

0 comments on commit 1f31b88

Please sign in to comment.