mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
show bankrupt popup once
This commit is contained in:
parent
6db96f0a1d
commit
9e88353bd5
@ -103,6 +103,8 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
*/
|
||||
private volatile DiceRollEvent latestDiceRollEvent = null;
|
||||
|
||||
private boolean bankruptPopUp = false;
|
||||
|
||||
/**
|
||||
* Constructs the toolbar for the Monopoly application.
|
||||
* <p>
|
||||
@ -256,9 +258,11 @@ public class Toolbar extends Dialog implements GameEventListener {
|
||||
endTurnButton.setPreferredSize(new Vector3f(150, 50, 0));
|
||||
endTurnButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0) {
|
||||
if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0 && !bankruptPopUp) {
|
||||
new Bankrupt(app).open();
|
||||
bankruptPopUp = true;
|
||||
} else {
|
||||
bankruptPopUp = false;
|
||||
app.getGameLogic().send(new EndTurn());
|
||||
receivedEvent(new ButtonStatusEvent(false));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user