diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/ChoosePartner.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/ChoosePartner.java new file mode 100644 index 0000000..709bb32 --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/ChoosePartner.java @@ -0,0 +1,64 @@ +package pp.monopoly.client.gui; + +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; +import com.jme3.math.Vector3f; +import com.jme3.scene.Geometry; +import com.jme3.scene.shape.Quad; +import com.jme3.texture.Texture; +import com.simsilica.lemur.Axis; +import com.simsilica.lemur.Container; +import com.simsilica.lemur.Label; +import com.simsilica.lemur.TextField; +import com.simsilica.lemur.component.QuadBackgroundComponent; +import com.simsilica.lemur.component.SpringGridLayout; +import com.simsilica.lemur.style.ElementId; +import pp.dialog.Dialog; +import pp.monopoly.client.MonopolyApp; + +public class ChoosePartner extends Dialog { + + private final MonopolyApp app; + private final Container menuContainer; + private Geometry background; + + + public ChoosePartner(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + + // Hintergrundbild laden und hinzufügen + addBackgroundImage(); + + QuadBackgroundComponent translucentWhiteBackground = + new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f)); + + menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X)); + menuContainer.setPreferredSize(new Vector3f(1000, 600, 0)); // Fixed size of the container + menuContainer.setBackground(translucentWhiteBackground); + + // Create a smaller horizontal container for the label, input field, and spacers + Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); + horizontalContainer.setPreferredSize(new Vector3f(600, 40, 0)); // Adjust container size + horizontalContainer.setBackground(null); + + Label title = horizontalContainer.addChild(new Label("Wähle deinen Handelspartner:", new ElementId("label-Bold"))); + title.setFontSize(40); + + } + + /** + * Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu. + */ + private void addBackgroundImage() { + Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png"); + Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight()); + background = new Geometry("Background", quad); + Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); + backgroundMaterial.setTexture("ColorMap", backgroundImage); + background.setMaterial(backgroundMaterial); + background.setLocalTranslation(0, 0, -1); // Hintergrundebene + + app.getGuiNode().attachChild(background); + } +} diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java index 8ebe710..817830c 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java @@ -179,12 +179,15 @@ public class Toolbar extends Dialog { private void addTradeMenuButton() { Button diceButton = new Button("Handeln"); diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons - diceButton.addClickCommands(s -> ifTopDialog(() -> { + diceButton.addClickCommands(s -> { rollDice(); app.getGameLogic().playSound(Sound.BUTTON); - })); + this.close(); + System.out.println("test"); + new ChoosePartner(app).open(); + }); toolbarContainer.addChild(diceButton); - } + }// TODO Funktion der Buttons Überarbeiten und prüfen private void addEndTurnButton() { Button diceButton = new Button("Grundstücke");