From d37017bfa0f7d08db468850f3f0603e89faff94a Mon Sep 17 00:00:00 2001 From: Simon Wilkening Date: Sat, 30 Nov 2024 20:33:08 +0100 Subject: [PATCH] Winner and Looser Popup close the game again --- .../pp/monopoly/client/gui/popups/LooserPopUp.java | 10 +++++++--- .../pp/monopoly/client/gui/popups/WinnerPopUp.java | 11 +++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java index 075b4a4..f29fc84 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java @@ -14,6 +14,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; public class LooserPopUp extends Dialog { private final MonopolyApp app; @@ -67,10 +68,13 @@ public class LooserPopUp extends Dialog { imageLabel.setIcon(icon); imageContainer.addChild(imageLabel); // Add the image label to the container - // Beenden-Button - Button quitButton = LooserContainer.addChild(new Button("Spiel beenden", new ElementId("button"))); + //Beenden Button + Button quitButton = LooserContainer.addChild(new Button("Spiel Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(source -> close()); + quitButton.addClickCommands(s -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + app.closeApp(); + })); // Zentriere das Popup diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java index 4a08de9..95d31c2 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java @@ -14,6 +14,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; public class WinnerPopUp extends Dialog { private final MonopolyApp app; @@ -67,11 +68,13 @@ public class WinnerPopUp extends Dialog { imageLabel.setIcon(icon); imageContainer.addChild(imageLabel); // Add the image label to the container - // Beenden-Button - Button quitButton = WinnerContainer.addChild(new Button("Spiel beenden", new ElementId("button"))); - quitButton.setFontSize(32); - quitButton.addClickCommands(source -> close()); + Button quitButton = WinnerContainer.addChild(new Button("Spiel Beenden", new ElementId("button"))); + quitButton.setFontSize(32); + quitButton.addClickCommands(s -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + app.closeApp(); + })); // Zentriere das Popup WinnerContainer.setLocalTranslation(