Package game.service
Class GameService
java.lang.Object
game.service.GameService
The `GameService` class in Java manages game-related operations such as creating games, joining
games, playing cards, and handling game state.
-
Constructor Summary
ConstructorsConstructorDescriptionGameService(io.vertx.core.Vertx vertx) GameService(io.vertx.core.Vertx vertx, AbstractStatisticManager statisticManager) GameService(io.vertx.core.Vertx vertx, AbstractStatisticManager statisticManager, WebSocketVertx webSocket) -
Method Summary
Modifier and TypeMethodDescriptionio.vertx.core.json.JsonObjectcanPlayCard(UUID gameID, String username, Card<CardValue, CardSuit> card, Boolean isSuitFinishedByPlayer) io.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectchangeTeam(UUID gameID, String username, String team, Integer pos) io.vertx.core.json.JsonObjectchooseTrump(UUID gameID, String cardSuit, String username) io.vertx.core.json.JsonObjectcreateGame(Integer numberOfPlayers, User user, int expectedScore, String gameMode) io.vertx.core.json.JsonObjectgetGames()io.vertx.core.json.JsonArrayio.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectisGameEnded(UUID gameID) io.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectplayCard(UUID gameID, String username, Card<CardValue, CardSuit> card, Boolean isSuitFinishedByPlayer, Boolean isValid) io.vertx.core.json.JsonObjectremoveUser(UUID gameID, String username) booleansetPassword(UUID gameID, String password) io.vertx.core.json.JsonObjectbooleanstartNewRound(UUID gameID)
-
Constructor Details
-
GameService
public GameService(io.vertx.core.Vertx vertx) -
GameService
-
GameService
public GameService(io.vertx.core.Vertx vertx, AbstractStatisticManager statisticManager, WebSocketVertx webSocket)
-
-
Method Details
-
createGame
-
joinGame
-
startGame
- Parameters:
gameID-- Returns:
-
canStart
-
canPlayCard
-
playCard
-
chooseTrump
-
startNewRound
-
changeTeam
-
getState
-
isGameEnded
-
makeCall
-
newGame
- Parameters:
gameID- the id of the new game- Returns:
- true if the game has been created, false if the gameId is not found
-
setPassword
- Parameters:
gameID- the id of the new gamepassword- of the game- Returns:
- true if the password has been set, false if the gameId is not found
-
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
-
removeUser
-