code cleanup in der lobby

This commit is contained in:
Yvonne Schmidt 2024-11-24 19:24:51 +01:00
parent a6e6b5e158
commit 03571fcf74

View File

@ -42,34 +42,33 @@ public class LobbyMenu {
private Container lowerRightMenu;
private ColorRGBA playerColor= ColorRGBA.Gray;
private PlayerHandler playerHandler; // Reference to PlayerHandler
private TextField startingCapital; // Reference to the starting capital input field
private TextField playerInputField; // Reference to the player name input field
private Selector<String> figureDropdown; // Reference to the figure dropdown
private PlayerHandler playerHandler;
private TextField startingCapital;
private TextField playerInputField;
private Selector<String> figureDropdown;
public LobbyMenu(MonopolyApp app) {
this.app = app;
this.playerHandler = ClientGameLogic.getPlayerHandler(); // Initialize PlayerHandler
int playerID = app.getNetworkSupport().getId(); // Retrieve the player ID dynamically
assignPlayerColor(playerID);
// Entfernt das CreateGameMenu (inklusive Hintergrund)
app.getGuiNode().detachAllChildren();
int playerID = app.getNetworkSupport().getId(); // Retrieve the player ID
assignPlayerColor(playerID); //set the Players Color
// Hintergrundbild laden und hinzufügen
addBackgroundImage();
app.getGuiNode().detachAllChildren(); // Entfernt das CreateGameMenu (inklusive Hintergrund)
addBackgroundImage();// Hintergrundbild laden und hinzufügen
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.setPreferredSize(new Vector3f(1000, 600, 0));
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.setPreferredSize(new Vector3f(600, 40, 0));
horizontalContainer.setBackground(null);
Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold")));
@ -109,12 +108,12 @@ public class LobbyMenu {
TextField playerInputField = new TextField("Spieler 1");
playerInputField.setPreferredSize(new Vector3f(100, 20, 0));
playerInputField.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding for the text inside the field
playerInputField.setInsets(new Insets3f(5, 10, 5, 10));
playerInputField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
playerInputContainer.addChild(playerInputField);
// Spacer (Center Circle Area)
Label spacer = dropdownContainer.addChild(new Label(""));
spacer.setPreferredSize(new Vector3f(200, 200, 0)); // Adjust this to fit the center graphic
spacer.setPreferredSize(new Vector3f(200, 200, 0));
// Figur Dropdown
Container figureDropdownContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));