This commit is contained in:
Luca Puderbach 2024-12-08 19:23:15 +01:00
commit 42fefb2899

View File

@ -446,11 +446,21 @@ public class Toolbar extends Dialog implements GameEventListener {
} + ".png";
}
/**
* Handles dice roll events and updates the dice display.
*
* @param event the dice roll event containing dice values
*/
@Override
public void receivedEvent(DiceRollEvent event) {
latestDiceRollEvent = event;
}
/**
* Updates the player view by refreshing the player information displayed on the toolbar.
*
* @param event the update player view event
*/
@Override
public void receivedEvent(UpdatePlayerView event) {
playerHandler = app.getGameLogic().getPlayerHandler();
@ -499,6 +509,12 @@ public class Toolbar extends Dialog implements GameEventListener {
}
}
/**
* Updates the status of toolbar buttons based on the provided button status event.
* Disables or enables buttons such as trade, property menu, and end turn based on the player's turn status.
*
* @param event the button status event indicating whether the buttons should be enabled
*/
@Override
public void receivedEvent(ButtonStatusEvent event) {
boolean enabled = event.buttonsEnabled();
@ -508,17 +524,26 @@ public class Toolbar extends Dialog implements GameEventListener {
if (endTurnButton != null) endTurnButton.setEnabled(false);
}
/**
* Closes the toolbar, detaching it from the GUI.
*/
@Override
public void close() {
app.getGuiNode().detachChild(toolbarContainer);
super.close();
}
/**
* Opens the settings menu when the escape key is pressed.
*/
@Override
public void escape() {
new SettingsMenu(app).open();
}
/**
* Updates the toolbar by refreshing player information.
*/
@Override
public void update() {
refreshPlayerView();