From ed105f1b706f7411d3442ed8de775037413bd683 Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 25 Nov 2024 02:43:58 +0100 Subject: [PATCH] cleanup --- .../monopoly/client/gui/CreateGameMenu.java | 24 ++++++------------- .../pp/monopoly/client/gui/LobbyMenu.java | 6 ++--- .../pp/monopoly/client/gui/SoundSlider.java | 1 - .../pp/monopoly/client/gui/StartMenu.java | 2 -- .../monopoly/client/gui/popups/BuyCard.java | 5 ++-- .../client/gui/popups/FoodFieldCard.java | 1 - 6 files changed, 13 insertions(+), 26 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java index ce0c4db..af36c2c 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java @@ -27,7 +27,6 @@ import static pp.monopoly.Resources.lookup; import pp.monopoly.client.MonopolyApp; import pp.monopoly.client.NetworkSupport; -import pp.monopoly.notification.Sound; import pp.monopoly.server.MonopolyServer; import pp.dialog.Dialog; import pp.dialog.DialogBuilder; @@ -65,7 +64,7 @@ public class CreateGameMenu extends Dialog { final MonopolyApp app = network.getApp(); - int screenWidth = app.getContext().getSettings().getWidth(); + int screenWidth = app.getContext().getSettings().getWidth(); int screenHeight = app.getContext().getSettings().getHeight(); // Set up the background image @@ -78,7 +77,6 @@ public class CreateGameMenu extends Dialog { background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements app.getGuiNode().attachChild(background); - final Container input = new Container(new SpringGridLayout()); input.addChild(new Label(lookup("host.name") + ": ")); input.addChild(host, 1); @@ -88,27 +86,20 @@ public class CreateGameMenu extends Dialog { addChild(input); // "Abbrechen"-Button cancelButton.setPreferredSize(new Vector3f(120, 40, 0)); - cancelButton.addClickCommands(source -> close()); - addChild(cancelButton); cancelButton.addClickCommands(s -> ifTopDialog(() -> { this.close(); - new StartMenu(app); - app.getGameLogic().playSound(Sound.BUTTON); + new StartMenu(network.getApp()).open(); })); + addChild(cancelButton); // "Selber hosten"-Button - addChild(serverButton).addClickCommands(s -> ifTopDialog(() -> { - startServerInThread(); - app.getGameLogic().playSound(Sound.BUTTON); - })); + serverButton.addClickCommands(s -> ifTopDialog(this::startServerInThread)); + addChild(serverButton); // "Beitreten"-Button joinButton.setPreferredSize(new Vector3f(120, 40, 0)); + joinButton.addClickCommands(s -> ifTopDialog(this::connect)); addChild(joinButton); - joinButton.addClickCommands(s -> ifTopDialog(() -> { - connect(); - app.getGameLogic().playSound(Sound.BUTTON); - })); } /** @@ -155,7 +146,7 @@ public class CreateGameMenu extends Dialog { @Override public void escape() { - close(); + new SettingsMenu(network.getApp()).open(); } /** @@ -218,7 +209,6 @@ public class CreateGameMenu extends Dialog { try { Thread.sleep(2000); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } connect(); diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java index 022ad05..9e60d9f 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java @@ -131,11 +131,11 @@ public class LobbyMenu extends Dialog { buttonContainer.setBackground(null); // Lower-left container for "Abbrechen" button lowerLeftMenu = new Container(); - Button cancelButton = new Button("Abbrechen"); + Button cancelButton = new Button("Beenden"); cancelButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image cancelButton.setFontSize(18); // Adjust font size cancelButton.addClickCommands(s -> ifTopDialog(() -> { - this.close(); + app.closeApp(); app.getGameLogic().playSound(Sound.BUTTON); })); lowerLeftMenu.addChild(cancelButton); @@ -217,7 +217,7 @@ public class LobbyMenu extends Dialog { @Override public void escape() { - super.close(); + new SettingsMenu(app).open(); } /** diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SoundSlider.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SoundSlider.java index 143f40b..31c547e 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SoundSlider.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/SoundSlider.java @@ -1,7 +1,6 @@ package pp.monopoly.client.gui; import com.simsilica.lemur.Slider; -import pp.monopoly.client.GameMusic; import pp.monopoly.client.GameSound; public class SoundSlider extends Slider { diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/StartMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/StartMenu.java index 3db87e4..8a9c532 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/StartMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/StartMenu.java @@ -22,8 +22,6 @@ import pp.monopoly.client.gui.GameMenu; */ public class StartMenu extends Dialog { private final MonopolyApp app; - private Container logoContainer; - private Container unibwLogoContainer; /** * Constructs the Startup Menu dialog for the Monopoly application. diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java index ebeb0ee..54c4619 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java @@ -3,10 +3,11 @@ package pp.monopoly.client.gui.popups; import com.jme3.material.Material; import com.jme3.material.RenderState.BlendMode; import com.jme3.math.ColorRGBA; -import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Quad; -import com.simsilica.lemur.*; +import com.simsilica.lemur.Button; +import com.simsilica.lemur.Container; +import com.simsilica.lemur.Label; import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.style.ElementId; import pp.dialog.Dialog; diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java index c6224cb..723e220 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java @@ -5,7 +5,6 @@ import com.jme3.material.RenderState.BlendMode; import com.jme3.math.ColorRGBA; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Quad; -import com.simsilica.lemur.Button; import com.simsilica.lemur.Container; import com.simsilica.lemur.Label; import com.simsilica.lemur.component.QuadBackgroundComponent;