Ejemplo n.º 1
0
        public bool Validate(JoinGameMessages.Request request)
        {
            var valid = true;

            if (request.gameId < 0)
            {
                valid = valid && false;
            }

            return(valid);
        }
Ejemplo n.º 2
0
        // TODO
        public JoinGameMessages.Response Handle(JoinGameMessages.Request request)
        {
            throw new NotImplementedException();

            /*JoinGameMessages.Response response = new JoinGameMessages.Response();
             *
             * var retrievedGame = GameGateway.GetGame(request.gameId);
             * if (retrievedGame == null)
             * {
             *  response.JoinedGame = false;
             *  response.ErrorMessage = "Game with id " + request.gameId + " does not exist!";
             *
             * } else
             * {
             *  var playerExists = PlayerGateway.GetPlayer(request.playerUsername);
             *  if (playerExists != null)
             *  {
             *      //// retrievedGame
             *      //if(retrievedGame.Players == null)
             *      //{
             *      //    retrievedGame.Players = new List<Player>();
             *      //}
             *
             *      //retrievedGame.Players.Add(playerExists);
             *      //playerExists.GameId = request.gameId;
             *      throw new NotImplementedException();
             *
             *      // DB transactions
             *      GameGateway.UpdateGame(retrievedGame);
             *      PlayerGateway.UpdatePlayer(playerExists);
             *
             *      response.JoinedGame = true;
             *
             *  } else
             *  {
             *      response.ErrorMessage = "Player with the username '" + request.playerUsername + "' does not exist!";
             *      response.JoinedGame = false;
             *  }
             * }
             *
             * return response;*/
        }