Example #1
0
//		private LoadGameOverImage() {
////			if (this.model.ImageIds.Count > 0) {
////				var imgId = this.model.ImageIds[0];
////				this.repository.
////			}
//		}



        public GameModel GetUpdatedGameModel()
        {
            var       now      = DateTime.UtcNow;
            GameModel newModel = new GameModel();

            newModel.GameGUID           = this.model.GameGUID;
            newModel.GameRequesterId    = model.GameRequesterId;
            newModel.GameResponderId    = model.GameResponderId;
            newModel.BackgroundImageUrl = model.BackgroundImageUrl;
            newModel.BalloonImageUrl    = model.BalloonImageUrl;
            newModel.TotalDuration      = model.TotalDuration;
            newModel.State       = this.BalloonIsPopped ? GameState.COMPLETED : GameState.IN_PROGRESS;
            newModel.UpdatedTime = now;

            var currentRoundMove = new GameMoveModel();

            currentRoundMove.HoldDuration = this.totalElapsedSession;
            currentRoundMove.PlayerId     = this.IsPlayer1sTurn ? model.GameRequesterId : model.GameResponderId;
            currentRoundMove.Timestamp    = now;

            var newMoves = new List <GameMoveModel> ();

            newMoves.AddRange(model.GameMoves);
            newMoves.Add(currentRoundMove);
            newModel.GameMoves = newMoves;

            return(newModel);
        }
Example #2
0
 public static string MoveDescription(GameMoveModel move, int currentUserId)
 {
     return(FormatMilliseconds(move.HoldDuration, true));
 }