Package it.polimi.ingsw.network.client
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 voidcurrentPhasePrint()Manages the possible actions based on the current phasePhaseTypegetCurrentPhase()java.lang.StringgetCurrentPlayer()Returns the username of the current playerbooleanisValidInCurrentPhase(java.lang.String input)Checks if the action performed can be done in this phase of the gamevoidsetCurrentPlayer(java.lang.String currentPlayer)Sets the String passed as parameter as current playervoidsetStateIsPlayerChanged(TurnState newState)set new phase and new currentPlayerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CliTurnManager
Constructor for CliTurnManager class- Parameters:
client- , client's interfaceview- , instance of ViewInterface used to displaystateViewer- , instance of ClientStateViewer that enables querying on client side model state
-
-
Method Details
-
currentPhasePrint
public void currentPhasePrint()Description copied from interface:ClientTurnManagerInterfaceManages the possible actions based on the current phase- Specified by:
currentPhasePrintin interfaceClientTurnManagerInterface
-
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:ClientTurnManagerInterfaceReturns the username of the current player- Specified by:
getCurrentPlayerin interfaceClientTurnManagerInterface- Returns:
- the username of the current player
-
getCurrentPhase
-
setCurrentPlayer
public void setCurrentPlayer(java.lang.String currentPlayer)Description copied from interface:ClientTurnManagerInterfaceSets the String passed as parameter as current player- Specified by:
setCurrentPlayerin interfaceClientTurnManagerInterface- Parameters:
currentPlayer- , username of the player that will be the current
-
setStateIsPlayerChanged
Description copied from interface:ClientTurnManagerInterfaceset new phase and new currentPlayer- Specified by:
setStateIsPlayerChangedin interfaceClientTurnManagerInterface- Parameters:
newState- the new Turn State
-