mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-29 05:29:44 +01:00
fixed startmenu
This commit is contained in:
parent
a344145732
commit
21914a1294
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user