Class CliTurnManager

java.lang.Object
it.polimi.ingsw.network.client.CliTurnManager
All Implemented Interfaces:
ClientTurnManagerInterface

public class CliTurnManager
extends java.lang.Object
implements ClientTurnManagerInterface
Class instantiated once a game is played in CLI configuration. Manages turns client side
  • Constructor Summary

    Constructors
    Constructor Description
    CliTurnManager​(Client client, ViewInterface view, ClientStateViewer stateViewer)
    Constructor for CliTurnManager class
  • Method Summary

    Modifier and Type Method Description
    void currentPhasePrint()
    Manages the possible actions based on the current phase
    PhaseType getCurrentPhase()  
    java.lang.String getCurrentPlayer()
    Returns the username of the current player
    boolean isValidInCurrentPhase​(java.lang.String input)
    Checks if the action performed can be done in this phase of the game
    void setCurrentPlayer​(java.lang.String currentPlayer)
    Sets the String passed as parameter as current player
    void setStateIsPlayerChanged​(TurnState newState)
    set new phase and new currentPlayer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CliTurnManager

      public CliTurnManager​(Client client, ViewInterface view, ClientStateViewer stateViewer)
      Constructor for CliTurnManager class
      Parameters:
      client - , client's interface
      view - , instance of ViewInterface used to display
      stateViewer - , instance of ClientStateViewer that enables querying on client side model state
  • Method Details

    • currentPhasePrint

      public void currentPhasePrint()
      Description copied from interface: ClientTurnManagerInterface
      Manages the possible actions based on the current phase
      Specified by:
      currentPhasePrint in interface ClientTurnManagerInterface
    • isValidInCurrentPhase

      public boolean isValidInCurrentPhase​(java.lang.String input)
      Checks if the action performed can be done in this phase of the game
      Parameters:
      input - , String associated to the action that has been performed
      Returns:
      true if the action performed can be actually done in this phase, false otherwise
    • getCurrentPlayer

      public java.lang.String getCurrentPlayer()
      Description copied from interface: ClientTurnManagerInterface
      Returns the username of the current player
      Specified by:
      getCurrentPlayer in interface ClientTurnManagerInterface
      Returns:
      the username of the current player
    • getCurrentPhase

      public PhaseType getCurrentPhase()
    • setCurrentPlayer

      public void setCurrentPlayer​(java.lang.String currentPlayer)
      Description copied from interface: ClientTurnManagerInterface
      Sets the String passed as parameter as current player
      Specified by:
      setCurrentPlayer in interface ClientTurnManagerInterface
      Parameters:
      currentPlayer - , username of the player that will be the current
    • setStateIsPlayerChanged

      public void setStateIsPlayerChanged​(TurnState newState)
      Description copied from interface: ClientTurnManagerInterface
      set new phase and new currentPlayer
      Specified by:
      setStateIsPlayerChanged in interface ClientTurnManagerInterface
      Parameters:
      newState - the new Turn State