Winner and Looser Popup close the game again

This commit is contained in:
Simon Wilkening 2024-11-30 20:33:08 +01:00
parent 5d6440bd50
commit d37017bfa0
2 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -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(