Class CharacterCardsController
java.lang.Object
it.polimi.ingsw.eriantys.client.gui.controllers.Controller
it.polimi.ingsw.eriantys.client.gui.controllers.CharacterCardsController
- All Implemented Interfaces:
javafx.fxml.Initializable
A class representing the controller for the
CHARACTER_CARDS
scene.- See Also:
-
Field Summary
Fields inherited from class it.polimi.ingsw.eriantys.client.gui.controllers.Controller
app, client, showError, showInfo
-
Constructor Summary
ConstructorDescriptionConstructs theCharacterCardsController
getting the character card information from the JSON file. -
Method Summary
Modifier and TypeMethodDescriptionjavafx.scene.layout.Pane
A getter for thePane
object associated with the FXML tag of highest level in the*.fxml
file associated withthis
.void
initialize
(URL url, ResourceBundle resourceBundle) Gets all the child nodes representing the elements of the scene from the FXML.void
load()
Loads the board status and callspopulate(BoardStatus)
.void
Encloses the workflow ofthis
on a scene change event.void
populate
(BoardStatus status) Gets the information about character cards from the board status and draws all the elements in the scene.void
selectColor
(String color) Adds the selected color to the arguments of the effect of the selected character card.void
selectIsland
(String island) Sets thetargetIsland
argument of the effect of the selected character card.Methods inherited from class it.polimi.ingsw.eriantys.client.gui.controllers.Controller
applyGrayscale, applyGreenShade, roundBorders, setApp, setClient, setShowError, setShowInfo
-
Constructor Details
-
CharacterCardsController
Constructs theCharacterCardsController
getting the character card information from the JSON file.- Throws:
IOException
- if the file cannot be opened or read
-
-
Method Details
-
initialize
Gets all the child nodes representing the elements of the scene from the FXML. Associates the event handlers with the buttons on the scene. -
onChangeScene
public void onChangeScene()Encloses the workflow ofthis
on a scene change event. The method is called before the implementation of the controller itself to pre-process eventual data. The default behaviour of the method returns immediately. Any controller should override the method if necessary. Draws the images of the character cards and the elements placed on them (if present).- Overrides:
onChangeScene
in classController
-
getTopLevelPane
public javafx.scene.layout.Pane getTopLevelPane()Description copied from class:Controller
A getter for thePane
object associated with the FXML tag of highest level in the*.fxml
file associated withthis
. The method is called in order to process a popup. Any controller should override the method if necessary.- Specified by:
getTopLevelPane
in classController
- Returns:
- the highest level
Pane
-
load
public void load()Loads the board status and callspopulate(BoardStatus)
. -
populate
Gets the information about character cards from the board status and draws all the elements in the scene.- Parameters:
status
- the updated board status
-
selectColor
Adds the selected color to the arguments of the effect of the selected character card. If only one color is selected, it is considered as thetargetColor
. If more colors are selected they are interpreted in alternating order assourceColors
anddestinationColors
.- Parameters:
color
- the name of the selectedColor
-
selectIsland
Sets thetargetIsland
argument of the effect of the selected character card.- Parameters:
island
- the identifier of the selected island
-