From 944b6b674ee5f5f1c21d129e9bbf338feefd323f Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Sat, 7 Dec 2024 14:54:55 +0100 Subject: [PATCH] replaced text displays with labels --- .../Interface/Lemur/pp-styles.groovy | 27 +++++++++++++++++++ .../java/pp/monopoly/client/gui/Toolbar.java | 2 +- .../monopoly/client/gui/popups/BuyHouse.java | 6 ++--- .../client/gui/popups/RepayMortage.java | 6 ++--- .../monopoly/client/gui/popups/SellHouse.java | 8 +++--- .../client/gui/popups/TakeMortage.java | 6 ++--- 6 files changed, 41 insertions(+), 14 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 195746e..ba7a710 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 @@ -3,6 +3,7 @@ // https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling import com.jme3.math.ColorRGBA +import com.jme3.texture.Texture import com.simsilica.lemur.* import com.simsilica.lemur.component.QuadBackgroundComponent import com.simsilica.lemur.Button @@ -47,6 +48,23 @@ def orangeBorder = TbtQuadBackgroundComponent.create( 1f, false) orangeBorder.color = color(1, 0.5, 0, 1) // Orange color + +def createCustomBackground(app) { + // Load the texture from the assets + Texture texture = app.getAssetManager().loadTexture("Pictures/kontobg.png") + + // Create the TbtQuadBackgroundComponent + def backgroundCustom = TbtQuadBackgroundComponent.create( + texture, // The texture to use + 1, 1, 1, // Insets for the 9-patch behavior + 126, 126, // The size of the texture + 1f, // The scale factor + false // No tiling + ) + + return backgroundCustom +} + selector("pp") { font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt") } @@ -366,3 +384,12 @@ selector("button-toolbar", "pp") { } +selector("button-toolbar2", "pp") { + insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness + textHAlignment = HAlignment.Center + textVAlignment = VAlignment.Center + buttonCommands = stdButtonCommandsToolbar +} + + + 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 f55982f..8c3c8d2 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 @@ -257,7 +257,7 @@ public class Toolbar extends Dialog implements GameEventListener { } private Button createPropertyMenuButton() { - propertyMenuButton = new Button("", new ElementId("button-toolbar")); + propertyMenuButton = new Button("", new ElementId("button-toolbar2")); propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0)); String iconBuildingPath = "icons/icon-gebaude.png"; diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyHouse.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyHouse.java index d55b26e..c3632ce 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyHouse.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyHouse.java @@ -40,8 +40,8 @@ public class BuyHouse extends Dialog { /** Background container providing a border for the popup. */ private final Container backgroundContainer; - /** TextField to display selected properties. */ - private TextField selectionDisplay; + /** Label to display selected properties. */ + private Label selectionDisplay; /** Reference for tracking dropdown selection changes. */ private VersionedReference> selectionRef; @@ -162,7 +162,7 @@ public class BuyHouse extends Dialog { selectionRef = propertySelector.getSelectionModel().createReference(); // Initialize the selection display here - selectionDisplay = new TextField(""); // Create TextField for displaying selections + selectionDisplay = new Label(""); selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RepayMortage.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RepayMortage.java index 17128ed..dcd0a08 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RepayMortage.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RepayMortage.java @@ -45,8 +45,8 @@ public class RepayMortage extends Dialog { /** Background container providing a border for the popup. */ private final Container backgroundContainer; - /** Text field to display selected properties. */ - private TextField selectionDisplay; + /** Label to display selected properties. */ + private Label selectionDisplay; /** Reference to track property selections in the dropdown menu. */ private VersionedReference> selectionRef; @@ -166,7 +166,7 @@ public class RepayMortage extends Dialog { selectionRef = propertySelector.getSelectionModel().createReference(); // Initialize the selection display here - selectionDisplay = new TextField(""); // Create TextField for displaying selections + selectionDisplay = new Label(""); // Create TextField for displaying selections selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java index 5d6d866..532de97 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java @@ -45,8 +45,8 @@ public class SellHouse extends Dialog { /** Background container providing a styled border around the main dialog. */ private final Container backgroundContainer; - /** Text field to display selected properties. */ - private TextField selectionDisplay; + /** Label to display selected properties. */ + private Label selectionDisplay; /** Reference to track selection changes in the property selector. */ private VersionedReference> selectionRef; @@ -86,7 +86,7 @@ public class SellHouse extends Dialog { title.setFontSize(48); title.setColor(ColorRGBA.Black); - //Unterteilund des sellHouseContainer in drei "Untercontainer" + //Unterteilung des sellHouseContainer in drei "Untercontainer" Container upContainer = sellhouseContainer.addChild(new Container()); Container middleContainer = sellhouseContainer.addChild(new Container()); Container downContainer = sellhouseContainer.addChild(new Container()); @@ -172,7 +172,7 @@ public class SellHouse extends Dialog { selectionRef = propertySelector.getSelectionModel().createReference(); // Initialize the selection display here - selectionDisplay = new TextField(""); // Create TextField for displaying selections + selectionDisplay = new Label(""); selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java index a852515..19d333e 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java @@ -46,8 +46,8 @@ public class TakeMortage extends Dialog { /** Background container providing a styled border around the main dialog. */ private final Container backgroundContainer; - /** Text field to display selected properties. */ - private TextField selectionDisplay; + /** Label to display selected properties. */ + private Label selectionDisplay; /** Reference to track selection changes in the property selector. */ private VersionedReference> selectionRef; @@ -172,7 +172,7 @@ public class TakeMortage extends Dialog { selectionRef = propertySelector.getSelectionModel().createReference(); // Initialize the selection display here - selectionDisplay = new TextField(""); // Create TextField for displaying selections + selectionDisplay = new Label(""); // Create TextField for displaying selections selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container