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 Container lowerRightMenu;
private ColorRGBA playerColor= ColorRGBA.Gray; private ColorRGBA playerColor= ColorRGBA.Gray;
private PlayerHandler playerHandler; // Reference to PlayerHandler private PlayerHandler playerHandler;
private TextField startingCapital; // Reference to the starting capital input field private TextField startingCapital;
private TextField playerInputField; // Reference to the player name input field private TextField playerInputField;
private Selector<String> figureDropdown; // Reference to the figure dropdown private Selector<String> figureDropdown;
public LobbyMenu(MonopolyApp app) { public LobbyMenu(MonopolyApp app) {
this.app = app; this.app = app;
this.playerHandler = ClientGameLogic.getPlayerHandler(); // Initialize PlayerHandler this.playerHandler = ClientGameLogic.getPlayerHandler(); // Initialize PlayerHandler
int playerID = app.getNetworkSupport().getId(); // Retrieve the player ID dynamically int playerID = app.getNetworkSupport().getId(); // Retrieve the player ID
assignPlayerColor(playerID); assignPlayerColor(playerID); //set the Players Color
// Entfernt das CreateGameMenu (inklusive Hintergrund)
app.getGuiNode().detachAllChildren();
// Hintergrundbild laden und hinzufügen app.getGuiNode().detachAllChildren(); // Entfernt das CreateGameMenu (inklusive Hintergrund)
addBackgroundImage();
addBackgroundImage();// Hintergrundbild laden und hinzufügen
QuadBackgroundComponent translucentWhiteBackground = QuadBackgroundComponent translucentWhiteBackground =
new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f)); new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f));
menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X)); 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); menuContainer.setBackground(translucentWhiteBackground);
// Create a smaller horizontal container for the label, input field, and spacers // Create a smaller horizontal container for the label, input field, and spacers
Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); 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); horizontalContainer.setBackground(null);
Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold"))); Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold")));
@ -109,12 +108,12 @@ public class LobbyMenu {
TextField playerInputField = new TextField("Spieler 1"); TextField playerInputField = new TextField("Spieler 1");
playerInputField.setPreferredSize(new Vector3f(100, 20, 0)); 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)); playerInputField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
playerInputContainer.addChild(playerInputField); playerInputContainer.addChild(playerInputField);
// Spacer (Center Circle Area) // Spacer (Center Circle Area)
Label spacer = dropdownContainer.addChild(new Label("")); 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 // Figur Dropdown
Container figureDropdownContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X))); Container figureDropdownContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));