Class PlayerBoardUI

java.lang.Object
it.polimi.ingsw.Client.CLI.PlayerBoardUI

public class PlayerBoardUI extends Object
PlayerBoardUI allows to print all the information representing the PlayerBoard.
It exposes multiple methods to render the individual components independently and one method to combine them all in a single component.
  • Constructor Details

    • PlayerBoardUI

      public PlayerBoardUI()
  • Method Details

    • drawPlayerBoard

      public static String drawPlayerBoard(PlayerBoard playerBoard, Model ctx)
      It draws a representation of the PlayerBoard of the provided player.
      Parameters:
      playerBoard - the PlayerBoard which will be represented
      ctx - reference to the model used to check the available coins left in the game
      Returns:
      the complete player board UI component
    • drawEntrance

      public static String drawEntrance(PlayerBoard pb, Model gb)
      It draws a representation of the entrance of the provided player.
      Parameters:
      pb - the PlayerBoard to which the entrance should be associated with
      gb - reference to the model used to add padding in the entrance when 2 or 4 players are in the game because they have less students in the entrance than 3 players' game
      Returns:
      the unused students in a multiline dual column layout String representation
    • drawTowers

      public static String drawTowers(PlayerBoard p, Model gb)
      It draws a representation of the tower storage of the provided player.
      Parameters:
      p - the PlayerBoard to which the towers should be associated with
      gb - reference to the model used to check the relationship between towers and player
      Returns:
      the unused towers in a multiline dual column layout String representation
    • drawDiningRoomRow

      public static String drawDiningRoomRow(PawnColour rowColour, PlayerBoard p, GameMode gameMode)
      It draws a dining room's row with its related students and the not yet obtained coins
      Parameters:
      rowColour - the dining room's row which should be printed
      p - the PlayerBoard to which the dining room should be associated with
      gameMode - reference to the model used to add coin representation if in correct settings
      Returns:
      a fixed length line containing all the students on the specific dining room's row
    • drawTeacher

      public static String drawTeacher(PawnColour teacher, PlayerBoard p, Model gb)
      A single teacher will be represented with the standard UI representation of the pawn piece or an empty space if the player has not conquered that specific teacher yet.
      Parameters:
      teacher - the specific PawnColour of the teacher to be represented
      p - the PlayerBoard to which the teacher should be associated with
      gb - reference to the model used to check the relationship between teacher and player
      Returns:
      single line containing teacher