Module polimi.ingsw.am21.codex
Class RMIClientConnectionHandler
java.lang.Object
polimi.ingsw.am21.codex.connection.client.ClientConnectionHandler
polimi.ingsw.am21.codex.connection.client.RMI.RMIClientConnectionHandler
- All Implemented Interfaces:
Remote
-
Constructor Summary
ConstructorsConstructorDescriptionRMIClientConnectionHandler
(String host, Integer port, View view, ClientGameEventHandler gameEventHandler, UUID connectionID) -
Method Summary
Modifier and TypeMethodDescriptionvoid
connect()
void
connectToGame
(String gameId) void
createAndConnectToGame
(String gameId, int numberPlayers) void
createGame
(String gameId, int players) void
void
getGames()
Retrieves the list of available games and displays them in the viewvoid
Gets the objective cards the client should choose fromvoid
Gets the starter card the player has to placevoid
Sends a heart beat to the servervoid
Leaves the game the player has joined, if anyvoid
Leaves lobbyvoid
lobbyChooseObjectiveCard
(Boolean first) void
lobbyJoinGame
(CardSideType cardSide) Sets the chosen starter card side and make player join gamevoid
lobbySetNickname
(String nickname) void
lobbySetToken
(TokenColor color) void
nextTurn()
Goes to next turn ( called only when the game is in the last round, since you cannot draw a card in that case)void
nextTurn
(DrawingCardSource drawingSource, DrawingDeckType deckType) draws a card from the game board and continues to the next turnvoid
placeCard
(Integer playerHandCardNumber, CardSideType side, Position position) Places a card in the gridvoid
sendChatMessage
(ChatMessage message) Methods inherited from class polimi.ingsw.am21.codex.connection.client.ClientConnectionHandler
connectionEstablished, connectionFailed, getConnectionType, getObjectivesIfNull, isConnected, isConnectedOrLosing, isLosing, messageNotSent
-
Constructor Details
-
RMIClientConnectionHandler
public RMIClientConnectionHandler(String host, Integer port, View view, ClientGameEventHandler gameEventHandler, UUID connectionID)
-
-
Method Details
-
connect
public void connect()- Specified by:
connect
in classClientConnectionHandler
-
disconnect
public void disconnect()- Specified by:
disconnect
in classClientConnectionHandler
-
getGames
public void getGames()Description copied from class:ClientConnectionHandler
Retrieves the list of available games and displays them in the view- Specified by:
getGames
in classClientConnectionHandler
-
createGame
- Specified by:
createGame
in classClientConnectionHandler
- Parameters:
gameId
- the id of the game to createplayers
- the number of players in the game
-
connectToGame
- Specified by:
connectToGame
in classClientConnectionHandler
- Parameters:
gameId
- the id of the game to connect to
-
leaveGameLobby
public void leaveGameLobby()Description copied from class:ClientConnectionHandler
Leaves the game the player has joined, if any- Specified by:
leaveGameLobby
in classClientConnectionHandler
-
createAndConnectToGame
- Specified by:
createAndConnectToGame
in classClientConnectionHandler
- Parameters:
gameId
- the id of the game create and connect to
-
lobbySetToken
- Specified by:
lobbySetToken
in classClientConnectionHandler
- Parameters:
color
- the color of the chosen token color
-
lobbySetNickname
- Specified by:
lobbySetNickname
in classClientConnectionHandler
- Parameters:
nickname
- the nickname of the lobby player
-
getObjectiveCards
public void getObjectiveCards()Description copied from class:ClientConnectionHandler
Gets the objective cards the client should choose from- Specified by:
getObjectiveCards
in classClientConnectionHandler
-
lobbyChooseObjectiveCard
- Specified by:
lobbyChooseObjectiveCard
in classClientConnectionHandler
- Parameters:
first
- true if the player selects the first card in the pair otherwise false
-
getStarterCard
public void getStarterCard()Description copied from class:ClientConnectionHandler
Gets the starter card the player has to place- Specified by:
getStarterCard
in classClientConnectionHandler
-
lobbyJoinGame
Description copied from class:ClientConnectionHandler
Sets the chosen starter card side and make player join game- Specified by:
lobbyJoinGame
in classClientConnectionHandler
- Parameters:
cardSide
- the starter card side chosen by the player
-
placeCard
Description copied from class:ClientConnectionHandler
Places a card in the grid- Specified by:
placeCard
in classClientConnectionHandler
- Parameters:
playerHandCardNumber
- the index of the card to place from the player handside
- which side the player wants to place itposition
- the target position
-
leaveLobby
public void leaveLobby()Description copied from class:ClientConnectionHandler
Leaves lobby- Specified by:
leaveLobby
in classClientConnectionHandler
-
nextTurn
Description copied from class:ClientConnectionHandler
draws a card from the game board and continues to the next turn- Specified by:
nextTurn
in classClientConnectionHandler
- Parameters:
drawingSource
- the source were we get the carddeckType
- the type of card that we draw
-
nextTurn
public void nextTurn()Description copied from class:ClientConnectionHandler
Goes to next turn ( called only when the game is in the last round, since you cannot draw a card in that case)- Specified by:
nextTurn
in classClientConnectionHandler
-
heartBeat
Description copied from class:ClientConnectionHandler
Sends a heart beat to the server- Specified by:
heartBeat
in classClientConnectionHandler
- Throws:
PlayerNotFoundException
-
sendChatMessage
- Specified by:
sendChatMessage
in classClientConnectionHandler
-