fixed startmenu

This commit is contained in:
Johannes Schmelz 2024-11-25 00:33:05 +01:00
parent a344145732
commit 21914a1294

View File

@ -14,6 +14,7 @@ import com.simsilica.lemur.component.SpringGridLayout;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.notification.Sound;
/**
* Constructs the startup menu dialog for the Monopoly application.
@ -54,7 +55,11 @@ public class StartMenu extends Dialog {
startButton.setFontSize(40); // Set the font size for the button text
startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally
startButton.addClickCommands(s -> app.connect());
startButton.addClickCommands(s -> ifTopDialog(() -> {
this.close(); // Close the StartMenu dialog
app.connect(); // Perform the connection logic
app.getGameLogic().playSound(Sound.BUTTON);
}));
centerMenu.addChild(startButton);
// Position the center container in the middle of the screen
@ -114,4 +119,10 @@ public class StartMenu extends Dialog {
public void escape() {
close();
}
@Override
public void close() {
app.getGuiNode().detachAllChildren();
super.close();
}
}