java.lang.Object
it.polimi.ingsw.am13.client.view.gui.LogGUI
Class that stores a log of the game for the GUI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GameState
State of the gameMessages currently saved. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addToLog
(PlayerLobby player, String log) Adds to the log a generic string, with the specified subject playerprivate void
Adds to the log a generic string, with the server as subject of the logprivate String
boolean
Checks if there are other logs in the queue of messages (i.e.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
logMessageReceived
(PlayerLobby sender, boolean toAll) Adds to the log that a chat message and been received by the clientvoid
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, boolean pointsIncr) 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 reconnectedvoid
Adds to the log that the game has startedvoid
logUpdatePoints
(Map<PlayerLobby, Integer> pointsDelta) Adds to the log that the points were updatedvoid
Adds to the log that the winner has been calculatedSets the most old log as handled, deleting it (i.e.
-
Field Details
-
logMessages
Messages currently saved. It's a queue storing only the still not handled log messages -
gameState
State of the game
-
-
Constructor Details
-
LogGUI
Creates a new instance of the handler of the log for GUI- Parameters:
gameState
- State of the game
-
-
Method Details
-
hasOtherLogs
public boolean hasOtherLogs()Checks if there are other logs in the queue of messages (i.e. the queue is not empty)- Returns:
- True is there are other logs to handle, false otherwise
-
popNextLog
Sets the most old log as handled, deleting it (i.e. pops it from the queue)- Returns:
- Deletes the currently handled log message
-
logStartGame
public void logStartGame()Adds to the log that the game has started -
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 -
logUpdatePoints
Adds to the log that the points were updated- Parameters:
pointsDelta
- Difference between the points now updated and before the update
-
logWinner
public void logWinner()Adds to the log that the winner has been calculated -
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
-
logMessageReceived
Adds to the log that a chat message and been received by the client- Parameters:
sender
- Player who sent the messagetoAll
- True if the message is to all the players, false if it's for a specific player
-
addToLog
Adds to the log a generic string, with the specified subject player- Parameters:
player
- Player subject of the log (who triggered the action logged)log
- String (without the time string and the subject) for the log
-
addToLog
Adds to the log a generic string, with the server as subject of the log- Parameters:
log
- String (without the time string and the subject) for the log
-
currentTimeString
- Returns:
- Formatted string for the current time the log is stored
-