From 962ecd08fa4997b2d01879a3fb002fe33c96cb92 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Tue, 19 Nov 2024 19:54:22 +0100 Subject: [PATCH] SettingsMenu hat neues design --- .../pp/monopoly/client/gui/SettingsMenu.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SettingsMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SettingsMenu.java index 58221d6..13cc224 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SettingsMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SettingsMenu.java @@ -23,6 +23,7 @@ public class SettingsMenu extends Dialog { private final MonopolyApp app; private final Geometry overlayBackground; private final Container settingsContainer; + private final Container backgroundContainer; public SettingsMenu(MonopolyApp app) { super(app.getDialogManager()); @@ -32,6 +33,11 @@ public class SettingsMenu extends Dialog { overlayBackground = createOverlayBackground(); app.getGuiNode().attachChild(overlayBackground); + // Create the background container + backgroundContainer = new Container(); + backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background + app.getGuiNode().attachChild(backgroundContainer); + // Hauptcontainer für das Menü settingsContainer = new Container(); settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f))); @@ -47,24 +53,34 @@ public class SettingsMenu extends Dialog { effectSoundContainer.addChild(new Label("Effekt Sound", new ElementId("label"))); effectSoundContainer.addChild(new Slider()); effectSoundContainer.addChild(new Checkbox("Soundeffekte an")).setChecked(true); - + effectSoundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); // Hintergrundmusik: Slider und Checkbox Container backgroundMusicContainer = settingsContainer.addChild(new Container()); backgroundMusicContainer.addChild(new Label("Hintergrund Musik", new ElementId("label"))); backgroundMusicContainer.addChild(new Slider()); backgroundMusicContainer.addChild(new Checkbox("Musik an")).setChecked(true); + backgroundMusicContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); // Beenden-Button Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("menu-button"))); quitButton.setFontSize(32); quitButton.addClickCommands(source -> app.stop()); - + + float padding = 10; // Padding around the settingsContainer for the background + backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0)); + // Zentriere das Menü settingsContainer.setLocalTranslation( (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2, - 3 + 4 + ); + + backgroundContainer.setLocalTranslation( + (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2, + (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2, + 3 ); app.getGuiNode().attachChild(settingsContainer); @@ -93,6 +109,7 @@ public class SettingsMenu extends Dialog { public void close() { System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü + app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay app.setSettingsMenuOpen(false); // Menü als geschlossen markieren app.unblockInputs(); // Eingaben wieder aktivieren