mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 20:29:44 +01:00
Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui
This commit is contained in:
commit
e12f00aad6
@ -36,7 +36,7 @@ doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradie
|
|||||||
generateMips: false)
|
generateMips: false)
|
||||||
|
|
||||||
def orangeBorder = TbtQuadBackgroundComponent.create(
|
def orangeBorder = TbtQuadBackgroundComponent.create(
|
||||||
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png", // Replace with an appropriate texture if needed
|
texture(name: "/com/simsilica/lemur/icons/border.png", // Replace with an appropriate texture if needed
|
||||||
generateMips: false),
|
generateMips: false),
|
||||||
1, 1, 1, 126, 126,
|
1, 1, 1, 126, 126,
|
||||||
1f, false)
|
1f, false)
|
||||||
@ -56,6 +56,7 @@ selector("header", "pp") {
|
|||||||
insets = new Insets3f(2, 2, 2, 2)
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
color = color(1, 0.5, 0, 1)
|
color = color(1, 0.5, 0, 1)
|
||||||
textHAlignment = HAlignment.Center
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
}
|
}
|
||||||
|
|
||||||
selector("container", "pp") {
|
selector("container", "pp") {
|
||||||
@ -146,6 +147,8 @@ selector("title", "pp") {
|
|||||||
background.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
background.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
||||||
generateMips: false)
|
generateMips: false)
|
||||||
insets = new Insets3f(2, 2, 2, 2)
|
insets = new Insets3f(2, 2, 2, 2)
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
|
|
||||||
buttonCommands = stdButtonCommands
|
buttonCommands = stdButtonCommands
|
||||||
}
|
}
|
||||||
@ -160,6 +163,8 @@ selector("button", "pp") {
|
|||||||
|
|
||||||
// Use insets to create a margin/padding effect for the inner background
|
// Use insets to create a margin/padding effect for the inner background
|
||||||
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
buttonCommands = stdButtonCommands
|
buttonCommands = stdButtonCommands
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,10 +240,14 @@ selector("tab.button", "pp") {
|
|||||||
selector("settings-title", "pp") {
|
selector("settings-title", "pp") {
|
||||||
fontSize = 48 // Set font size
|
fontSize = 48 // Set font size
|
||||||
background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
|
background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
}
|
}
|
||||||
|
|
||||||
selector("menu-button", "pp") {
|
selector("menu-button", "pp") {
|
||||||
fontSize = 40 // Set font size
|
fontSize = 40 // Set font size
|
||||||
background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
|
background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
|
||||||
|
textHAlignment = HAlignment.Center
|
||||||
|
textVAlignment = VAlignment.Center
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ dependencies {
|
|||||||
implementation project(":monopoly:model")
|
implementation project(":monopoly:model")
|
||||||
implementation project(":monopoly:server")
|
implementation project(":monopoly:server")
|
||||||
|
|
||||||
|
implementation 'com.simsilica:lemur-proto:1.13.0'
|
||||||
implementation libs.jme3.desktop
|
implementation libs.jme3.desktop
|
||||||
implementation libs.lemur
|
implementation libs.lemur
|
||||||
implementation libs.lemurproto
|
implementation libs.lemurproto
|
||||||
|
@ -12,6 +12,7 @@ import com.simsilica.lemur.Label;
|
|||||||
import com.simsilica.lemur.TextField;
|
import com.simsilica.lemur.TextField;
|
||||||
import com.simsilica.lemur.component.SpringGridLayout;
|
import com.simsilica.lemur.component.SpringGridLayout;
|
||||||
|
|
||||||
|
import com.simsilica.lemur.style.ElementId;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
import pp.monopoly.client.StartMenu;
|
import pp.monopoly.client.StartMenu;
|
||||||
|
|
||||||
@ -37,8 +38,10 @@ public class CreateGameMenu {
|
|||||||
menuContainer.setPreferredSize(new Vector3f(600, 400, 0)); // Feste Größe des Containers
|
menuContainer.setPreferredSize(new Vector3f(600, 400, 0)); // Feste Größe des Containers
|
||||||
|
|
||||||
// Titel
|
// Titel
|
||||||
Label title = menuContainer.addChild(new Label("Neues Spiel"));
|
Label title = menuContainer.addChild(new Label("Neues Spiel", new ElementId("header")));
|
||||||
title.setFontSize(48);
|
title.setFont(app.getAssetManager().loadFont("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt"));
|
||||||
|
title.setFontSize(50);
|
||||||
|
|
||||||
|
|
||||||
// Eingabefelder-Container
|
// Eingabefelder-Container
|
||||||
Container inputContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
|
Container inputContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
|
||||||
|
@ -3,6 +3,7 @@ package pp.monopoly.client.gui;
|
|||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.material.RenderState.BlendMode;
|
import com.jme3.material.RenderState.BlendMode;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.shape.Quad;
|
import com.jme3.scene.shape.Quad;
|
||||||
import com.simsilica.lemur.Button;
|
import com.simsilica.lemur.Button;
|
||||||
@ -12,7 +13,9 @@ import com.simsilica.lemur.Label;
|
|||||||
import com.simsilica.lemur.Slider;
|
import com.simsilica.lemur.Slider;
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
import com.simsilica.lemur.style.ElementId;
|
import com.simsilica.lemur.style.ElementId;
|
||||||
|
import com.simsilica.lemur.ValueRenderer;
|
||||||
|
|
||||||
|
import com.simsilica.lemur.Selector;
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
|
||||||
@ -61,6 +64,30 @@ public class SettingsMenu extends Dialog {
|
|||||||
backgroundMusicContainer.addChild(new Checkbox("Musik an")).setChecked(true);
|
backgroundMusicContainer.addChild(new Checkbox("Musik an")).setChecked(true);
|
||||||
backgroundMusicContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
backgroundMusicContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
|
/*Selector<String> dropdown = new Selector<>();
|
||||||
|
backgroundMusicContainer.addChild(dropdown);
|
||||||
|
|
||||||
|
Vector3f dimens = settingsContainer.getPreferredSize();
|
||||||
|
Vector3f dimens2 = dropdown.getPopupContainer().getPreferredSize();
|
||||||
|
dimens2.setX(dimens.getX());
|
||||||
|
dropdown.getPopupContainer().setPreferredSize(dimens2);*/
|
||||||
|
// Create the dropdown menu
|
||||||
|
Selector<String> dropdown = new Selector<>();
|
||||||
|
|
||||||
|
// Generate and add numbered examples to the dropdown
|
||||||
|
for (int i = 1; i <= 10; i++) { // Generate 10 examples
|
||||||
|
dropdown.getModel().add("Example " + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Add the dropdown to the container
|
||||||
|
backgroundMusicContainer.addChild(dropdown);
|
||||||
|
|
||||||
|
// Adjust the dropdown's popup container size if necessary
|
||||||
|
Vector3f dimens = settingsContainer.getPreferredSize();
|
||||||
|
Vector3f dimens2 = dropdown.getPopupContainer().getPreferredSize();
|
||||||
|
dimens2.setX(dimens.getX());
|
||||||
|
dropdown.getPopupContainer().setPreferredSize(dimens2);
|
||||||
// Beenden-Button
|
// Beenden-Button
|
||||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("menu-button")));
|
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("menu-button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
|
@ -3,20 +3,22 @@ package pp.monopoly.client.gui;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.jme3.font.BitmapText;
|
import com.jme3.font.BitmapText;
|
||||||
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.simsilica.lemur.Axis;
|
import com.simsilica.lemur.*;
|
||||||
import com.simsilica.lemur.Button;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
import com.simsilica.lemur.Container;
|
|
||||||
import com.simsilica.lemur.component.SpringGridLayout;
|
import com.simsilica.lemur.component.SpringGridLayout;
|
||||||
|
|
||||||
|
import com.simsilica.lemur.style.ElementId;
|
||||||
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbar Klasse, die am unteren Rand der Szene angezeigt wird.
|
* Toolbar Klasse, die am unteren Rand der Szene angezeigt wird.
|
||||||
* Die Buttons bewegen den Würfel auf dem Spielfeld.
|
* Die Buttons bewegen den Würfel auf dem Spielfeld.
|
||||||
*/
|
*/
|
||||||
public class Toolbar {
|
public class Toolbar extends Dialog {
|
||||||
|
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
private final Container toolbarContainer;
|
private final Container toolbarContainer;
|
||||||
@ -35,6 +37,7 @@ public class Toolbar {
|
|||||||
* @param cube Der Würfel, der bewegt werden soll
|
* @param cube Der Würfel, der bewegt werden soll
|
||||||
*/
|
*/
|
||||||
public Toolbar(MonopolyApp app, Geometry cube) {
|
public Toolbar(MonopolyApp app, Geometry cube) {
|
||||||
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.cube = cube;
|
this.cube = cube;
|
||||||
|
|
||||||
@ -44,13 +47,41 @@ public class Toolbar {
|
|||||||
// Setze die Position am unteren Rand und die Breite
|
// Setze die Position am unteren Rand und die Breite
|
||||||
toolbarContainer.setLocalTranslation(
|
toolbarContainer.setLocalTranslation(
|
||||||
0, // Links bündig
|
0, // Links bündig
|
||||||
100, // Höhe über dem unteren Rand
|
200, // Höhe über dem unteren Rand
|
||||||
0 // Z-Ebene
|
0 // Z-Ebene
|
||||||
);
|
);
|
||||||
toolbarContainer.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 100, 0)); // Volle Breite
|
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
|
// Füge Buttons zur Toolbar hinzu
|
||||||
initializeButtons();
|
//initializeButtons();
|
||||||
|
|
||||||
|
|
||||||
|
// 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.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
|
// Menü-Container: Ein Container für Übersicht
|
||||||
|
Container overviewContainer = toolbarContainer.addChild(new Container());
|
||||||
|
overviewContainer.addChild(new Label("Übersicht", new ElementId("label")));
|
||||||
|
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.addChild(new Label("Wo Würfel?", new ElementId("label")));
|
||||||
|
diceContainer.addChild(new Button("Würfeln"));
|
||||||
|
diceContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
|
// Menü-Container: Ein Nested-Container für Handeln, Grundstücke und Zug beenden
|
||||||
|
Container menuContainer = toolbarContainer.addChild(new Container());
|
||||||
|
menuContainer.addChild(new Button("Handeln"));
|
||||||
|
menuContainer.addChild(new Button("Grundstücke"));
|
||||||
|
menuContainer.addChild(new Button("Zug beenden"));
|
||||||
|
menuContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
// Füge die Toolbar zur GUI hinzu
|
// Füge die Toolbar zur GUI hinzu
|
||||||
app.getGuiNode().attachChild(toolbarContainer);
|
app.getGuiNode().attachChild(toolbarContainer);
|
||||||
@ -64,9 +95,10 @@ public class Toolbar {
|
|||||||
* Initialisiert die Buttons in der Toolbar.
|
* Initialisiert die Buttons in der Toolbar.
|
||||||
*/
|
*/
|
||||||
private void initializeButtons() {
|
private void initializeButtons() {
|
||||||
addButton("Vorwärts", 1); // Bewegung nach vorne
|
addTradeMenuButton(); // Bewegung nach vorne
|
||||||
addButton("Rückwärts", -1); // Bewegung nach hinten
|
addEndTurnButton(); // Bewegung nach hinten
|
||||||
addDiceRollButton(); // Würfel-Button
|
addDiceRollButton(); // Würfel-Button
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,12 +107,13 @@ public class Toolbar {
|
|||||||
* @param label Der Text des Buttons
|
* @param label Der Text des Buttons
|
||||||
* @param step Schrittweite (+1 für vorwärts, -1 für rückwärts)
|
* @param step Schrittweite (+1 für vorwärts, -1 für rückwärts)
|
||||||
*/
|
*/
|
||||||
private void addButton(String label, int step) {
|
|
||||||
|
/*private void addButton(String label, int step) {
|
||||||
Button button = new Button(label);
|
Button button = new Button(label);
|
||||||
button.setPreferredSize(new Vector3f(150, 50, 0)); // Größe der Buttons
|
button.setPreferredSize(new Vector3f(150, 50, 0)); // Größe der Buttons
|
||||||
button.addClickCommands(source -> moveCube(step));
|
button.addClickCommands(source -> moveCube(step));
|
||||||
toolbarContainer.addChild(button);
|
toolbarContainer.addChild(button);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fügt den Würfel-Button hinzu, der die Figur entsprechend der gewürfelten Zahl bewegt.
|
* Fügt den Würfel-Button hinzu, der die Figur entsprechend der gewürfelten Zahl bewegt.
|
||||||
@ -92,6 +125,27 @@ public class Toolbar {
|
|||||||
toolbarContainer.addChild(diceButton);
|
toolbarContainer.addChild(diceButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addTradeMenuButton() {
|
||||||
|
Button diceButton = new Button("Handeln");
|
||||||
|
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
|
||||||
|
diceButton.addClickCommands(source -> rollDice());
|
||||||
|
toolbarContainer.addChild(diceButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addEndTurnButton() {
|
||||||
|
Button diceButton = new Button("Grundstücke");
|
||||||
|
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
|
||||||
|
diceButton.addClickCommands(source -> rollDice());
|
||||||
|
toolbarContainer.addChild(diceButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPropertyMenuButton() {
|
||||||
|
Button diceButton = new Button("Zug beenden");
|
||||||
|
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
|
||||||
|
diceButton.addClickCommands(source -> rollDice());
|
||||||
|
toolbarContainer.addChild(diceButton);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simuliert einen Würfelwurf und bewegt die Figur entsprechend.
|
* Simuliert einen Würfelwurf und bewegt die Figur entsprechend.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user