Class PlayerBoardPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PlayerBoardPanel extends JPanel
Class containing all the elements necessary to graphically represent both the player’s playerBoard and the assistant cards still usable. It also implements some logic of characterCard's actions which require to interact with the playerboard in order to work properly.
See Also:
  • Field Details

    • socketWrapper

      private final SocketWrapper socketWrapper
      SocketWrapper necessary to send actions from GUI to server
    • player

      private final PlayerBoard player
      Contains player's PlayerBoard information
    • model

      private final Model model
      Contains game's information
    • guiSocketListener

      private final GUISocketListener guiSocketListener
      Contains GuiReader's information necessary to record user's requests during his turn
  • Constructor Details

    • PlayerBoardPanel

      public PlayerBoardPanel(PlayerBoard pb, Model model, SocketWrapper socketWrapper, GUISocketListener guiSocketListener)
      Create a new PlayerBoardPanel
      Parameters:
      pb - Player's playerboard to represent
      model - Game's model
      socketWrapper - socketWrapper to communicate with Server
      guiSocketListener - guiReader from GameInProgressPanel
  • Method Details

    • GetCardsToShow

      private ArrayList<JButton> GetCardsToShow(ArrayList<JButton> assistantCardsLabels, ArrayList<AssistantCard> assistantCards)
      Support method that, given an ArrayList of assistantCards, returns an arrayList containing the relative buttons (example, given the assistantCard with priority 5, the method returns a JButton with the right assistantCard's image (image with number 5)
      Parameters:
      assistantCardsLabels - ArrayList containing assistantCard's JButton (containing assistantCards' images)
      assistantCards - ArrayList containing AssistantCards of interest
      Returns:
      an arrayList containing AssistantCards' JButtons
    • getPlayerBoardNickname

      public String getPlayerBoardNickname()
      get PlayerBoardNickname
      Returns:
      playerBoardPanel's playerBoard's nickname
    • getPlayerBoardId

      public int getPlayerBoardId()
      get PlayerBoard id
      Returns:
      playerBoardPanel's playerBoard's id
    • PlayCharacterCardEffect

      public void PlayCharacterCardEffect(int cardIndex, int cardPositionInGame, OptionalValue<ArrayList<PawnColour>> fromCard)
      Executes characterCards' effects that interact directly with the playerBoard
      Parameters:
      cardIndex - card's priority
      cardPositionInGame - card's position inside the game (0 to 2)
      fromCard - Optional list containing pawnColour picked from characterCard