java.lang.Object
polimi.ingsw.am21.codex.controller.GameController
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumUsed to describe how the events should be dispatched under different circumstances.static classstatic enumThe status of a user -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcheckClientConnections(UUID heartBeatClient) voidconnect(UUID connectionID, RemoteGameEventListener listener) voidcreateGame(UUID connectionID, String gameId, Integer players) voiddeleteGame(UUID connectionID, String gameId) getAvailableTokens(String gameId) Returns the current slots for each game (mapped by ID) managed by this controllerReturns the game with the given ID, if it existsgetGames()Returns the set of games (by ID) managed by this controllergetLobbyObjectiveCards(UUID connectionID) getLobbyStarterCard(UUID connectionID) Returns the maximum slots for each game (mapped by ID) managed by this controllervoidisLastRound(String gameId) voidjoinGame(UUID connectionID, String gameId, CardSideType sideType) voidvoidlobbyChooseObjective(UUID connectionID, Boolean first) voidlobbySetNickname(UUID connectionID, String nickname) voidlobbySetTokenColor(UUID connectionID, TokenColor color) voidvoidnextTurn(UUID connectionID, DrawingCardSource drawingSource, DrawingDeckType deckType) voidnotifyDisconnections(List<UUID> disconnectedClients) Notifies the clients that one or more clients have disconnectedvoidnotifyDisconnectionsSameContext(List<UUID> disconnectedClients, List<javafx.util.Pair<UUID, GameController.UserGameContext>> sameContextClients) voidplaceCard(UUID connectionID, Integer playerHandCardNumber, CardSideType side, Position position) voidquitFromLobby(UUID connectionID) voidremovePlayerFromLobby(Game game, UUID connectionID) voidsendChatMessage(UUID connectionID, ChatMessage chatMessage) void
-
Constructor Details
-
GameController
public GameController()
-
-
Method Details
-
getGames
Returns the set of games (by ID) managed by this controller -
getCurrentSlots
Returns the current slots for each game (mapped by ID) managed by this controller -
getMaxSlots
Returns the maximum slots for each game (mapped by ID) managed by this controller -
getGame
Returns the game with the given ID, if it exists- Throws:
GameNotFoundException
-
notifyDisconnections
Notifies the clients that one or more clients have disconnected- Parameters:
disconnectedClients- list of clients that have disconnected
-
notifyDisconnectionsSameContext
public void notifyDisconnectionsSameContext(List<UUID> disconnectedClients, List<javafx.util.Pair<UUID, GameController.UserGameContext>> sameContextClients) -
checkClientConnections
public void checkClientConnections() -
checkClientConnections
-
heartBeat
- Throws:
PlayerNotFoundException
-
removePlayerFromLobby
- Throws:
InvalidActionException
-
quitFromLobby
- Throws:
InvalidActionException
-
joinLobby
- Throws:
InvalidActionException
-
lobbySetTokenColor
- Throws:
InvalidActionException
-
lobbySetNickname
- Throws:
InvalidActionException
-
lobbyChooseObjective
- Throws:
InvalidActionException
-
startGame
- Throws:
InvalidActionException
-
joinGame
public void joinGame(UUID connectionID, String gameId, CardSideType sideType) throws InvalidActionException - Throws:
InvalidActionException
-
createGame
public void createGame(UUID connectionID, String gameId, Integer players) throws InvalidActionException - Throws:
InvalidActionException
-
isLastRound
- Throws:
GameNotFoundException
-
deleteGame
- Throws:
InvalidActionException
-
nextTurn
- Throws:
InvalidActionException
-
nextTurn
public void nextTurn(UUID connectionID, DrawingCardSource drawingSource, DrawingDeckType deckType) throws InvalidActionException - Throws:
InvalidActionException
-
connect
-
placeCard
public void placeCard(UUID connectionID, Integer playerHandCardNumber, CardSideType side, Position position) throws InvalidActionException - Throws:
InvalidActionException
-
getAvailableTokens
- Throws:
InvalidActionException
-
getGamesCurrentPlayers
-
getGamesMaxPlayers
-
getLobbyObjectiveCards
public javafx.util.Pair<Integer,Integer> getLobbyObjectiveCards(UUID connectionID) throws InvalidActionException - Throws:
InvalidActionException
-
getLobbyStarterCard
- Throws:
InvalidActionException
-
sendChatMessage
public void sendChatMessage(UUID connectionID, ChatMessage chatMessage) throws InvalidActionException - Throws:
InvalidActionException
-