java.lang.Object
polimi.ingsw.am21.codex.controller.GameController
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Used to describe how the events should be dispatched under different circumstances.static class
static enum
The status of a user -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
checkClientConnections
(UUID heartBeatClient) void
connect
(UUID connectionID, RemoteGameEventListener listener) void
createGame
(UUID connectionID, String gameId, Integer players) void
deleteGame
(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 controllervoid
isLastRound
(String gameId) void
joinGame
(UUID connectionID, String gameId, CardSideType sideType) void
void
lobbyChooseObjective
(UUID connectionID, Boolean first) void
lobbySetNickname
(UUID connectionID, String nickname) void
lobbySetTokenColor
(UUID connectionID, TokenColor color) void
void
nextTurn
(UUID connectionID, DrawingCardSource drawingSource, DrawingDeckType deckType) void
notifyDisconnections
(List<UUID> disconnectedClients) Notifies the clients that one or more clients have disconnectedvoid
notifyDisconnectionsSameContext
(List<UUID> disconnectedClients, List<javafx.util.Pair<UUID, GameController.UserGameContext>> sameContextClients) void
placeCard
(UUID connectionID, Integer playerHandCardNumber, CardSideType side, Position position) void
quitFromLobby
(UUID connectionID) void
removePlayerFromLobby
(Game game, UUID connectionID) void
sendChatMessage
(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
-