Class ClientConnectionHandler

java.lang.Object
polimi.ingsw.am21.codex.connection.client.ClientConnectionHandler
Direct Known Subclasses:
RMIClientConnectionHandler, TCPClientConnectionHandler

public abstract class ClientConnectionHandler extends Object
  • Constructor Details

  • Method Details

    • getConnectionType

      public ConnectionType getConnectionType()
    • getGames

      public abstract void getGames()
      Retrieves the list of available games and displays them in the view
    • createGame

      public abstract void createGame(String gameId, int players)
      Parameters:
      gameId - the id of the game to create
      players - the number of players in the game
    • connectToGame

      public abstract void connectToGame(String gameId)
      Parameters:
      gameId - the id of the game to connect to
    • leaveGameLobby

      public abstract void leaveGameLobby()
      Leaves the game the player has joined, if any
    • createAndConnectToGame

      public abstract void createAndConnectToGame(String gameId, int numberPlayers)
      Parameters:
      gameId - the id of the game create and connect to
    • lobbySetToken

      public abstract void lobbySetToken(TokenColor color)
      Parameters:
      color - the color of the chosen token color
    • lobbySetNickname

      public abstract void lobbySetNickname(String nickname)
      Parameters:
      nickname - the nickname of the lobby player
    • getObjectiveCards

      public abstract void getObjectiveCards()
      Gets the objective cards the client should choose from
    • lobbyChooseObjectiveCard

      public abstract void lobbyChooseObjectiveCard(Boolean first)
      Parameters:
      first - true if the player selects the first card in the pair otherwise false
    • getStarterCard

      public abstract void getStarterCard()
      Gets the starter card the player has to place
    • lobbyJoinGame

      public abstract void lobbyJoinGame(CardSideType cardSide)
      Sets the chosen starter card side and make player join game
      Parameters:
      cardSide - the starter card side chosen by the player
    • placeCard

      public abstract void placeCard(Integer playerHandCardNumber, CardSideType side, Position position)
      Places a card in the grid
      Parameters:
      playerHandCardNumber - the index of the card to place from the player hand
      side - which side the player wants to place it
      position - the target position
    • leaveLobby

      public abstract void leaveLobby()
      Leaves lobby
    • nextTurn

      public abstract void nextTurn(DrawingCardSource drawingSource, DrawingDeckType deckType)
      draws a card from the game board and continues to the next turn
      Parameters:
      drawingSource - the source were we get the card
      deckType - the type of card that we draw
    • nextTurn

      public abstract 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)
    • heartBeat

      public abstract void heartBeat(Runnable successful, Runnable failed) throws PlayerNotFoundException
      Sends a heart beat to the server
      Throws:
      PlayerNotFoundException
    • sendChatMessage

      public abstract void sendChatMessage(ChatMessage message)
    • connect

      public abstract void connect()
    • disconnect

      public abstract void disconnect()
    • isConnected

      public Boolean isConnected()
    • isLosing

      public Boolean isLosing()
    • isConnectedOrLosing

      public Boolean isConnectedOrLosing()
    • messageNotSent

      public void messageNotSent()
    • connectionFailed

      public void connectionFailed(Exception e)
    • connectionEstablished

      public void connectionEstablished()
    • getObjectivesIfNull

      public void getObjectivesIfNull()