From 227a7a027f3209e7a246ddd0a6360beb749ed563 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Wed, 27 Nov 2024 23:40:16 +0100 Subject: [PATCH 1/7] added comments --- .../main/java/pp/monopoly/client/gui/BuildingAdminMenu.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java index bec3e92..497e711 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java @@ -77,7 +77,7 @@ public class BuildingAdminMenu extends Dialog { Container overviewColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X)); overviewColumn.addChild(new Label("Übersicht:")).setFontSize(30); - + //Building Overview Button overviewButton.setPreferredSize(new Vector3f(200, 50, 0)); overviewButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); @@ -99,12 +99,14 @@ public class BuildingAdminMenu extends Dialog { Container buildColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X)); buildColumn.addChild(new Label("Bauen:")).setFontSize(30); + // Build Houses Button buildButton.setPreferredSize(new Vector3f(200, 50, 0)); buildButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); })); buildColumn.addChild(buildButton); + //Demolish Houses Button demolishButton.setPreferredSize(new Vector3f(200, 50, 0)); demolishButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); @@ -118,12 +120,14 @@ public class BuildingAdminMenu extends Dialog { Container mortgageColumn = new Container(new SpringGridLayout(Axis.Y, Axis.X)); mortgageColumn.addChild(new Label("Hypotheken:")).setFontSize(30); + // Lend Mortgage Button takeMortgageButton.setPreferredSize(new Vector3f(200, 50, 0)); takeMortgageButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); })); mortgageColumn.addChild(takeMortgageButton); + //Repay Mortgage Button payMortgageButton.setPreferredSize(new Vector3f(200, 50, 0)); payMortgageButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); From 075f98883adf4ff17115f4bb2724f6b781d1c3a2 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Thu, 28 Nov 2024 02:02:29 +0100 Subject: [PATCH 2/7] fixed toolbar fontsize --- .../client/src/main/java/pp/monopoly/client/gui/Toolbar.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java index 72e7a84..9b87a5b 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java @@ -115,6 +115,7 @@ public class Toolbar extends Dialog implements GameEventListener { private Button addPropertyMenuButton() { Button propertyMenuButton = new Button("Grundstücke"); propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0)); + propertyMenuButton.setFontSize(30); propertyMenuButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); new BuildingAdminMenu(app).open(); From bc6e7174ec270987f82c4c6222835f9bc52094ac Mon Sep 17 00:00:00 2001 From: Luca Puderbach Date: Thu, 28 Nov 2024 02:31:43 +0100 Subject: [PATCH 3/7] Test Modelle Umbenannt --- .../Models/{Würfel_gelb.j30 => Flugzeug.j30} | Bin .../Models/{Würfel_schwarz.j30 => Handyholster.j30} | Bin .../Models/{Würfel_rosa.j30 => Jägermeister.j30} | Bin .../resources/Models/{Würfel_blau.j30 => Katze.j30} | Bin .../Models/{Würfel_grün.j30 => Laptop.j30} | Bin .../resources/Models/{Würfel_rot.j30 => OOP.j30} | Bin 6 files changed, 0 insertions(+), 0 deletions(-) rename Projekte/monopoly/client/src/main/resources/Models/{Würfel_gelb.j30 => Flugzeug.j30} (100%) rename Projekte/monopoly/client/src/main/resources/Models/{Würfel_schwarz.j30 => Handyholster.j30} (100%) rename Projekte/monopoly/client/src/main/resources/Models/{Würfel_rosa.j30 => Jägermeister.j30} (100%) rename Projekte/monopoly/client/src/main/resources/Models/{Würfel_blau.j30 => Katze.j30} (100%) rename Projekte/monopoly/client/src/main/resources/Models/{Würfel_grün.j30 => Laptop.j30} (100%) rename Projekte/monopoly/client/src/main/resources/Models/{Würfel_rot.j30 => OOP.j30} (100%) diff --git a/Projekte/monopoly/client/src/main/resources/Models/Würfel_gelb.j30 b/Projekte/monopoly/client/src/main/resources/Models/Flugzeug.j30 similarity index 100% rename from Projekte/monopoly/client/src/main/resources/Models/Würfel_gelb.j30 rename to Projekte/monopoly/client/src/main/resources/Models/Flugzeug.j30 diff --git a/Projekte/monopoly/client/src/main/resources/Models/Würfel_schwarz.j30 b/Projekte/monopoly/client/src/main/resources/Models/Handyholster.j30 similarity index 100% rename from Projekte/monopoly/client/src/main/resources/Models/Würfel_schwarz.j30 rename to Projekte/monopoly/client/src/main/resources/Models/Handyholster.j30 diff --git a/Projekte/monopoly/client/src/main/resources/Models/Würfel_rosa.j30 b/Projekte/monopoly/client/src/main/resources/Models/Jägermeister.j30 similarity index 100% rename from Projekte/monopoly/client/src/main/resources/Models/Würfel_rosa.j30 rename to Projekte/monopoly/client/src/main/resources/Models/Jägermeister.j30 diff --git a/Projekte/monopoly/client/src/main/resources/Models/Würfel_blau.j30 b/Projekte/monopoly/client/src/main/resources/Models/Katze.j30 similarity index 100% rename from Projekte/monopoly/client/src/main/resources/Models/Würfel_blau.j30 rename to Projekte/monopoly/client/src/main/resources/Models/Katze.j30 diff --git a/Projekte/monopoly/client/src/main/resources/Models/Würfel_grün.j30 b/Projekte/monopoly/client/src/main/resources/Models/Laptop.j30 similarity index 100% rename from Projekte/monopoly/client/src/main/resources/Models/Würfel_grün.j30 rename to Projekte/monopoly/client/src/main/resources/Models/Laptop.j30 diff --git a/Projekte/monopoly/client/src/main/resources/Models/Würfel_rot.j30 b/Projekte/monopoly/client/src/main/resources/Models/OOP.j30 similarity index 100% rename from Projekte/monopoly/client/src/main/resources/Models/Würfel_rot.j30 rename to Projekte/monopoly/client/src/main/resources/Models/OOP.j30 From b4d7349583b5e7af02745ee86d0ac00fbc647d5e Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Thu, 28 Nov 2024 03:00:28 +0100 Subject: [PATCH 4/7] added framework for PropertyOverviewMenu --- .../Interface/Lemur/pp-styles.groovy | 5 + .../client/gui/PropertyOverviewMenu.java | 148 ++++++++++++++++++ .../java/pp/monopoly/client/gui/Toolbar.java | 3 +- 3 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/PropertyOverviewMenu.java diff --git a/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy b/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy index 398fdf1..550ad7c 100644 --- a/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy +++ b/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy @@ -71,6 +71,11 @@ selector("label-Text", "pp") { color = buttonEnabledColor } +selector("card-label", "pp") { + insets = new Insets3f(2, 2, 2, 2) + color = ColorRGBA.Black +} + selector("header", "pp") { font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt") insets = new Insets3f(2, 2, 2, 2) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/PropertyOverviewMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/PropertyOverviewMenu.java new file mode 100644 index 0000000..e1c9c4c --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/PropertyOverviewMenu.java @@ -0,0 +1,148 @@ +package pp.monopoly.client.gui; + +import com.jme3.math.ColorRGBA; +import com.jme3.math.Vector3f; +import com.jme3.renderer.RenderManager; +import com.jme3.renderer.ViewPort; +import com.jme3.scene.control.AbstractControl; +import com.simsilica.lemur.*; +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; + +import java.util.ArrayList; +import java.util.List; + +/** + * PropertyOverviewMenu is a dialog for displaying the player's properties in the game. + */ +public class PropertyOverviewMenu extends Dialog { + private final MonopolyApp app; + private final Container mainContainer; + private final Container displayContainer; + private final Slider horizontalSlider; + private final List cards; + + /** + * Constructs the PropertyOverviewMenu dialog. + * + * @param app The Monopoly application instance. + */ + public PropertyOverviewMenu(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + + // Make the menu fullscreen + Vector3f screenSize = new Vector3f(app.getCamera().getWidth(), app.getCamera().getHeight(), 0); + + // Main container for the menu layout + mainContainer = new Container(); + mainContainer.setPreferredSize(screenSize); // Make fullscreen + mainContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.8f))); // Semi-transparent background + + // Header label + Label headerLabel = mainContainer.addChild(new Label("Meine Grundstücke", new ElementId("header"))); + headerLabel.setFontSize(40); + + // Central display container (to hold the "Gebäude" cards) + displayContainer = mainContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y, FillMode.Even, FillMode.None))); // Horizontal layout + displayContainer.setPreferredSize(new Vector3f(screenSize.x - 300, 550, 0)); // Take up the remaining width + displayContainer.setBackground(new QuadBackgroundComponent(ColorRGBA.Gray)); + displayContainer.setLocalTranslation(0, 0, 11); + + // Add some placeholder "Gebäude" cards to the display container + cards = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + Container card = createGebäudeCard("Gebäude " + (i + 1), 320, 28); + cards.add(card); // Keep track of cards for scrolling + } + + // Initially add only visible cards to the displayContainer + refreshVisibleCards(0); + + // Horizontal slider for scrolling through cards + horizontalSlider = mainContainer.addChild(new Slider(Axis.X)); + horizontalSlider.setPreferredSize(new Vector3f(screenSize.x - 300, 20, 5)); + horizontalSlider.setModel(new DefaultRangedValueModel(0, Math.max(0, cards.size() - 5), 0)); + horizontalSlider.addControl(new SliderValueChangeListener()); + + // Add the "Zurück" button at the bottom + Button backButton = mainContainer.addChild(new Button("Zurück", new ElementId("button"))); + backButton.setPreferredSize(new Vector3f(200, 60, 0)); + backButton.addClickCommands(source -> this.close()); + + // Attach the main container to the GUI node + app.getGuiNode().attachChild(mainContainer); + mainContainer.setLocalTranslation( + 0, + app.getCamera().getHeight(), // Align to the top + 10 + ); + } + + + /** + * Creates a "Gebäude" card container with the given information. + * + * @param title The title of the card (e.g., "Gebäude 1"). + * @param propertyValue The property value. + * @param rent The rent amount. + * @return A styled container representing a "Gebäude" card. + */ + private Container createGebäudeCard(String title, int propertyValue, int rent) { + Container card = new Container(); + card.setPreferredSize(new Vector3f(150, 200, 2)); // Increase width and height for better visibility + card.setBackground(new QuadBackgroundComponent(ColorRGBA.Gray)); + + card.addChild(new Label(title, new ElementId("card-label"))).setFontSize(14); + card.addChild(new Label("Grundstückswert: €" + propertyValue, new ElementId("card-label"))).setFontSize(12); + card.addChild(new Label("Miete allein: €" + rent, new ElementId("card-label"))).setFontSize(12); + card.addChild(new Label("1 Haus: €50", new ElementId("card-label"))).setFontSize(12); + card.addChild(new Label("Hypothekenwert: €160", new ElementId("card-label"))).setFontSize(12); + + return card; + } + + /** + * Updates the visible cards in the displayContainer based on the slider value. + * + * @param startIndex The starting index of the visible cards. + */ + private void refreshVisibleCards(int startIndex) { + displayContainer.clearChildren(); // Remove all current children + int maxVisible = 5; // Number of cards to display at once + for (int i = startIndex; i < startIndex + maxVisible && i < cards.size(); i++) { + displayContainer.addChild(cards.get(i)); + } + } + + /** + * Custom listener for slider value changes. + */ + private class SliderValueChangeListener extends AbstractControl { + @Override + protected void controlUpdate(float tpf) { + // Get the slider's current value and refresh visible cards + int sliderValue = (int) ((Slider) getSpatial()).getModel().getValue(); + refreshVisibleCards(sliderValue); + } + + @Override + protected void controlRender(RenderManager renderManager, ViewPort viewPort) { + // No rendering logic needed + } + + } + + /** + * Closes the dialog and detaches it from the GUI node. + */ + @Override + public void close() { + app.getGuiNode().detachChild(mainContainer); + super.close(); + } +} \ No newline at end of file diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java index 9b87a5b..10b6369 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java @@ -118,7 +118,8 @@ public class Toolbar extends Dialog implements GameEventListener { propertyMenuButton.setFontSize(30); propertyMenuButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); - new BuildingAdminMenu(app).open(); + // new BuildingAdminMenu(app).open(); + new PropertyOverviewMenu(app).open(); })); return propertyMenuButton; } From bb63a4df9fba249a7fa1b0ce3086f3556ca9249d Mon Sep 17 00:00:00 2001 From: Simon Wilkening Date: Thu, 28 Nov 2024 03:16:11 +0100 Subject: [PATCH 5/7] =?UTF-8?q?Popup=5FHandel=5Fbest=C3=A4tigen=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pp/monopoly/client/MonopolyApp.java | 9 +- .../monopoly/client/gui/popups/BuyCard.java | 2 +- .../client/gui/popups/ConfirmTrade.java | 119 ++++++++++++++++++ 3 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java index 70d39d4..2490a06 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java @@ -21,15 +21,11 @@ import com.jme3.system.AppSettings; import com.simsilica.lemur.GuiGlobals; import com.simsilica.lemur.Label; import com.simsilica.lemur.style.BaseStyles; +import pp.monopoly.client.gui.popups.*; import pp.monopoly.game.client.MonopolyClient; import pp.monopoly.client.gui.SettingsMenu; import pp.monopoly.client.gui.StartMenu; import pp.monopoly.client.gui.TestWorld; -import pp.monopoly.client.gui.popups.BuildingPropertyCard; -import pp.monopoly.client.gui.popups.BuyCard; -import pp.monopoly.client.gui.popups.EventCard; -import pp.monopoly.client.gui.popups.FoodFieldCard; -import pp.monopoly.client.gui.popups.GateFieldCard; import pp.monopoly.game.client.ClientGameLogic; import pp.monopoly.game.client.ServerConnection; import pp.monopoly.notification.ClientStateEvent; @@ -134,6 +130,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga private FoodFieldCard foodField; private GateFieldCard gateField; private BuyCard buyCard; + private LooserPopUp looserpopup; private boolean isBuyCardPopupOpen = false; private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed); private final ActionListener TListener = (name, isPressed, tpf) -> handleT(isPressed); @@ -278,7 +275,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga //logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen private void handleB(boolean isPressed) { if (isPressed) { - Dialog tmp = new BuyCard(this); + Dialog tmp = new ConfirmTrade(this); tmp.open(); } } 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 5d9c46e..d8261a5 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 @@ -28,7 +28,7 @@ public class BuyCard extends Dialog { this.app = app; //Generate the corresponfing field - int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID(); + int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();; BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index); // Create the background container diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java new file mode 100644 index 0000000..d205591 --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java @@ -0,0 +1,119 @@ +package pp.monopoly.client.gui.popups; + +import com.jme3.math.ColorRGBA; +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; +import pp.monopoly.client.MonopolyApp; +import pp.monopoly.client.gui.SettingsMenu; +import pp.monopoly.message.client.BuyPropertyRequest; +import pp.monopoly.notification.Sound; + +/** + * SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann. + */ +public class ConfirmTrade extends Dialog { + private final MonopolyApp app; + private final Container confirmTradeContainer; + private final Container backgroundContainer; + + + public ConfirmTrade(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + + //Generate the corresponfing field + //int index = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();; + // BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index); + + // Create the background container + backgroundContainer = new Container(); + backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background + attachChild(backgroundContainer); + + // Hauptcontainer für die Gebäudekarte + confirmTradeContainer = new Container(); + + + Label title = confirmTradeContainer.addChild(new Label( "Handel", new ElementId("label-Bold"))); + title.setFontSize(48); + title.setColor(ColorRGBA.Black); + + // Text, der auf der Karte steht + // Die Preise werden dynamisch dem BoardManager entnommen + Container propertyValuesContainer = confirmTradeContainer.addChild(new Container()); + propertyValuesContainer.addChild(new Label("„Spieler XXX möchte:", new ElementId("label-Text"))); //TODO hier überall die entsprechenden Variablen einfügen + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("- XXX Gebäude", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- XXX EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- XXX Sonderkaten", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("gegen:", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("- XXX Gebäude", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- XXX EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- XXX Sonderkaten", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("tauschen, willst du das Angebot annehmen?", new ElementId("label-Text"))); + propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); + + // Beenden-Button + Button declineButton = confirmTradeContainer.addChild(new Button("Ablehnen", new ElementId("button"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen + declineButton.setFontSize(32); + declineButton.addClickCommands(s -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); + // Kaufen-Button + Button negotiateButton = confirmTradeContainer.addChild(new Button("Verhandeln", new ElementId("button"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen + negotiateButton.setFontSize(32); + negotiateButton.addClickCommands(s -> ifTopDialog( () -> { + app.getGameLogic().playSound(Sound.BUTTON); + app.getGameLogic().send(new BuyPropertyRequest()); + })); + // Kaufen-Button + Button confirmButton = confirmTradeContainer.addChild(new Button("Bestätigen", new ElementId("button"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen + confirmButton.setFontSize(32); + confirmButton.addClickCommands(s -> ifTopDialog( () -> { + app.getGameLogic().playSound(Sound.BUTTON); + app.getGameLogic().send(new BuyPropertyRequest()); + })); + + float padding = 10; // Padding around the settingsContainer for the background + backgroundContainer.setPreferredSize(confirmTradeContainer.getPreferredSize().addLocal(padding, padding, 0)); + + + // Zentriere das Menü + confirmTradeContainer.setLocalTranslation( + (app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x) / 2, + (app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y) / 2, + 8 + ); + + backgroundContainer.setLocalTranslation( + (app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x - padding) / 2, + (app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y+ padding) / 2, + 7 + ); + + app.getGuiNode().attachChild(confirmTradeContainer); + } + + /** + * Schließt das Menü und entfernt die GUI-Elemente. + */ + @Override + public void close() { + app.getGuiNode().detachChild(confirmTradeContainer); // Entferne das Menü + app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand + super.close(); + } + + @Override + public void escape() { + new SettingsMenu(app).open(); + } +} From 5e0ac0abc750508c2be87d41c11f72b4e862de62 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Thu, 28 Nov 2024 03:58:40 +0100 Subject: [PATCH 6/7] fixed button disabled behaviour --- .../Interface/Lemur/pp-styles.groovy | 34 +++++++++++++++++++ .../java/pp/monopoly/client/gui/Toolbar.java | 8 ++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy b/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy index 550ad7c..b9f394e 100644 --- a/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy +++ b/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy @@ -297,3 +297,37 @@ selector("selector.item.label", "hover") { background = new QuadBackgroundComponent(new ColorRGBA(0.2f, 0.6f, 1.0f, 0.9f)) // Highlighted background } + +def enabledCommandToolbar = new Command