trigger Bankrupt PopUp

This commit is contained in:
Johannes Schmelz 2024-12-01 21:30:55 +01:00
parent 29e9b54cc4
commit cfcc232432
2 changed files with 8 additions and 3 deletions

View File

@ -14,6 +14,7 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog; import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp; import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.popups.Bankrupt;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
import pp.monopoly.game.server.PlayerHandler; import pp.monopoly.game.server.PlayerHandler;
import pp.monopoly.message.client.EndTurn; import pp.monopoly.message.client.EndTurn;
@ -185,8 +186,12 @@ public class Toolbar extends Dialog implements GameEventListener {
endTurnButton.setPreferredSize(new Vector3f(150, 50, 0)); endTurnButton.setPreferredSize(new Vector3f(150, 50, 0));
endTurnButton.addClickCommands(s -> ifTopDialog(() -> { endTurnButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().playSound(Sound.BUTTON);
if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0) {
new Bankrupt(app).open();
} else {
app.getGameLogic().send(new EndTurn()); app.getGameLogic().send(new EndTurn());
receivedEvent(new ButtonStatusEvent(false)); receivedEvent(new ButtonStatusEvent(false));
}
})); }));
return endTurnButton; return endTurnButton;
} }

View File

@ -64,7 +64,7 @@ public class Bankrupt extends Dialog {
// Beenden-Button // Beenden-Button
Button quitButton = bankruptContainer.addChild(new Button("Bestätigen", new ElementId("button"))); Button quitButton = bankruptContainer.addChild(new Button("Bestätigen", new ElementId("button")));
quitButton.setFontSize(32); quitButton.setFontSize(32);
quitButton.addClickCommands(source -> close()); quitButton.addClickCommands(source -> ifTopDialog(this::close));
// Zentriere das Popup // Zentriere das Popup