Toolbar-Design angepasst

This commit is contained in:
Yvonne Schmidt 2024-11-22 04:45:27 +01:00
parent 559afcaffd
commit 399606d9a0
2 changed files with 44 additions and 22 deletions

View File

@ -1,6 +1,8 @@
// Styling of Lemur components
// For documentation, see:
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
import com.jme3.math.ColorRGBA
import com.simsilica.lemur.*
import com.simsilica.lemur.component.QuadBackgroundComponent
import com.simsilica.lemur.Button
@ -34,6 +36,7 @@ def gradient = TbtQuadBackgroundComponent.create(
def doubleGradient = new QuadBackgroundComponent(gradientColor)
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
generateMips: false)
//doubleGradient.color = color(0, 0, 0, 1)
def orangeBorder = TbtQuadBackgroundComponent.create(
texture(name: "/com/simsilica/lemur/icons/border.png", // Replace with an appropriate texture if needed
@ -51,6 +54,21 @@ selector("label", "pp") {
color = buttonEnabledColor
}
selector("label-Bold", "pp") {
insets = new Insets3f(2, 2, 2, 2)
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-32.fnt")
fontSize = 30
color = buttonEnabledColor
textHAlignment = HAlignment.Center
textVAlignment = VAlignment.Center
}
selector("label-Text", "pp") {
insets = new Insets3f(2, 2, 2, 2)
fontSize = 25
color = buttonEnabledColor
}
selector("header", "pp") {
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
insets = new Insets3f(2, 2, 2, 2)
@ -65,20 +83,10 @@ selector("container", "pp") {
}
selector("toolbar") {
// Set the grey background
background = new QuadBackgroundComponent(greyBackground)
background = gradient.clone()
background.setColor(bgColor)
//color = (new ColorRGBA(0.4157f, 0.4235f, 0.4392f, 1.0f))
// Add a red border using a TbtQuadBackgroundComponent
def redBorder = TbtQuadBackgroundComponent.create(
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png",
generateMips: false),
1, 1, 1, 1, 1,
1f, false)
redBorder.color = redBorderColor
background = greyBackground
// Optional: Set padding inside the toolbar
insets = new Insets3f(10, 10, 10, 10)
}
selector("slider", "pp") {
background = gradient.clone()
@ -246,7 +254,7 @@ selector("settings-title", "pp") {
selector("menu-button", "pp") {
fontSize = 40 // Set font size
background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
background = new QuadBackgroundComponent(new ColorRGBA(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
textHAlignment = HAlignment.Center
textVAlignment = VAlignment.Center
}

View File

@ -1,3 +1,4 @@
package pp.monopoly.client.gui;
import java.util.Random;
@ -42,7 +43,7 @@ public class Toolbar extends Dialog {
this.cube = cube;
// Erstelle die Toolbar
toolbarContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
toolbarContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y), "toolbar");
// Setze die Position am unteren Rand und die Breite
toolbarContainer.setLocalTranslation(
@ -52,8 +53,6 @@ public class Toolbar extends Dialog {
);
toolbarContainer.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 200, 0)); // Volle Breite
// Hintergrund Grau
toolbarContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f)));
// Füge Buttons zur Toolbar hinzu
//initializeButtons();
@ -61,20 +60,35 @@ public class Toolbar extends Dialog {
// Menü-Container: Ein Nested-Container für Kontostand und "Meine Gulag Frei Karten"
Container accountContainer = toolbarContainer.addChild(new Container());
accountContainer.addChild(new Label("Kontostand", new ElementId("label")));
accountContainer.addChild(new Label("Gulag Frei Karten", new ElementId("label")));
accountContainer.addChild(new Label("Kontostand", new ElementId("label-Bold")));
accountContainer.addChild(new Label("6666€", new ElementId("label-Text"))); //TODO Variable hier einsetzen
accountContainer.addChild(new Label("Gulag Frei Karten", new ElementId("label-Bold")));
accountContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
// Add a spacer between accountContainer and overviewContainer
Panel spacer = new Panel(); // Create an empty panel as a spacer
spacer.setPreferredSize(new Vector3f(5, 0, 0)); // Adjust the width as needed
spacer.setBackground(null);
toolbarContainer.addChild(spacer);
// Menü-Container: Ein Container für Übersicht
Container overviewContainer = toolbarContainer.addChild(new Container());
overviewContainer.addChild(new Label("Übersicht", new ElementId("label")));
overviewContainer.addChild(new Label("Übersicht", new ElementId("label-Bold")));
overviewContainer.addChild(new Label("„Spieler 1“: 1244€", new ElementId("label-Text")));//TODO Variable hier einsetzen
overviewContainer.addChild(new Label("„Spieler 2“: 1244€", new ElementId("label-Text")));//TODO Variable hier einsetzen
overviewContainer.addChild(new Label("„Spieler 3“: 1244€", new ElementId("label-Text")));//TODO Variable hier einsetzen
overviewContainer.addChild(new Label("„Spieler 4“: 1244€", new ElementId("label-Text")));//TODO Variable hier einsetzen
overviewContainer.addChild(new Label("„Spieler 5“: 1244€", new ElementId("label-Text")));//TODO Variable hier einsetzen
overviewContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
// Menü-Container: Ein Container für Würfel
Container diceContainer = toolbarContainer.addChild(new Container());
diceContainer.setPreferredSize(new Vector3f(400, 150, 0));
diceContainer.addChild(new Label("Wo Würfel?", new ElementId("label")));
diceContainer.addChild(addDiceRollButton());
diceContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
diceContainer.setBackground(null);
// Menü-Container: Ein Nested-Container für Handeln, Grundstücke und Zug beenden
Container menuContainer = toolbarContainer.addChild(new Container());
@ -120,7 +134,7 @@ public class Toolbar extends Dialog {
*/
private Button addDiceRollButton() {
Button diceButton = new Button("Würfeln");
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
diceButton.setPreferredSize(new Vector3f(50, 20, 0));
diceButton.addClickCommands(source -> rollDice());
toolbarContainer.addChild(diceButton);
return diceButton;