added outline for ChoosePartner Menu

This commit is contained in:
Yvonne Schmidt 2024-11-25 05:40:49 +01:00
parent dfdbcdc9f3
commit 093723a9d0
2 changed files with 70 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -179,12 +179,15 @@ public class Toolbar extends Dialog {
private void addTradeMenuButton() { private void addTradeMenuButton() {
Button diceButton = new Button("Handeln"); Button diceButton = new Button("Handeln");
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
diceButton.addClickCommands(s -> ifTopDialog(() -> { diceButton.addClickCommands(s -> {
rollDice(); rollDice();
app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().playSound(Sound.BUTTON);
})); this.close();
System.out.println("test");
new ChoosePartner(app).open();
});
toolbarContainer.addChild(diceButton); toolbarContainer.addChild(diceButton);
} }// TODO Funktion der Buttons Überarbeiten und prüfen
private void addEndTurnButton() { private void addEndTurnButton() {
Button diceButton = new Button("Grundstücke"); Button diceButton = new Button("Grundstücke");