public StatusResult Execute(StatusRequest request)
 {
     var game = Games[request.GameId];
     var result = game.GetStatus(request);
     result.Success = true;
     return result;
 }
 public BaseResult<StatusResult> Status(StatusRequest status)
 {
     var validator = new StatusRequestValidator();
     var results = validator.Validate(status);
     if (results.IsValid)
     {
         return _gameManager.Execute(status);
     }
     else
     {
         return BaseResult<StatusResult>.Fail(errors: results.Errors.Select(e => e.ErrorMessage));
     }
 }
Esempio n. 3
0
 public StatusResult GetStatus(StatusRequest request)
 {
     var status = new StatusResult()
     {
         Success = true,
         Status = this.Status,
         IsGameOver = this.GameOver,
         CurrentTurn = Turn,
         NextTurnStart = endServerTurn,
         EndOfCurrentTurn = endPlayerTurn,
         PlayerTurnLength = (int)PLAYER_TURN_LENGTH,
         ServerTurnLength = (int)SERVER_TURN_LENGTH,
         Planets = _planets.ToList().Select(p => Mapper.Map<Shared.Planet>(p)).ToList(),
         Fleets = _fleets.ToList().Select(f => Mapper.Map<Shared.Fleet>(f)).ToList(),
         PlayerA = 1,
         PlayerAScore = _getPlayerScore(1),
         PlayerAScoreOverTime = PlayerAScoreOverTime,
         PlayerB = 2,
         PlayerBScore = _getPlayerScore(2),
         PlayerBScoreOverTime = PlayerBScoreOverTime
     };
     return status;
 }
 public StatusResult Execute(StatusRequest request)
 {
     var game = Games[request.GameId];
     return game.GetStatus(request);
 }