Package game.service

Class GameService

java.lang.Object
game.service.GameService

public class GameService extends Object
The `GameService` class in Java manages game-related operations such as creating games, joining games, playing cards, and handling game state.
  • Constructor Details

  • Method Details

    • createGame

      public io.vertx.core.json.JsonObject createGame(Integer numberOfPlayers, User user, int expectedScore, String gameMode)
    • joinGame

      public io.vertx.core.json.JsonObject joinGame(UUID gameID, User user, String pwd)
    • startGame

      public io.vertx.core.json.JsonObject startGame(UUID gameID)
      Parameters:
      gameID -
      Returns:
    • canStart

      public io.vertx.core.json.JsonObject canStart(UUID gameID)
    • canPlayCard

      public io.vertx.core.json.JsonObject canPlayCard(UUID gameID, String username, Card<CardValue,CardSuit> card, Boolean isSuitFinishedByPlayer)
    • playCard

      public io.vertx.core.json.JsonObject playCard(UUID gameID, String username, Card<CardValue,CardSuit> card, Boolean isSuitFinishedByPlayer, Boolean isValid)
    • chooseTrump

      public io.vertx.core.json.JsonObject chooseTrump(UUID gameID, String cardSuit, String username)
    • startNewRound

      public boolean startNewRound(UUID gameID)
    • changeTeam

      public io.vertx.core.json.JsonObject changeTeam(UUID gameID, String username, String team, Integer pos)
    • getState

      public io.vertx.core.json.JsonObject getState(UUID gameID)
    • isGameEnded

      public io.vertx.core.json.JsonObject isGameEnded(UUID gameID)
    • makeCall

      public io.vertx.core.json.JsonObject makeCall(UUID gameID, String call, String username)
    • newGame

      public io.vertx.core.json.JsonObject newGame(UUID gameID)
      Parameters:
      gameID - the id of the new game
      Returns:
      true if the game has been created, false if the gameId is not found
    • setPassword

      public boolean setPassword(UUID gameID, String password)
      Parameters:
      gameID - the id of the new game
      password - of the game
      Returns:
      true if the password has been set, false if the gameId is not found
    • getGames

      public Map<UUID,GameVerticle> getGames()
    • getJsonGames

      public io.vertx.core.json.JsonArray getJsonGames()
      Returns:
      the json with all the games and their properties
    • getPlayers

      public io.vertx.core.json.JsonObject getPlayers()
    • exitGame

      public io.vertx.core.json.JsonObject exitGame(UUID gameID)
    • removeUser

      public io.vertx.core.json.JsonObject removeUser(UUID gameID, String username)