mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 21:39: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
46d2dce372
@ -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
|
||||
private void handleB(boolean isPressed) {
|
||||
if (isPressed) {
|
||||
if (foodField != null && isBuyCardPopupOpen) {
|
||||
if (gateField != null && isBuyCardPopupOpen) {
|
||||
// Schließe das SettingsMenu
|
||||
System.out.println("Schließe BuyCardPopup...");
|
||||
foodField.close();
|
||||
foodField = null;
|
||||
gateField.close();
|
||||
gateField = null;
|
||||
setBuyCardPopupOpen(false);
|
||||
} else {
|
||||
// Öffne das SettingsMenu
|
||||
System.out.println("Öffne BuyCardPopup...");
|
||||
foodField = new FoodFieldCard(this);
|
||||
foodField.open();
|
||||
gateField = new GateFieldCard(this);
|
||||
gateField.open();
|
||||
setBuyCardPopupOpen(true);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.jme3.scene.shape.Sphere;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.Axis;
|
||||
import com.simsilica.lemur.Button;
|
||||
@ -30,7 +31,6 @@ public class LobbyMenu {
|
||||
private final MonopolyApp app;
|
||||
private final Container menuContainer;
|
||||
private Geometry background;
|
||||
private final Selector<String> dropdown;
|
||||
|
||||
public LobbyMenu(MonopolyApp app) {
|
||||
this.app = app;
|
||||
@ -50,11 +50,11 @@ public class LobbyMenu {
|
||||
|
||||
// Create a smaller horizontal container for the label, input field, and spacers
|
||||
Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
|
||||
horizontalContainer.setPreferredSize(new Vector3f(600, 50, 0)); // Adjust container size
|
||||
horizontalContainer.setPreferredSize(new Vector3f(600, 40, 0)); // Adjust container size
|
||||
horizontalContainer.setBackground(null);
|
||||
|
||||
Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold")));
|
||||
title.setFontSize(48);
|
||||
title.setFontSize(40);
|
||||
|
||||
// Add a spacer between the title and the input field
|
||||
Label spacerBeforeInput = horizontalContainer.addChild(new Label("")); // Invisible spacer
|
||||
@ -77,40 +77,81 @@ public class LobbyMenu {
|
||||
);
|
||||
app.getGuiNode().attachChild(menuContainer);
|
||||
|
||||
// Spielerstatus anzeigen
|
||||
Container playerListContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
|
||||
playerListContainer.addChild(new Label("Spieler in der Lobby:"));
|
||||
playerListContainer.setBackground(null);
|
||||
Label playersLabel = playerListContainer.addChild(new Label("Noch keine Spieler verbunden.")); // Beispieltext
|
||||
|
||||
VersionedList<String> items = new VersionedList<>();
|
||||
items.add("Alpha");
|
||||
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);
|
||||
// Dropdowns and Labels
|
||||
Container dropdownContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
|
||||
dropdownContainer.setPreferredSize(new Vector3f(800, 200, 0));
|
||||
dropdownContainer.setBackground(null);
|
||||
dropdownContainer.setInsets(new Insets3f(10, 0, 0, 0));
|
||||
// Player Input Field
|
||||
Container playerInputContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X)));
|
||||
playerInputContainer.addChild(new Label("Spieler:"));
|
||||
playerInputContainer.setBackground(null);
|
||||
|
||||
|
||||
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)));
|
||||
buttonContainer.setPreferredSize(new Vector3f(400, 50, 0));
|
||||
buttonContainer.setPreferredSize(new Vector3f(100, 40, 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);
|
||||
|
||||
// "Bereit"-Button
|
||||
Button readyButton = buttonContainer.addChild(new Button("Bereit"));
|
||||
readyButton.setPreferredSize(new Vector3f(120, 40, 0));
|
||||
readyButton.addClickCommands(source -> toggleReady(playersLabel));
|
||||
// Position the container near the bottom-left corner
|
||||
lowerLeftMenu.setLocalTranslation(new Vector3f(120, 170, 3)); // Adjust X and Y to align with the bottom-left corner
|
||||
app.getGuiNode().attachChild(lowerLeftMenu);
|
||||
|
||||
// "Zurück"-Button
|
||||
Button backButton = buttonContainer.addChild(new Button("Zurück"));
|
||||
backButton.setPreferredSize(new Vector3f(120, 40, 0));
|
||||
backButton.addClickCommands(source -> goBackToCreateGame());
|
||||
// Lower-right container for "Bereit" button
|
||||
Container lowerRightMenu = new Container();
|
||||
Button readyButton = new Button("Bereit");
|
||||
readyButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
|
||||
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
|
||||
menuContainer.setLocalTranslation(
|
||||
@ -122,11 +163,12 @@ public class LobbyMenu {
|
||||
app.getGuiNode().attachChild(menuContainer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu.
|
||||
*/
|
||||
private void addBackgroundImage() {
|
||||
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
|
||||
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/lobby.png");
|
||||
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
||||
background = new Geometry("Background", quad);
|
||||
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
@ -137,6 +179,19 @@ public class LobbyMenu {
|
||||
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.
|
||||
*/
|
||||
|
@ -5,7 +5,6 @@ import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
@ -22,15 +21,14 @@ import pp.monopoly.model.fields.BuildingProperty;
|
||||
public class BuildingPropertyCard extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Geometry overlayBackground;
|
||||
private final Container settingsContainer;
|
||||
private final Container buildingPropertyContainer;
|
||||
private final Container backgroundContainer;
|
||||
private int index = 23;
|
||||
private int index = 39;
|
||||
|
||||
public BuildingPropertyCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
// Titel
|
||||
//Generate the corresponfing field
|
||||
BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index);
|
||||
|
||||
@ -43,22 +41,19 @@ public class BuildingPropertyCard extends Dialog {
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
app.getGuiNode().attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für das Menü
|
||||
settingsContainer = new Container();
|
||||
//settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(170 / 255f, 223 / 255f, 246 / 255f, 1))); // hell
|
||||
settingsContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor())); //dunkel
|
||||
// Hauptcontainer für die Gebäudekarte
|
||||
buildingPropertyContainer = new Container();
|
||||
buildingPropertyContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Label settingsTitle = settingsContainer.addChild(new Label( field.getName(), new ElementId("settings-title")));
|
||||
Label settingsTitle = buildingPropertyContainer.addChild(new Label( field.getName(), new ElementId("settings-title")));
|
||||
settingsTitle.setFontSize(48);
|
||||
|
||||
// Effekt-Sound: Slider und Checkbox
|
||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
||||
// Text, der auf der Karte steht
|
||||
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||
Container propertyValuesContainer = buildingPropertyContainer.addChild(new Container());
|
||||
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("„-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")));
|
||||
@ -66,34 +61,39 @@ 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 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("", new ElementId("label-Text")));// Leerzeile
|
||||
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)));
|
||||
|
||||
//TODO eventuell diese Stelle löschen, da nur die BuyCard Kaufen und beenden hat
|
||||
|
||||
/*
|
||||
// Beenden-Button
|
||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
// Kaufen-Button
|
||||
Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
*/
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
backgroundContainer.setPreferredSize(buildingPropertyContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
settingsContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
||||
buildingPropertyContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - buildingPropertyContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + buildingPropertyContainer.getPreferredSize().y) / 2,
|
||||
8
|
||||
);
|
||||
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
||||
(app.getCamera().getWidth() - buildingPropertyContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + buildingPropertyContainer.getPreferredSize().y+ padding) / 2,
|
||||
7
|
||||
);
|
||||
|
||||
app.getGuiNode().attachChild(settingsContainer);
|
||||
app.getGuiNode().attachChild(buildingPropertyContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,7 +118,7 @@ public class BuildingPropertyCard extends Dialog {
|
||||
@Override
|
||||
public void close() {
|
||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(buildingPropertyContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
|
@ -16,12 +16,12 @@ import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.model.fields.FoodField;
|
||||
|
||||
/**
|
||||
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||
* FoodFieldCard erstellt die Geböudekarte vom Brandl und der Truppenküche
|
||||
*/
|
||||
public class FoodFieldCard extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Geometry overlayBackground;
|
||||
private final Container settingsContainer;
|
||||
private final Container foodFieldContainer;
|
||||
private final Container backgroundContainer;
|
||||
private int index = 12;
|
||||
|
||||
@ -41,52 +41,63 @@ public class FoodFieldCard extends Dialog {
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
app.getGuiNode().attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für das Menü
|
||||
settingsContainer = new Container();
|
||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
||||
// Hauptcontainer für die Gebäudekarte
|
||||
foodFieldContainer = new Container();
|
||||
foodFieldContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
||||
|
||||
|
||||
|
||||
// Titel
|
||||
Label settingsTitle = settingsContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||
// Titel, bestehend aus dynamischen Namen anhand der ID und der Schriftfarbe/größe
|
||||
Label settingsTitle = foodFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||
settingsTitle.setFontSize(48);
|
||||
|
||||
// Effekt-Sound: Slider und Checkbox
|
||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
||||
// Text, der auf der Karte steht
|
||||
Container propertyValuesContainer = foodFieldContainer.addChild(new Container());
|
||||
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("„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("„Wenn man Besitzer des", 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("„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("„Wenn man Besitzer beider", 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("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
||||
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
|
||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
// Kaufen-Button
|
||||
Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
*/
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
backgroundContainer.setPreferredSize(foodFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
settingsContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
||||
foodFieldContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + foodFieldContainer.getPreferredSize().y) / 2,
|
||||
8
|
||||
);
|
||||
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
||||
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + foodFieldContainer.getPreferredSize().y+ padding) / 2,
|
||||
7
|
||||
);
|
||||
|
||||
app.getGuiNode().attachChild(settingsContainer);
|
||||
app.getGuiNode().attachChild(foodFieldContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +122,7 @@ public class FoodFieldCard extends Dialog {
|
||||
@Override
|
||||
public void close() {
|
||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(foodFieldContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
|
@ -5,7 +5,6 @@ import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
@ -20,9 +19,9 @@ import pp.monopoly.model.fields.GateField;
|
||||
public class GateFieldCard extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Geometry overlayBackground;
|
||||
private final Container settingsContainer;
|
||||
private final Container gateFieldContainer;
|
||||
private final Container backgroundContainer;
|
||||
private int index;
|
||||
private int index = 5;
|
||||
|
||||
public GateFieldCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
@ -40,50 +39,58 @@ public class GateFieldCard extends Dialog {
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
app.getGuiNode().attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für das Menü
|
||||
settingsContainer = new Container();
|
||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0 / 255f, 0 / 255f, 0 / 255f, 1)));
|
||||
|
||||
|
||||
// Hauptcontainer für die Gebäudekarte
|
||||
gateFieldContainer = new Container();
|
||||
gateFieldContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f)));
|
||||
|
||||
// Titel
|
||||
Label settingsTitle = settingsContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||
// Die Namen werden dynamisch dem BoardManager entnommen
|
||||
Label settingsTitle = gateFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||
settingsTitle.setFontSize(48);
|
||||
settingsTitle.setColor(ColorRGBA.Black);
|
||||
|
||||
|
||||
// Effekt-Sound: Slider und Checkbox
|
||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
||||
// Text, der auf der Karte steht
|
||||
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||
Container propertyValuesContainer = gateFieldContainer.addChild(new Container());
|
||||
propertyValuesContainer.addChild(new Label("„Preis: " + field.getPrice() + " EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("„Miete:", new ElementId("label-Text")));//TODO Variable hier einsetzen
|
||||
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));
|
||||
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.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
|
||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
// Kaufen-Button
|
||||
Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
*/
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
backgroundContainer.setPreferredSize(gateFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
settingsContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
||||
gateFieldContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - gateFieldContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + gateFieldContainer.getPreferredSize().y) / 2,
|
||||
8
|
||||
);
|
||||
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
||||
(app.getCamera().getWidth() - gateFieldContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + gateFieldContainer.getPreferredSize().y+ padding) / 2,
|
||||
7
|
||||
);
|
||||
|
||||
app.getGuiNode().attachChild(settingsContainer);
|
||||
app.getGuiNode().attachChild(gateFieldContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +115,7 @@ public class GateFieldCard extends Dialog {
|
||||
@Override
|
||||
public void close() {
|
||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(gateFieldContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
|
BIN
Projekte/monopoly/client/src/main/resources/Pictures/lobby.png
Normal file
BIN
Projekte/monopoly/client/src/main/resources/Pictures/lobby.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 MiB |
Loading…
Reference in New Issue
Block a user