java.lang.Object
it.polimi.ingsw.am13.client.view.tui.LogTUI

public class LogTUI extends Object
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 Details

  • Constructor Details

    • LogTUI

      public LogTUI(GameState gameState)
      Creates a new instance of the handler of the log for TUI
      Parameters:
      gameState - State of the game
  • Method Details

    • getLogMessages

      public List<String> getLogMessages()
      Returns:
      List of the last logs, sorted from the most recent to the most old
    • logPlayedStarter

      public void logPlayedStarter(PlayerLobby player)
      Adds to the log that the specified player played the starter card
      Parameters:
      player - Player who played the starter card
    • logChosenPersonalObjective

      public void logChosenPersonalObjective(PlayerLobby player)
      Adds to the log that the specified player chosen their personal objective card
      Parameters:
      player - Player who chose the personal objective card
    • logPlayedCard

      public void logPlayedCard(PlayerLobby player, Coordinates coord)
      Adds to the log that the specified player played the a card on the specified coordinates
      Parameters:
      player - Player who played the card
      coord - Coordinates on which the card has been placed
    • logPickedCard

      public void logPickedCard(PlayerLobby player)
      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

      public void logDisconnect(PlayerLobby player)
      Adds to the log that the specified player disconnected
      Parameters:
      player - Player who disconnected
    • logReconnect

      public void logReconnect(PlayerLobby player)
      Adds to the log that the specified player reconnected
      Parameters:
      player - Player who reconnected
    • addToLog

      private void addToLog(String log)
      Adds to the log a generic string
      Parameters:
      log - String (already formatted) for the log
    • currentTimeString

      private String currentTimeString()
      Returns:
      Formatted string for the current time the log is stored