public Task GameSubmitClaim(long gameLobbyID, List <GetGameCard> claims, List <GetGameCard> actual) { return(Task.Run(() => { var gameLobby = gameLobbyService.GetGameLobby(gameLobbyID); if (gameLobby == null) { return; } gameLobby.UseLobbyLock(() => { gameLobby.GameLogicController.SubmitClaim(Context.User, claims.GetGameCards(), actual.GetGameCards()); gameLobby.GameLogicController.CallPhase(OnGameCheat, OnEndTurn, OnGameFinish); foreach (var gameUser in gameLobby.GetUsers()) { var gameState = gameLobby.GameLogicController.GetGameState(gameUser); var connection = userConnectionsService.GameConnectionService.GetConnection(gameUser); var apiObject = new HubApi.GameClaim { GameState = new GetGameState(gameState) }; gameHubContext.Clients.Client(connection).GameClaim(apiObject); } }); })); }
public void OnTurnTimeout(long gameLobbyID) { var gameLobby = gameLobbyService.GetGameLobby(gameLobbyID); if (gameLobby == null) { return; } gameLobby.UseLobbyLock(() => { gameLobby.GameLogicController.CallPhase(OnGameCheat, OnEndTurn, OnGameFinish); foreach (var gameUser in gameLobby.GetUsers()) { var gameState = gameLobby.GameLogicController.GetGameState(gameUser); var connection = userConnectionsService.GameConnectionService.GetConnection(gameUser); var apiObject = new HubApi.GameClaim { GameState = new GetGameState(gameState) }; gameHubContext.Clients.Client(connection).GameClaim(apiObject); } }); }