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.JsonObject
canPlayCard
(UUID gameID, String username, Card<CardValue, CardSuit> card, Boolean isSuitFinishedByPlayer) io.vertx.core.json.JsonObject
io.vertx.core.json.JsonObject
changeTeam
(UUID gameID, String username, String team, Integer pos) io.vertx.core.json.JsonObject
chooseTrump
(UUID gameID, String cardSuit, String username) io.vertx.core.json.JsonObject
createGame
(Integer numberOfPlayers, User user, int expectedScore, String gameMode) io.vertx.core.json.JsonObject
getGames()
io.vertx.core.json.JsonArray
io.vertx.core.json.JsonObject
io.vertx.core.json.JsonObject
io.vertx.core.json.JsonObject
isGameEnded
(UUID gameID) io.vertx.core.json.JsonObject
io.vertx.core.json.JsonObject
io.vertx.core.json.JsonObject
io.vertx.core.json.JsonObject
playCard
(UUID gameID, String username, Card<CardValue, CardSuit> card, Boolean isSuitFinishedByPlayer, Boolean isValid) io.vertx.core.json.JsonObject
removeUser
(UUID gameID, String username) boolean
setPassword
(UUID gameID, String password) io.vertx.core.json.JsonObject
boolean
startNewRound
(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
-