Class TotemFXMLController
java.lang.Object
it.polimi.ingsw.gc14.View.GUI.TotemFXMLController
FXML controller for the totem selection scene.
Displays the available totems and lets the current player choose one; other players see a waiting banner.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.image.ImageViewBackground image displayed behind the totem selection grid.private javafx.scene.control.ButtonButton that submits the selected totem to the server.private ClientControllerClient controller for sending the totem choice.private javafx.scene.layout.HBoxHBox containing the totem card widgets.private javafx.scene.layout.StackPaneTheStackPaneframe of the currently selected totem card, ornull.private intIndex of the currently selected totem, or-1if none selected.private javafx.scene.control.LabelBanner label showing whose turn it is to choose a totem. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate javafx.scene.layout.VBoxBuilds a totem card widget; ifinteractive, wires click/hover handlers and selection logic.private Stringcapitalize(Totems t) Returns the totem name with only the first letter capitalized.private StringframeStyle(boolean selected) Returns the CSS style string for the totem card frame, highlighting it whenselected.voidInitializes the scene: sets the background image to fill the screen.private StringnameStyle(boolean selected) Returns the CSS style string for the totem name label, brightening it whenselected.private voidSubmits the selected totem index to the controller when the confirm button is clicked.voidrender()Renders the totem selection cards with entry animations.voidsetController(ClientController controller) Injects the client controller into this FXML controller.private voidupdateBanner(String chooser, boolean myTurn) Updates the turn banner text and style based on whether it is the local player's turn.private voidupdateConfirmButton(boolean enabled) Enables or disables the confirm button and updates its visual opacity to reflect the state.
-
Field Details
-
backgroundImage
private javafx.scene.image.ImageView backgroundImageBackground image displayed behind the totem selection grid. -
mainHBox
private javafx.scene.layout.HBox mainHBoxHBox containing the totem card widgets. -
turnBanner
private javafx.scene.control.Label turnBannerBanner label showing whose turn it is to choose a totem. -
confirmButton
private javafx.scene.control.Button confirmButtonButton that submits the selected totem to the server. -
controller
Client controller for sending the totem choice. -
selectedIndex
private int selectedIndexIndex of the currently selected totem, or-1if none selected. -
selectedFrame
private javafx.scene.layout.StackPane selectedFrameTheStackPaneframe of the currently selected totem card, ornull.
-
-
Constructor Details
-
TotemFXMLController
public TotemFXMLController()
-
-
Method Details
-
setController
Injects the client controller into this FXML controller.- Parameters:
controller- the client controller to use.
-
initialize
public void initialize()Initializes the scene: sets the background image to fill the screen. -
render
public void render()Renders the totem selection cards with entry animations. Disables interaction for players who are not the current chooser. -
updateBanner
Updates the turn banner text and style based on whether it is the local player's turn. -
buildCard
Builds a totem card widget; ifinteractive, wires click/hover handlers and selection logic. -
updateConfirmButton
private void updateConfirmButton(boolean enabled) Enables or disables the confirm button and updates its visual opacity to reflect the state. -
frameStyle
Returns the CSS style string for the totem card frame, highlighting it whenselected. -
nameStyle
Returns the CSS style string for the totem name label, brightening it whenselected. -
capitalize
-
onConfirm
private void onConfirm()Submits the selected totem index to the controller when the confirm button is clicked.
-