mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 20:29:44 +01:00
lobby für feinschliff vorbereitet
This commit is contained in:
parent
65a7958b66
commit
f33c673a05
@ -1,6 +1,7 @@
|
||||
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;
|
||||
@ -8,9 +9,14 @@ import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.Axis;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Insets3f;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.Selector;
|
||||
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.monopoly.client.MonopolyApp;
|
||||
|
||||
public class LobbyMenu {
|
||||
@ -28,19 +34,63 @@ public class LobbyMenu {
|
||||
// Hintergrundbild laden und hinzufügen
|
||||
addBackgroundImage();
|
||||
|
||||
// Hauptcontainer für das Menü
|
||||
menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X));
|
||||
menuContainer.setPreferredSize(new Vector3f(600, 400, 0)); // Feste Größe des Containers
|
||||
QuadBackgroundComponent translucentWhiteBackground =
|
||||
new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f));
|
||||
|
||||
// Titel
|
||||
Label title = menuContainer.addChild(new Label("Lobby"));
|
||||
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, 50, 0)); // Adjust container size
|
||||
horizontalContainer.setBackground(null);
|
||||
|
||||
Label title = horizontalContainer.addChild(new Label("Startkapital:",new ElementId("label-Bold")));
|
||||
title.setFontSize(48);
|
||||
|
||||
// Add a spacer between the title and the input field
|
||||
Label spacerBeforeInput = horizontalContainer.addChild(new Label("")); // Invisible spacer
|
||||
spacerBeforeInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer
|
||||
|
||||
// Add an input field (TextField)
|
||||
TextField startingCapital = horizontalContainer.addChild(new TextField(""));
|
||||
startingCapital.setPreferredWidth(100); // Set the width of the input field
|
||||
startingCapital.setPreferredSize(new Vector3f(150, 50, 0));
|
||||
startingCapital.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding around the text inside the field
|
||||
|
||||
// Add a spacer after the input field
|
||||
Label spacerAfterInput = horizontalContainer.addChild(new Label("")); // Invisible spacer
|
||||
spacerAfterInput.setPreferredSize(new Vector3f(20, 1, 0)); // Width of the spacer
|
||||
|
||||
menuContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - menuContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + menuContainer.getPreferredSize().y) / 2,
|
||||
1
|
||||
);
|
||||
app.getGuiNode().attachChild(menuContainer);
|
||||
|
||||
// Spielerstatus anzeigen
|
||||
Container playerListContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
|
||||
playerListContainer.addChild(new Label("Spieler in der Lobby:"));
|
||||
playerListContainer.setBackground(null);
|
||||
Label playersLabel = playerListContainer.addChild(new Label("Noch keine Spieler verbunden.")); // Beispieltext
|
||||
|
||||
// Dropdown menu for game options
|
||||
Selector<String> dropdown = new Selector<>();
|
||||
for (int i = 1; i <= 10; i++) { // Generate 10 options
|
||||
dropdown.getModel().add("Option " + i);
|
||||
}
|
||||
|
||||
menuContainer.addChild(new Label("Game Options:")); // Add a label for clarity
|
||||
menuContainer.addChild(dropdown);
|
||||
|
||||
// Adjust the dropdown's popup container size if necessary
|
||||
Vector3f dimens = menuContainer.getPreferredSize();
|
||||
Vector3f dimens2 = dropdown.getPopupContainer().getPreferredSize();
|
||||
dimens2.setX(dimens.getX());
|
||||
dropdown.getPopupContainer().setPreferredSize(dimens2);
|
||||
|
||||
// Buttons
|
||||
Container buttonContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
|
||||
buttonContainer.setPreferredSize(new Vector3f(400, 50, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user