Class Cli

java.lang.Object
it.polimi.ingsw.view.cli.Cli
All Implemented Interfaces:
LorenzoViewInterface, ViewInterface

public class Cli
extends java.lang.Object
implements ViewInterface
CLI client class, manages the game if the player decides to play with Command Line Interface
  • Constructor Details

    • Cli

      public Cli​(ClientStateViewer stateViewer, CliDrawer drawer, Client client)
      Constructor for Cli class
      Parameters:
      stateViewer - , instance of the interface that allows the user to query the client's side model state
      drawer - , instance of the class that manage the Cli representation of the game state
      client - , client on which the Cli is running
  • Method Details

    • displayInitialResourcesChoice

      public void displayInitialResourcesChoice()
      Description copied from interface: ViewInterface
      Displays the four marbles associated to a resource
      Specified by:
      displayInitialResourcesChoice in interface ViewInterface
    • displayMarbleShopping

      public void displayMarbleShopping()
      Description copied from interface: ViewInterface
      Displays the marbles player got from the market and let him insert one
      Specified by:
      displayMarbleShopping in interface ViewInterface
    • displayLeaderHand

      public void displayLeaderHand()
      Description copied from interface: ViewInterface
      Displays the LeaderCard of this client that have not been activated yet
      Specified by:
      displayLeaderHand in interface ViewInterface
    • displayNetworkSetup

      public void displayNetworkSetup()
      Description copied from interface: ViewInterface
      Display the network setup options. Asks for Ip address and port of the server
      Specified by:
      displayNetworkSetup in interface ViewInterface
    • setClientTurnManager

      public void setClientTurnManager​(ClientTurnManagerInterface cliTurnManager)
      Specified by:
      setClientTurnManager in interface ViewInterface
    • displayLogin

      public void displayLogin()
      Description copied from interface: ViewInterface
      Displays the login setup. Asks for username, if the player want to join or create a match and the room name
      Specified by:
      displayLogin in interface ViewInterface
    • displayPlayersNumberChoice

      public void displayPlayersNumberChoice()
      Description copied from interface: ViewInterface
      Displays the choice of the number of players
      Specified by:
      displayPlayersNumberChoice in interface ViewInterface
    • displaySetupFailure

      public void displaySetupFailure()
      Description copied from interface: ViewInterface
      Displays that the server can not be reached
      Specified by:
      displaySetupFailure in interface ViewInterface
    • displayDisconnected

      public void displayDisconnected()
      Method used to show disconnection from server
      Specified by:
      displayDisconnected in interface ViewInterface
    • displayFailedLogin

      public void displayFailedLogin()
      Description copied from interface: ViewInterface
      Displays that the username is already taken
      Specified by:
      displayFailedLogin in interface ViewInterface
    • displayLoginSuccessful

      public void displayLoginSuccessful​(java.lang.String username)
      Description copied from interface: ViewInterface
      Displays that login setup has been operated correctly
      Specified by:
      displayLoginSuccessful in interface ViewInterface
      Parameters:
      username - the player's username
    • displayLobbyCreated

      public void displayLobbyCreated()
      Description copied from interface: ViewInterface
      Displays that the lobby has been successfully created
      Specified by:
      displayLobbyCreated in interface ViewInterface
    • displayOtherUserJoined

      public void displayOtherUserJoined​(Message msg)
      Description copied from interface: ViewInterface
      Displays that another player joined the lobby
      Specified by:
      displayOtherUserJoined in interface ViewInterface
      Parameters:
      msg - , message containing all the information to display
    • displayYouJoined

      public void displayYouJoined()
      Description copied from interface: ViewInterface
      Displays that you have successfully joined the lobby
      Specified by:
      displayYouJoined in interface ViewInterface
    • displayWaiting

      public void displayWaiting()
      Specified by:
      displayWaiting in interface ViewInterface
    • displayServerDown

      public void displayServerDown()
      Description copied from interface: ViewInterface
      Displays that the server has crashed
      Specified by:
      displayServerDown in interface ViewInterface
    • displayGameAlreadyStarted

      public void displayGameAlreadyStarted()
      Description copied from interface: ViewInterface
      Displays that the player can't join the game because it's already started
      Specified by:
      displayGameAlreadyStarted in interface ViewInterface
    • displayReconnection

      public void displayReconnection()
      Specified by:
      displayReconnection in interface ViewInterface
    • displayGameStarted

      public void displayGameStarted()
      Description copied from interface: ViewInterface
      Displays that the game is started
      Specified by:
      displayGameStarted in interface ViewInterface
    • displayRecievedLeadercards

      public void displayRecievedLeadercards()
      Specified by:
      displayRecievedLeadercards in interface ViewInterface
    • displayMarket

      public void displayMarket()
      Specified by:
      displayMarket in interface ViewInterface
    • displayPlayerTurn

      public void displayPlayerTurn​(java.lang.String player)
      Description copied from interface: ViewInterface
      Displays that it's the turn of the player whose name is the one passed as parameter
      Specified by:
      displayPlayerTurn in interface ViewInterface
      Parameters:
      player - , player's username
    • displayYourTurn

      public void displayYourTurn​(java.lang.String username)
      Description copied from interface: ViewInterface
      Displays to the player whose name is the one passed as parameter that is it's turn
      Specified by:
      displayYourTurn in interface ViewInterface
      Parameters:
      username - , player's username
    • displayDefaultCanvas

      public void displayDefaultCanvas​(java.lang.String username)
      Description copied from interface: ViewInterface
      Displays the default canvas of the player whose name is the one passed as parameter
      Specified by:
      displayDefaultCanvas in interface ViewInterface
      Parameters:
      username - , username of the player
    • displayGameEnded

      public void displayGameEnded​(java.lang.String payload)
      Description copied from interface: LorenzoViewInterface
      Displays that the game has ended
      Specified by:
      displayGameEnded in interface LorenzoViewInterface
      Parameters:
      payload - , contains the winner of the game and its score
    • displayPlainCanvas

      public void displayPlainCanvas()
      Description copied from interface: ViewInterface
      Displays a plain canvas
      Specified by:
      displayPlainCanvas in interface ViewInterface
    • startingSetupUpdate

      public void startingSetupUpdate()
      Description copied from interface: ViewInterface
      Starts the setup of the game
      Specified by:
      startingSetupUpdate in interface ViewInterface
    • displayChooseLeaderOnWhite

      public void displayChooseLeaderOnWhite()
      Description copied from interface: ViewInterface
      Displays the choice of the LeaderCard in case the marble to insert is white
      Specified by:
      displayChooseLeaderOnWhite in interface ViewInterface
    • displayFinalPhase

      public void displayFinalPhase()
      Description copied from interface: ViewInterface
      Enable the only actions that can be done in Final Phase
      Specified by:
      displayFinalPhase in interface ViewInterface
    • displayProducingPhase

      public void displayProducingPhase()
      Description copied from interface: ViewInterface
      Enable the only actions that can be done in Production Phase
      Specified by:
      displayProducingPhase in interface ViewInterface
    • displayShoppingPhase

      public void displayShoppingPhase()
      Specified by:
      displayShoppingPhase in interface ViewInterface
    • displayNotBuyable

      public void displayNotBuyable()
      Description copied from interface: ViewInterface
      Displays that the player can't buy the card he wanted because he hasn't enough resources
      Specified by:
      displayNotBuyable in interface ViewInterface
    • displayInvalidLeadercard

      public void displayInvalidLeadercard()
      Description copied from interface: ViewInterface
      Displays that the player has inserted a LeaderCard that is not valid
      Specified by:
      displayInvalidLeadercard in interface ViewInterface
    • displayCannotDiscardActiveLeader

      public void displayCannotDiscardActiveLeader()
      Description copied from interface: ViewInterface
      Displays that the deletion of the leader the player wanted to discard can't be done because it's active
      Specified by:
      displayCannotDiscardActiveLeader in interface ViewInterface
    • displayNotActivatableProduction

      public void displayNotActivatableProduction()
      Description copied from interface: ViewInterface
      Displays that the production on a certain card can't be done because resources are not enough
      Specified by:
      displayNotActivatableProduction in interface ViewInterface
    • displayAlreadyProduced

      public void displayAlreadyProduced()
      Description copied from interface: ViewInterface
      Displays that the production on a certain card can't be done because it as already been used in this turn
      Specified by:
      displayAlreadyProduced in interface ViewInterface
    • displayNotEnoughResources

      public void displayNotEnoughResources()
      Description copied from interface: ViewInterface
      Displays that the action can't be performed because resources are not enough
      Specified by:
      displayNotEnoughResources in interface ViewInterface
    • displayInvalidCardPlacement

      public void displayInvalidCardPlacement()
      Description copied from interface: ViewInterface
      Displays that a card can't be placed in the slot the player wanted to
      Specified by:
      displayInvalidCardPlacement in interface ViewInterface
    • displayMatchAlreadyExist

      public void displayMatchAlreadyExist()
      Description copied from interface: ViewInterface
      Displays that the name of the match the player tried to create is occupied by another match
      Specified by:
      displayMatchAlreadyExist in interface ViewInterface
    • displayCannotJoinMatch

      public void displayCannotJoinMatch()
      Description copied from interface: ViewInterface
      Displays that the player cannot join the match they tried to: i.e. the match doesn't exist, the match is full or the match is already started
      Specified by:
      displayCannotJoinMatch in interface ViewInterface
    • displayFatalError

      public void displayFatalError​(java.lang.String errorMessage)
      Description copied from interface: ViewInterface
      Display a fatal error and ask the player to close the game
      Specified by:
      displayFatalError in interface ViewInterface
      Parameters:
      errorMessage - the error description
    • displayLorenzoDiscarded

      public void displayLorenzoDiscarded​(DevelopCardDeckUpdate state)
      Description copied from interface: LorenzoViewInterface
      Displays that Lorenzo's last move hase been a discard
      Specified by:
      displayLorenzoDiscarded in interface LorenzoViewInterface
      Parameters:
      state - , update content
    • displayLorenzoMoved

      public void displayLorenzoMoved()
      Description copied from interface: LorenzoViewInterface
      Displays that Lorenzo has moved his faith mark
      Specified by:
      displayLorenzoMoved in interface LorenzoViewInterface
    • displayLorenzoShuffled

      public void displayLorenzoShuffled()
      Description copied from interface: LorenzoViewInterface
      Displays that Lorenzo's last move hase been a shuffle
      Specified by:
      displayLorenzoShuffled in interface LorenzoViewInterface