Compare commits

..

No commits in common. "46d2dce3721760d71ed711b6261bf6c524786a33" and "748226f4edc3ea3eb186511a1f83328b0f6cd0fc" have entirely different histories.

9 changed files with 114 additions and 187 deletions

View File

@ -24,10 +24,10 @@ overlay.top.color=1, 1, 1, 1
settings.show=false settings.show=false
# #
# Specifies the width of the application window in pixels. # Specifies the width of the application window in pixels.
settings.resolution.width=1920 settings.resolution.width=1200
# #
# Specifies the height of the application window in pixels. # Specifies the height of the application window in pixels.
settings.resolution.height=1080 settings.resolution.height=800
# #
# Determines whether the application runs in full-screen mode. # Determines whether the application runs in full-screen mode.
settings.full-screen=false settings.full-screen=false

View File

@ -160,17 +160,17 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen //logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
private void handleB(boolean isPressed) { private void handleB(boolean isPressed) {
if (isPressed) { if (isPressed) {
if (gateField != null && isBuyCardPopupOpen) { if (foodField != null && isBuyCardPopupOpen) {
// Schließe das SettingsMenu // Schließe das SettingsMenu
System.out.println("Schließe BuyCardPopup..."); System.out.println("Schließe BuyCardPopup...");
gateField.close(); foodField.close();
gateField = null; foodField = null;
setBuyCardPopupOpen(false); setBuyCardPopupOpen(false);
} else { } else {
// Öffne das SettingsMenu // Öffne das SettingsMenu
System.out.println("Öffne BuyCardPopup..."); System.out.println("Öffne BuyCardPopup...");
gateField = new GateFieldCard(this); foodField = new FoodFieldCard(this);
gateField.open(); foodField.open();
setBuyCardPopupOpen(true); setBuyCardPopupOpen(true);
} }
} }

View File

@ -51,10 +51,10 @@ public class CameraController {
} }
private Vector3f fieldIdToVector(int fieldID) { private Vector3f fieldIdToVector(int fieldID) {
if (fieldID <= 10) return new Vector3f(30,height,0); if (fieldID <= 10) return new Vector3f(4,height,0);
if (fieldID <= 20) return new Vector3f(0, height, 30); if (fieldID <= 20) return new Vector3f(0, height, 4);
if (fieldID <= 30) return new Vector3f(-30, height, 0); if (fieldID <= 30) return new Vector3f(-4, height, 0);
if (fieldID <= 40) return new Vector3f(0, height, -30); if (fieldID <= 40) return new Vector3f(0, height, -4);
else throw new IllegalArgumentException(); else throw new IllegalArgumentException();
} }
} }

View File

@ -7,7 +7,6 @@ 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.jme3.scene.shape.Quad; import com.jme3.scene.shape.Quad;
import com.jme3.scene.shape.Sphere;
import com.jme3.texture.Texture; import com.jme3.texture.Texture;
import com.simsilica.lemur.Axis; import com.simsilica.lemur.Axis;
import com.simsilica.lemur.Button; import com.simsilica.lemur.Button;
@ -31,6 +30,7 @@ public class LobbyMenu {
private final MonopolyApp app; private final MonopolyApp app;
private final Container menuContainer; private final Container menuContainer;
private Geometry background; private Geometry background;
private final Selector<String> dropdown;
public LobbyMenu(MonopolyApp app) { public LobbyMenu(MonopolyApp app) {
this.app = app; this.app = app;
@ -50,11 +50,11 @@ public class LobbyMenu {
// Create a smaller horizontal container for the label, input field, and spacers // Create a smaller horizontal container for the label, input field, and spacers
Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
horizontalContainer.setPreferredSize(new Vector3f(600, 40, 0)); // Adjust container size horizontalContainer.setPreferredSize(new Vector3f(600, 50, 0)); // Adjust container size
horizontalContainer.setBackground(null); horizontalContainer.setBackground(null);
Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold"))); Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold")));
title.setFontSize(40); title.setFontSize(48);
// Add a spacer between the title and the input field // Add a spacer between the title and the input field
Label spacerBeforeInput = horizontalContainer.addChild(new Label("")); // Invisible spacer Label spacerBeforeInput = horizontalContainer.addChild(new Label("")); // Invisible spacer
@ -77,81 +77,40 @@ public class LobbyMenu {
); );
app.getGuiNode().attachChild(menuContainer); app.getGuiNode().attachChild(menuContainer);
// Dropdowns and Labels // Spielerstatus anzeigen
Container dropdownContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); Container playerListContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
dropdownContainer.setPreferredSize(new Vector3f(800, 200, 0)); playerListContainer.addChild(new Label("Spieler in der Lobby:"));
dropdownContainer.setBackground(null); playerListContainer.setBackground(null);
dropdownContainer.setInsets(new Insets3f(10, 0, 0, 0)); Label playersLabel = playerListContainer.addChild(new Label("Noch keine Spieler verbunden.")); // Beispieltext
// Player Input Field
Container playerInputContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X))); VersionedList<String> items = new VersionedList<>();
playerInputContainer.addChild(new Label("Spieler:")); items.add("Alpha");
playerInputContainer.setBackground(null); items.add("Beta");
items.add("Gamma");
items.add("Back");
dropdown = new Selector<>(items,"glass");
dropdown.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
menuContainer.addChild(dropdown);
// Add the custom action listener
addSelectionActionListener(dropdown, this::onDropdownSelectionChanged);
TextField playerInputField = new TextField("");
playerInputField.setPreferredSize(new Vector3f(100, 20, 0));
playerInputField.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding for the text inside the field
playerInputField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black));
playerInputContainer.addChild(playerInputField);
// Spacer (Center Circle Area)
Label spacer = dropdownContainer.addChild(new Label(""));
spacer.setPreferredSize(new Vector3f(200, 200, 0)); // Adjust this to fit the center graphic
// Figur Dropdown
Container figureDropdownContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
figureDropdownContainer.addChild(new Label("Figur:"));
figureDropdownContainer.setBackground(null);
VersionedList<String> figures = new VersionedList<>();
figures.add("Hund");
figures.add("Katze");
figures.add("Panzer");
figures.add("Pot");
Selector<String> figureDropdown = new Selector<>(figures, "glass");
figureDropdown.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray));
figureDropdown.setPreferredSize(new Vector3f(100, 20, 0));
figureDropdownContainer.addChild(figureDropdown);
addSelectionActionListener(figureDropdown, this::onDropdownSelectionChanged);
// Buttons
Container buttonContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y))); Container buttonContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
buttonContainer.setPreferredSize(new Vector3f(100, 40, 0)); buttonContainer.setPreferredSize(new Vector3f(400, 50, 0));
buttonContainer.setInsets(new Insets3f(20, 0, 10, 0)); // Add spacing above the buttons
buttonContainer.setBackground(null);
// Lower-left container for "Abbrechen" button
Container lowerLeftMenu = new Container();
Button cancelButton = new Button("Abbrechen");
cancelButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
cancelButton.setFontSize(18); // Adjust font size
cancelButton.addClickCommands(source -> goBackToCreateGame()); // Add functionality
lowerLeftMenu.addChild(cancelButton);
// Position the container near the bottom-left corner // "Bereit"-Button
lowerLeftMenu.setLocalTranslation(new Vector3f(120, 170, 3)); // Adjust X and Y to align with the bottom-left corner Button readyButton = buttonContainer.addChild(new Button("Bereit"));
app.getGuiNode().attachChild(lowerLeftMenu); readyButton.setPreferredSize(new Vector3f(120, 40, 0));
readyButton.addClickCommands(source -> toggleReady(playersLabel));
// Lower-right container for "Bereit" button // "Zurück"-Button
Container lowerRightMenu = new Container(); Button backButton = buttonContainer.addChild(new Button("Zurück"));
Button readyButton = new Button("Bereit"); backButton.setPreferredSize(new Vector3f(120, 40, 0));
readyButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image backButton.addClickCommands(source -> goBackToCreateGame());
readyButton.setFontSize(18); // Adjust font size
readyButton.setBackground(new QuadBackgroundComponent(ColorRGBA.Green)); // Add color to match the style
readyButton.addClickCommands(source -> toggleReady(null)); // Add functionality
lowerRightMenu.addChild(readyButton);
// Position the container near the bottom-right corner
lowerRightMenu.setLocalTranslation(new Vector3f(app.getCamera().getWidth() - 320, 170, 3)); // X: 220px from the right, Y: 50px above the bottom
app.getGuiNode().attachChild(lowerRightMenu);
// Add a colored circle between the input field and the dropdown menu
Geometry circle = createCircle( ColorRGBA.Red); // 50 is the diameter, Red is the color
circle.setLocalTranslation(new Vector3f(
(app.getCamera().getWidth()) / 2, // Center horizontally
(app.getCamera().getHeight() / 2) - 90, // Adjust Y position
2 // Ensure it's in front of the background but behind the dropdown
));
app.getGuiNode().attachChild(circle); // Attach to the GUI node
// Zentrierung des Containers // Zentrierung des Containers
menuContainer.setLocalTranslation( menuContainer.setLocalTranslation(
@ -163,12 +122,11 @@ public class LobbyMenu {
app.getGuiNode().attachChild(menuContainer); app.getGuiNode().attachChild(menuContainer);
} }
/** /**
* Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu. * Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu.
*/ */
private void addBackgroundImage() { private void addBackgroundImage() {
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/lobby.png"); Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight()); Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
background = new Geometry("Background", quad); background = new Geometry("Background", quad);
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
@ -179,19 +137,6 @@ public class LobbyMenu {
app.getGuiNode().attachChild(background); app.getGuiNode().attachChild(background);
} }
private Geometry createCircle(ColorRGBA color) {
Sphere sphere = new Sphere(90,90,60.0f);
Geometry circleGeometry = new Geometry("Circle", sphere);
// Create a material with a solid color
Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", color); // Set the desired color
circleGeometry.setMaterial(material);
return circleGeometry;
}
/** /**
* Schaltet den "Bereit"-Status um. * Schaltet den "Bereit"-Status um.
*/ */

View File

@ -48,7 +48,7 @@ public class TestWorld {
app.getCamera(), // Die Kamera der App app.getCamera(), // Die Kamera der App
Vector3f.ZERO, // Fokus auf die Mitte des Spielfelds Vector3f.ZERO, // Fokus auf die Mitte des Spielfelds
4, // Radius des Kreises 4, // Radius des Kreises
15, // Höhe der Kamera 2, // Höhe der Kamera
0 // Geschwindigkeit der Bewegung 0 // Geschwindigkeit der Bewegung
); );
@ -82,7 +82,7 @@ public class TestWorld {
*/ */
private void createBoard() { private void createBoard() {
// Erstelle ein Quadrat // Erstelle ein Quadrat
Box box = new Box(10, 0.1f, 10); // Dünnes Quadrat für die Textur Box box = new Box(1, 0.01f, 1); // Dünnes Quadrat für die Textur
Geometry geom = new Geometry("Board", box); Geometry geom = new Geometry("Board", box);
// Setze das Material mit Textur // Setze das Material mit Textur

View File

@ -5,6 +5,7 @@ import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
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.Container; import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label; import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.component.QuadBackgroundComponent;
@ -21,14 +22,15 @@ import pp.monopoly.model.fields.BuildingProperty;
public class BuildingPropertyCard extends Dialog { public class BuildingPropertyCard extends Dialog {
private final MonopolyApp app; private final MonopolyApp app;
private final Geometry overlayBackground; private final Geometry overlayBackground;
private final Container buildingPropertyContainer; private final Container settingsContainer;
private final Container backgroundContainer; private final Container backgroundContainer;
private int index = 39; private int index = 23;
public BuildingPropertyCard(MonopolyApp app) { public BuildingPropertyCard(MonopolyApp app) {
super(app.getDialogManager()); super(app.getDialogManager());
this.app = app; this.app = app;
// Titel
//Generate the corresponfing field //Generate the corresponfing field
BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index); BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index);
@ -41,19 +43,22 @@ public class BuildingPropertyCard extends Dialog {
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
app.getGuiNode().attachChild(backgroundContainer); app.getGuiNode().attachChild(backgroundContainer);
// Hauptcontainer für die Gebäudekarte // Hauptcontainer für das Menü
buildingPropertyContainer = new Container(); settingsContainer = new Container();
buildingPropertyContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor())); //settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(170 / 255f, 223 / 255f, 246 / 255f, 1))); // hell
settingsContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor())); //dunkel
Label settingsTitle = buildingPropertyContainer.addChild(new Label( field.getName(), new ElementId("settings-title")));
Label settingsTitle = settingsContainer.addChild(new Label( field.getName(), new ElementId("settings-title")));
settingsTitle.setFontSize(48); settingsTitle.setFontSize(48);
// Text, der auf der Karte steht // Effekt-Sound: Slider und Checkbox
// Die Preise werden dynamisch dem BoardManager entnommen Container propertyValuesContainer = settingsContainer.addChild(new Container());
Container propertyValuesContainer = buildingPropertyContainer.addChild(new Container());
propertyValuesContainer.addChild(new Label("„Grundstückswert: " + field.getPrice() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Grundstückswert: " + field.getPrice() + " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
propertyValuesContainer.addChild(new Label("„Miete allein: " + field.getAllRent().get(0)+ " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Miete allein: " + field.getAllRent().get(0)+ " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("„-mit 1 Haus: " + field.getAllRent().get(1) + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„-mit 1 Haus: " + field.getAllRent().get(1) + " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("„-mit 2 Häuser: " + field.getAllRent().get(2) + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„-mit 2 Häuser: " + field.getAllRent().get(2) + " EUR", new ElementId("label-Text")));
@ -61,39 +66,34 @@ public class BuildingPropertyCard extends Dialog {
propertyValuesContainer.addChild(new Label("„-mit 4 Häuser: " + field.getAllRent().get(4) + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„-mit 4 Häuser: " + field.getAllRent().get(4) + " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("„-mit 1 Hotel: " + field.getAllRent().get(5) + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„-mit 1 Hotel: " + field.getAllRent().get(5) + " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("„-1 Haus kostet: " + field.getHousePrice()+ " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„-1 Haus kostet: " + field.getHousePrice()+ " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
/*
// Beenden-Button // Beenden-Button
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
quitButton.setFontSize(32); quitButton.setFontSize(32);
// Kaufen-Button // Kaufen-Button
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
buyButton.setFontSize(32); buyButton.setFontSize(32);
*/
float padding = 10; // Padding around the settingsContainer for the background float padding = 10; // Padding around the settingsContainer for the background
backgroundContainer.setPreferredSize(buildingPropertyContainer.getPreferredSize().addLocal(padding, padding, 0)); backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
// Zentriere das Menü // Zentriere das Menü
buildingPropertyContainer.setLocalTranslation( settingsContainer.setLocalTranslation(
(app.getCamera().getWidth() - buildingPropertyContainer.getPreferredSize().x) / 2, (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + buildingPropertyContainer.getPreferredSize().y) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
8 8
); );
backgroundContainer.setLocalTranslation( backgroundContainer.setLocalTranslation(
(app.getCamera().getWidth() - buildingPropertyContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
(app.getCamera().getHeight() + buildingPropertyContainer.getPreferredSize().y+ padding) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
7 7
); );
app.getGuiNode().attachChild(buildingPropertyContainer); app.getGuiNode().attachChild(settingsContainer);
} }
/** /**
@ -118,7 +118,7 @@ public class BuildingPropertyCard extends Dialog {
@Override @Override
public void close() { public void close() {
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
app.getGuiNode().detachChild(buildingPropertyContainer); // Entferne das Menü app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren app.setSettingsMenuOpen(false); // Menü als geschlossen markieren

View File

@ -16,12 +16,12 @@ import pp.monopoly.client.MonopolyApp;
import pp.monopoly.model.fields.FoodField; import pp.monopoly.model.fields.FoodField;
/** /**
* FoodFieldCard erstellt die Geböudekarte vom Brandl und der Truppenküche * SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
*/ */
public class FoodFieldCard extends Dialog { public class FoodFieldCard extends Dialog {
private final MonopolyApp app; private final MonopolyApp app;
private final Geometry overlayBackground; private final Geometry overlayBackground;
private final Container foodFieldContainer; private final Container settingsContainer;
private final Container backgroundContainer; private final Container backgroundContainer;
private int index = 12; private int index = 12;
@ -41,63 +41,52 @@ public class FoodFieldCard extends Dialog {
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
app.getGuiNode().attachChild(backgroundContainer); app.getGuiNode().attachChild(backgroundContainer);
// Hauptcontainer für die Gebäudekarte // Hauptcontainer für das Menü
foodFieldContainer = new Container(); settingsContainer = new Container();
foodFieldContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f))); settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
// Titel, bestehend aus dynamischen Namen anhand der ID und der Schriftfarbe/größe // Titel
Label settingsTitle = foodFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title"))); Label settingsTitle = settingsContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
settingsTitle.setFontSize(48); settingsTitle.setFontSize(48);
// Text, der auf der Karte steht // Effekt-Sound: Slider und Checkbox
Container propertyValuesContainer = foodFieldContainer.addChild(new Container()); Container propertyValuesContainer = settingsContainer.addChild(new Container());
propertyValuesContainer.addChild(new Label("„Preis: " + field.getPrice() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Preis: " + field.getPrice() + " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Leerzeile propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Leerzeile
propertyValuesContainer.addChild(new Label("„Wenn man Besitzer des", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Wenn man Besitzer des\n" +field.getName()+" ist, so ist die\nMiete 40-mal so hoch, wie\nAugen auf den zwei Würfeln sind.", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label(field.getName()+" ist, so ist die", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Miete 40-mal so hoch, wie", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Augen auf den zwei Würfeln sind.", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Leerzeile propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Leerzeile
propertyValuesContainer.addChild(new Label("„Wenn man Besitzer beider", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Wenn man Besitzer beider \nRestaurants ist, so ist die\nMiete 100-mal so hoch, wie\nAugen auf den zwei Würfeln sind.", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Restaurants ist, so ist die", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Miete 100-mal so hoch, wie", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Augen auf den zwei Würfeln sind.", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Leerzeile propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); // Leerzeile
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
/*
// Beenden-Button // Beenden-Button
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
quitButton.setFontSize(32); quitButton.setFontSize(32);
// Kaufen-Button // Kaufen-Button
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
buyButton.setFontSize(32); buyButton.setFontSize(32);
*/
float padding = 10; // Padding around the settingsContainer for the background float padding = 10; // Padding around the settingsContainer for the background
backgroundContainer.setPreferredSize(foodFieldContainer.getPreferredSize().addLocal(padding, padding, 0)); backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
// Zentriere das Menü // Zentriere das Menü
foodFieldContainer.setLocalTranslation( settingsContainer.setLocalTranslation(
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x) / 2, (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + foodFieldContainer.getPreferredSize().y) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
8 8
); );
backgroundContainer.setLocalTranslation( backgroundContainer.setLocalTranslation(
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
(app.getCamera().getHeight() + foodFieldContainer.getPreferredSize().y+ padding) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
7 7
); );
app.getGuiNode().attachChild(foodFieldContainer); app.getGuiNode().attachChild(settingsContainer);
} }
/** /**
@ -122,7 +111,7 @@ public class FoodFieldCard extends Dialog {
@Override @Override
public void close() { public void close() {
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
app.getGuiNode().detachChild(foodFieldContainer); // Entferne das Menü app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren app.setSettingsMenuOpen(false); // Menü als geschlossen markieren

View File

@ -5,6 +5,7 @@ import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
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.Container; import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label; import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.component.QuadBackgroundComponent;
@ -19,9 +20,9 @@ import pp.monopoly.model.fields.GateField;
public class GateFieldCard extends Dialog { public class GateFieldCard extends Dialog {
private final MonopolyApp app; private final MonopolyApp app;
private final Geometry overlayBackground; private final Geometry overlayBackground;
private final Container gateFieldContainer; private final Container settingsContainer;
private final Container backgroundContainer; private final Container backgroundContainer;
private int index = 5; private int index;
public GateFieldCard(MonopolyApp app) { public GateFieldCard(MonopolyApp app) {
super(app.getDialogManager()); super(app.getDialogManager());
@ -39,58 +40,50 @@ public class GateFieldCard extends Dialog {
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
app.getGuiNode().attachChild(backgroundContainer); app.getGuiNode().attachChild(backgroundContainer);
// Hauptcontainer für die Gebäudekarte // Hauptcontainer für das Menü
gateFieldContainer = new Container(); settingsContainer = new Container();
gateFieldContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0 / 255f, 0 / 255f, 0 / 255f, 1)));
// Titel // Titel
// Die Namen werden dynamisch dem BoardManager entnommen Label settingsTitle = settingsContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
Label settingsTitle = gateFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
settingsTitle.setFontSize(48); settingsTitle.setFontSize(48);
settingsTitle.setColor(ColorRGBA.Black); settingsTitle.setColor(ColorRGBA.Black);
// Text, der auf der Karte steht
// Die Preise werden dynamisch dem BoardManager entnommen // Effekt-Sound: Slider und Checkbox
Container propertyValuesContainer = gateFieldContainer.addChild(new Container()); Container propertyValuesContainer = settingsContainer.addChild(new Container());
propertyValuesContainer.addChild(new Label("„Preis: " + field.getPrice() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Preis: " + field.getPrice() + " EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Miete:", new ElementId("label-Text")));//TODO Variable hier einsetzen
propertyValuesContainer.addChild(new Label("Wenn man 1 Bahnhof besitzt: 250 EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Wenn man 2 Bahnhöfe besitzt: 500 EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Wenn man 3 Bahnhöfe besitzt: 1000 EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("Wenn man 4 Bahnhöfe besitzt: 2000 EUR", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
/*
// Beenden-Button // Beenden-Button
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
quitButton.setFontSize(32); quitButton.setFontSize(32);
// Kaufen-Button // Kaufen-Button
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
buyButton.setFontSize(32); buyButton.setFontSize(32);
*/
float padding = 10; // Padding around the settingsContainer for the background float padding = 10; // Padding around the settingsContainer for the background
backgroundContainer.setPreferredSize(gateFieldContainer.getPreferredSize().addLocal(padding, padding, 0)); backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
// Zentriere das Menü // Zentriere das Menü
gateFieldContainer.setLocalTranslation( settingsContainer.setLocalTranslation(
(app.getCamera().getWidth() - gateFieldContainer.getPreferredSize().x) / 2, (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + gateFieldContainer.getPreferredSize().y) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
8 8
); );
backgroundContainer.setLocalTranslation( backgroundContainer.setLocalTranslation(
(app.getCamera().getWidth() - gateFieldContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
(app.getCamera().getHeight() + gateFieldContainer.getPreferredSize().y+ padding) / 2, (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
7 7
); );
app.getGuiNode().attachChild(gateFieldContainer); app.getGuiNode().attachChild(settingsContainer);
} }
/** /**
@ -115,7 +108,7 @@ public class GateFieldCard extends Dialog {
@Override @Override
public void close() { public void close() {
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
app.getGuiNode().detachChild(gateFieldContainer); // Entferne das Menü app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren app.setSettingsMenuOpen(false); // Menü als geschlossen markieren

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB