# Class CardManagerController

java.lang.Object
it.polimi.ingsw.is25am31.view.gui.CardManagerController

public class CardManagerController extends Object
Controller for managing card display and player interactions during card resolution phases. Handles the display of card information, player commands, dice results, and manages the state transitions between active player turns and spectator mode.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CardManagerController()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `enterSpectatorMode()`
  Switches the controller to spectator mode, disabling all input controls.
  `javafx.stage.Stage`
  `getStage()`
  Gets the stage associated with this controller.
  `void`
  `onError(String message)`
  Displays an error message in the error label with an error icon.
  `void`
  `onInfo(String message)`
  Displays an informational message in the info label.
  `void`
  `setCard(Card card)`
  Sets the card to be displayed and managed by this controller.
  `void`
  `setClientModel(ClientModel clientModel)`
  Sets the client model for this controller and updates the turn message.
  `void`
  `setStage(javafx.stage.Stage stage)`
  Sets the stage associated with this controller.
  `void`
  `setTurnMessage()`
  Updates the turn message and input field state based on the current client state.
  `void`
  `showDiceResult(int result)`
  Displays the result of a dice roll in the dice label.
  `void`
  `showErrorMessage(String message)`
  Displays an error message in the error label and makes it visible.
  `void`
  `showInfoMessage(String message)`
  Displays an informational message in the info label and makes it visible.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CardManagerController

    public CardManagerController()

- ## Method Details

  - ### setClientModel

    public void setClientModel(ClientModel clientModel)
    Sets the client model for this controller and updates the turn message.
    Parameters:
      `clientModel` - the client model containing game state information

  - ### setCard

    public void setCard(Card card)
    Sets the card to be displayed and managed by this controller. Loads the card image and displays its description.
    Parameters:
      `card` - the card to be displayed

  - ### setTurnMessage

    public void setTurnMessage()
    Updates the turn message and input field state based on the current client state. Enables input for the active player during effect resolution, disables it otherwise.

  - ### onInfo

    public void onInfo(String message)
    Displays an informational message in the info label.
    Parameters:
      `message` - the information message to display

  - ### onError

    public void onError(String message)
    Displays an error message in the error label with an error icon.
    Parameters:
      `message` - the error message to display

  - ### enterSpectatorMode

    public void enterSpectatorMode()
    Switches the controller to spectator mode, disabling all input controls.

  - ### setStage

    public void setStage(javafx.stage.Stage stage)
    Sets the stage associated with this controller.
    Parameters:
      `stage` - the JavaFX stage

  - ### getStage

    public javafx.stage.Stage getStage()
    Gets the stage associated with this controller.
    Returns:
      the JavaFX stage

  - ### showDiceResult

    public void showDiceResult(int result)
    Displays the result of a dice roll in the dice label. Shows an empty string if the result is 0, otherwise shows the dice emoji with the result.
    Parameters:
      `result` - the dice roll result (0 to hide, 1-6 to display)

  - ### showErrorMessage

    public void showErrorMessage(String message)
    Displays an error message in the error label and makes it visible.
    Parameters:
      `message` - the error message to display

  - ### showInfoMessage

    public void showInfoMessage(String message)
    Displays an informational message in the info label and makes it visible.
    Parameters:
      `message` - the information message to display