java.lang.Object
it.polimi.ingsw.am13.client.view.tui.LogTUI
Class that stores the logs for the TUI
To avoid using too much space in the terminal, it only stores the last LOG_MAXLINES log messages
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GameState
State of the gameMessages currently saved. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Adds to the log a generic stringprivate String
void
Adds to the log that the specified player chosen their personal objective cardvoid
logDisconnect
(PlayerLobby player) Adds to the log that the specified player disconnectedvoid
Adds to the log that the final phase has been triggeredvoid
Adds to the log that the turn changed, and specifies the new current playervoid
logPickedCard
(PlayerLobby player) Adds to the log that the specified player picked a cardvoid
logPlayedCard
(PlayerLobby player, Coordinates coord) Adds to the log that the specified player played the a card on the specified coordinatesvoid
logPlayedStarter
(PlayerLobby player) Adds to the log that the specified player played the starter cardvoid
logReconnect
(PlayerLobby player) Adds to the log that the specified player reconnected
-
Field Details
-
logMessages
Messages currently saved. It's a deque with a fixed size (size stored inViewTUIConstants.LOG_MAXLINES
-
gameState
State of the game
-
-
Constructor Details
-
LogTUI
Creates a new instance of the handler of the log for TUI- Parameters:
gameState
- State of the game
-
-
Method Details
-
getLogMessages
- Returns:
- List of the last logs, sorted from the most recent to the most old
-
logPlayedStarter
Adds to the log that the specified player played the starter card- Parameters:
player
- Player who played the starter card
-
logChosenPersonalObjective
Adds to the log that the specified player chosen their personal objective card- Parameters:
player
- Player who chose the personal objective card
-
logPlayedCard
Adds to the log that the specified player played the a card on the specified coordinates- Parameters:
player
- Player who played the cardcoord
- Coordinates on which the card has been placed
-
logPickedCard
Adds to the log that the specified player picked a card- Parameters:
player
- Player who picked the card
-
logNextTurn
public void logNextTurn()Adds to the log that the turn changed, and specifies the new current player -
logFinalPhase
public void logFinalPhase()Adds to the log that the final phase has been triggered -
logDisconnect
Adds to the log that the specified player disconnected- Parameters:
player
- Player who disconnected
-
logReconnect
Adds to the log that the specified player reconnected- Parameters:
player
- Player who reconnected
-
addToLog
Adds to the log a generic string- Parameters:
log
- String (already formatted) for the log
-
currentTimeString
- Returns:
- Formatted string for the current time the log is stored
-