This commit is contained in:
Johannes Schmelz
2024-12-08 20:59:12 +01:00
3 changed files with 35 additions and 8 deletions

View File

@@ -114,8 +114,8 @@ public class Toolbar extends Dialog implements GameEventListener {
private void setupBorders(Container container) {
addBorder(0, 205, app.getCamera().getWidth(), 5, ColorRGBA.DarkGray); // Top
addBorder(0, 5, app.getCamera().getWidth(), 10, ColorRGBA.DarkGray); // Bottom
addBorder(0, 200, 5, 210, ColorRGBA.DarkGray); // Left
addBorder(app.getCamera().getWidth() - 5, 200, 5, 210, ColorRGBA.DarkGray); // Right
addBorder(0, 200, 8, 210, ColorRGBA.DarkGray); // Left
addBorder(app.getCamera().getWidth() - 5, 200, 8, 210, ColorRGBA.DarkGray); // Right
}
/**
@@ -455,11 +455,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();
@@ -508,6 +518,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) {
System.out.println("Button status event received: " + event.buttonsEnabled()+ "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG");
@@ -518,17 +534,26 @@ public class Toolbar extends Dialog implements GameEventListener {
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();

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB