diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/StartMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/StartMenu.java index 7b7de86..abd3799 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/StartMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/StartMenu.java @@ -8,7 +8,6 @@ import com.jme3.texture.Texture; import com.simsilica.lemur.Axis; import com.simsilica.lemur.Button; import com.simsilica.lemur.Container; -import com.simsilica.lemur.Label; import com.simsilica.lemur.component.SpringGridLayout; import pp.dialog.Dialog; @@ -51,9 +50,9 @@ public class StartMenu extends Dialog { // Center container for title and play button Container centerMenu = new Container(new SpringGridLayout(Axis.Y, Axis.X)); - Label titleLabel = new Label("Hauptmenü"); - titleLabel.setFontSize(48); - centerMenu.addChild(titleLabel); + // Label titleLabel = new Label("Hauptmenü"); + //titleLabel.setFontSize(48); + //centerMenu.addChild(titleLabel); Button startButton = new Button("Spielen"); startButton.addClickCommands(source -> startGame(app)); diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java index 8e13fb5..96bd73a 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java @@ -27,8 +27,8 @@ public class CreateGameMenu { Label title = createGameContainer.addChild(new Label("Neues Spiel", new ElementId("title"))); // Fügt zwei Eingabefelder unter dem Titel hinzu - TextField inputField1 = createGameContainer.addChild(new TextField("Eingabefeld 1")); - TextField inputField2 = createGameContainer.addChild(new TextField("Eingabefeld 2")); + TextField inputField1 = createGameContainer.addChild(new TextField("Host")); + TextField inputField2 = createGameContainer.addChild(new TextField("Port")); // Erstellt einen Container mit einem Rasterlayout, um die Buttons nebeneinander anzuordnen Container buttonContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y)); 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 c5b2d19..eb882da 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 @@ -1,6 +1,10 @@ package pp.monopoly.client.gui; import com.jme3.math.ColorRGBA; +import com.jme3.scene.Geometry; +import com.jme3.scene.Node; +import com.jme3.scene.shape.Quad; +import com.jme3.texture.Texture; import com.simsilica.lemur.Button; import com.simsilica.lemur.Checkbox; import com.simsilica.lemur.Container; @@ -15,15 +19,23 @@ import pp.monopoly.client.MonopolyApp; public class SettingsMenu extends Dialog { private final MonopolyApp app; private final Container settingsContainer; + private Geometry blockLayer; + private final Node savedGuiNodeContent = new Node("SavedGuiNodeContent"); public SettingsMenu(MonopolyApp app) { super(app.getDialogManager()); this.app = app; + // Blockierungsebene hinzufügen + addBlockLayer(); + + // Hintergrundbild + addBackgroundImage(); + settingsContainer = new Container(); - + // Hintergrundfarbe für das Container-Element setzen, um es undurchsichtig zu machen - settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 1f))); // Dunkelgrauer, undurchsichtiger Hintergrund + settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.8f))); // Teiltransparent, falls gewünscht // Titel "Einstellungen" Label settingsTitle = settingsContainer.addChild(new Label("Einstellungen", new ElementId("settings-title"))); @@ -64,15 +76,62 @@ public class SettingsMenu extends Dialog { settingsContainer.setLocalTranslation( (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2, - 0 + 1 // Höhere Z-Ebene für den Vordergrund ); app.getGuiNode().attachChild(settingsContainer); } + private void addBlockLayer() { + // Sichern des aktuellen GUI-Inhalts + for (var child : app.getGuiNode().getChildren()) { + savedGuiNodeContent.attachChild(child); + } + app.getGuiNode().detachAllChildren(); + + // Blockierungsebene erstellen und hinzufügen + blockLayer = new Geometry("BlockLayer", new Quad(app.getCamera().getWidth(), app.getCamera().getHeight())); + blockLayer.setMaterial(createTransparentMaterial()); + blockLayer.setLocalTranslation(0, 0, 0); // Platzierung unterhalb des SettingsMenu + app.getGuiNode().attachChild(blockLayer); + } + + private com.jme3.material.Material createTransparentMaterial() { + com.jme3.material.Material material = new com.jme3.material.Material( + app.getAssetManager(), + "Common/MatDefs/Misc/Unshaded.j3md" + ); + material.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f)); // Halbtransparent + material.getAdditionalRenderState().setBlendMode(com.jme3.material.RenderState.BlendMode.Alpha); + return material; + } + + private void addBackgroundImage() { + Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png"); + Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight()); + Geometry background = new Geometry("Background", quad); + com.jme3.material.Material backgroundMaterial = new com.jme3.material.Material( + app.getAssetManager(), + "Common/MatDefs/Misc/Unshaded.j3md" + ); + backgroundMaterial.setTexture("ColorMap", backgroundImage); + background.setMaterial(backgroundMaterial); + background.setLocalTranslation(0, 0, -1); // Platzierung hinter dem SettingsMenu + app.getGuiNode().attachChild(background); + } + @Override public void close() { + // Entfernt das SettingsMenu und die Blockierungsebene app.getGuiNode().detachChild(settingsContainer); + app.getGuiNode().detachChild(blockLayer); + + // Stellt die ursprüngliche GUI wieder her + for (var child : savedGuiNodeContent.getChildren()) { + app.getGuiNode().attachChild(child); + } + savedGuiNodeContent.detachAllChildren(); + app.setSettingsMenuOpen(false); } }