mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-10-31 04:01:50 +01:00 
			
		
		
		
	fixed startmenu
This commit is contained in:
		| @@ -14,6 +14,7 @@ import com.simsilica.lemur.component.SpringGridLayout; | |||||||
|  |  | ||||||
| import pp.dialog.Dialog; | import pp.dialog.Dialog; | ||||||
| import pp.monopoly.client.MonopolyApp; | import pp.monopoly.client.MonopolyApp; | ||||||
|  | import pp.monopoly.notification.Sound; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Constructs the startup menu dialog for the Monopoly application. |  * 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.setFontSize(40); // Set the font size for the button text | ||||||
|         startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally |         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); |         centerMenu.addChild(startButton); | ||||||
|  |  | ||||||
|         // Position the center container in the middle of the screen |         // Position the center container in the middle of the screen | ||||||
| @@ -114,4 +119,10 @@ public class StartMenu extends Dialog { | |||||||
|     public void escape() { |     public void escape() { | ||||||
|         close(); |         close(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void close() { | ||||||
|  |         app.getGuiNode().detachAllChildren(); | ||||||
|  |         super.close(); | ||||||
|  |     } | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user