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 TypeMethodDescriptionvoidconnect()voidconnectToGame(String gameId) voidcreateAndConnectToGame(String gameId, int numberPlayers) voidcreateGame(String gameId, int players) voidvoidgetGames()Retrieves the list of available games and displays them in the viewvoidGets the objective cards the client should choose fromvoidGets the starter card the player has to placevoidSends a heart beat to the servervoidLeaves the game the player has joined, if anyvoidLeaves lobbyvoidlobbyChooseObjectiveCard(Boolean first) voidlobbyJoinGame(CardSideType cardSide) Sets the chosen starter card side and make player join gamevoidlobbySetNickname(String nickname) voidlobbySetToken(TokenColor color) voidnextTurn()Goes to next turn ( called only when the game is in the last round, since you cannot draw a card in that case)voidnextTurn(DrawingCardSource drawingSource, DrawingDeckType deckType) draws a card from the game board and continues to the next turnvoidplaceCard(Integer playerHandCardNumber, CardSideType side, Position position) Places a card in the gridvoidsendChatMessage(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:
connectin classClientConnectionHandler
-
disconnect
public void disconnect()- Specified by:
disconnectin classClientConnectionHandler
-
getGames
public void getGames()Description copied from class:ClientConnectionHandlerRetrieves the list of available games and displays them in the view- Specified by:
getGamesin classClientConnectionHandler
-
createGame
- Specified by:
createGamein classClientConnectionHandler- Parameters:
gameId- the id of the game to createplayers- the number of players in the game
-
connectToGame
- Specified by:
connectToGamein classClientConnectionHandler- Parameters:
gameId- the id of the game to connect to
-
leaveGameLobby
public void leaveGameLobby()Description copied from class:ClientConnectionHandlerLeaves the game the player has joined, if any- Specified by:
leaveGameLobbyin classClientConnectionHandler
-
createAndConnectToGame
- Specified by:
createAndConnectToGamein classClientConnectionHandler- Parameters:
gameId- the id of the game create and connect to
-
lobbySetToken
- Specified by:
lobbySetTokenin classClientConnectionHandler- Parameters:
color- the color of the chosen token color
-
lobbySetNickname
- Specified by:
lobbySetNicknamein classClientConnectionHandler- Parameters:
nickname- the nickname of the lobby player
-
getObjectiveCards
public void getObjectiveCards()Description copied from class:ClientConnectionHandlerGets the objective cards the client should choose from- Specified by:
getObjectiveCardsin classClientConnectionHandler
-
lobbyChooseObjectiveCard
- Specified by:
lobbyChooseObjectiveCardin classClientConnectionHandler- Parameters:
first- true if the player selects the first card in the pair otherwise false
-
getStarterCard
public void getStarterCard()Description copied from class:ClientConnectionHandlerGets the starter card the player has to place- Specified by:
getStarterCardin classClientConnectionHandler
-
lobbyJoinGame
Description copied from class:ClientConnectionHandlerSets the chosen starter card side and make player join game- Specified by:
lobbyJoinGamein classClientConnectionHandler- Parameters:
cardSide- the starter card side chosen by the player
-
placeCard
Description copied from class:ClientConnectionHandlerPlaces a card in the grid- Specified by:
placeCardin 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:ClientConnectionHandlerLeaves lobby- Specified by:
leaveLobbyin classClientConnectionHandler
-
nextTurn
Description copied from class:ClientConnectionHandlerdraws a card from the game board and continues to the next turn- Specified by:
nextTurnin 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:ClientConnectionHandlerGoes to next turn ( called only when the game is in the last round, since you cannot draw a card in that case)- Specified by:
nextTurnin classClientConnectionHandler
-
heartBeat
Description copied from class:ClientConnectionHandlerSends a heart beat to the server- Specified by:
heartBeatin classClientConnectionHandler- Throws:
PlayerNotFoundException
-
sendChatMessage
- Specified by:
sendChatMessagein classClientConnectionHandler
-