From c2c22f9ae5d305f59ddbedc3b637b2e2f2bb0657 Mon Sep 17 00:00:00 2001 From: Simon Wilkening Date: Fri, 6 Dec 2024 11:57:20 +0100 Subject: [PATCH] NoMoneywarning and TimeOut use Dialogmanager now --- .../pp/monopoly/client/gui/popups/NoMoneyWarning.java | 8 ++++++-- .../java/pp/monopoly/client/gui/popups/ReceivedRent.java | 1 - .../main/java/pp/monopoly/client/gui/popups/TimeOut.java | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/NoMoneyWarning.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/NoMoneyWarning.java index 1bbff5a..eb28a0d 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/NoMoneyWarning.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/NoMoneyWarning.java @@ -13,6 +13,7 @@ import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.style.ElementId; import pp.dialog.Dialog; import pp.monopoly.client.MonopolyApp; +import pp.monopoly.notification.Sound; /** * NoMoneyWarning is a warning popup that appears when a player tries to perform @@ -77,10 +78,13 @@ public class NoMoneyWarning extends Dialog { // Passt den textContainer an die Größe des bankruptContainers an textContainer.setPreferredSize(noMoneyWarningContainer.getPreferredSize().addLocal(-250,-200,0)); - // Beenden-Button + // Bestätigen-Button Button quitButton = noMoneyWarningContainer.addChild(new Button("Bestätigen", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(source -> close()); + quitButton.addClickCommands(source -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); // Zentriere das Popup diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java index 178e104..35b2e7e 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java @@ -118,7 +118,6 @@ public class ReceivedRent extends Dialog { payButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - })); return container; diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java index c181ca5..3047f96 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java @@ -78,7 +78,10 @@ public class TimeOut extends Dialog { // Beenden-Button Button quitButton = timeOutContainer.addChild(new Button("Bestätigen", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(source -> close()); + quitButton.addClickCommands(source -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); // Zentriere das Popup