mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 22:49:44 +01:00
GateField korrigiert
This commit is contained in:
parent
748226f4ed
commit
ecba1c3135
@ -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 (foodField != null && isBuyCardPopupOpen) {
|
if (gateField != null && isBuyCardPopupOpen) {
|
||||||
// Schließe das SettingsMenu
|
// Schließe das SettingsMenu
|
||||||
System.out.println("Schließe BuyCardPopup...");
|
System.out.println("Schließe BuyCardPopup...");
|
||||||
foodField.close();
|
gateField.close();
|
||||||
foodField = null;
|
gateField = null;
|
||||||
setBuyCardPopupOpen(false);
|
setBuyCardPopupOpen(false);
|
||||||
} else {
|
} else {
|
||||||
// Öffne das SettingsMenu
|
// Öffne das SettingsMenu
|
||||||
System.out.println("Öffne BuyCardPopup...");
|
System.out.println("Öffne BuyCardPopup...");
|
||||||
foodField = new FoodFieldCard(this);
|
gateField = new GateFieldCard(this);
|
||||||
foodField.open();
|
gateField.open();
|
||||||
setBuyCardPopupOpen(true);
|
setBuyCardPopupOpen(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ 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;
|
||||||
@ -22,15 +21,14 @@ 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 settingsContainer;
|
private final Container buildingPropertyContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
private int index = 23;
|
private int index = 39;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -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
|
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 das Menü
|
// Hauptcontainer für die Gebäudekarte
|
||||||
settingsContainer = new Container();
|
buildingPropertyContainer = new Container();
|
||||||
//settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(170 / 255f, 223 / 255f, 246 / 255f, 1))); // hell
|
buildingPropertyContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor()));
|
||||||
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);
|
||||||
|
|
||||||
// Effekt-Sound: Slider und Checkbox
|
// Text, der auf der Karte steht
|
||||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
// 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("„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")));
|
||||||
@ -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 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 = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
// Kaufen-Button
|
// 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);
|
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(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
backgroundContainer.setPreferredSize(buildingPropertyContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
settingsContainer.setLocalTranslation(
|
buildingPropertyContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - buildingPropertyContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + buildingPropertyContainer.getPreferredSize().y) / 2,
|
||||||
8
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - buildingPropertyContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + buildingPropertyContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
7
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(settingsContainer);
|
app.getGuiNode().attachChild(buildingPropertyContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -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(settingsContainer); // Entferne das Menü
|
app.getGuiNode().detachChild(buildingPropertyContainer); // 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
|
||||||
|
@ -16,12 +16,12 @@ import pp.monopoly.client.MonopolyApp;
|
|||||||
import pp.monopoly.model.fields.FoodField;
|
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 {
|
public class FoodFieldCard extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
private final Geometry overlayBackground;
|
private final Geometry overlayBackground;
|
||||||
private final Container settingsContainer;
|
private final Container foodFieldContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
private int index = 12;
|
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
|
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 das Menü
|
// Hauptcontainer für die Gebäudekarte
|
||||||
settingsContainer = new Container();
|
foodFieldContainer = new Container();
|
||||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
foodFieldContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Titel
|
// Titel, bestehend aus dynamischen Namen anhand der ID und der Schriftfarbe/größe
|
||||||
Label settingsTitle = settingsContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
Label settingsTitle = foodFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||||
settingsTitle.setFontSize(48);
|
settingsTitle.setFontSize(48);
|
||||||
|
|
||||||
// Effekt-Sound: Slider und Checkbox
|
// Text, der auf der Karte steht
|
||||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
Container propertyValuesContainer = foodFieldContainer.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\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("", 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("", 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 = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
// Kaufen-Button
|
// 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);
|
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(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
backgroundContainer.setPreferredSize(foodFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
settingsContainer.setLocalTranslation(
|
foodFieldContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + foodFieldContainer.getPreferredSize().y) / 2,
|
||||||
8
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - foodFieldContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + foodFieldContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
7
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(settingsContainer);
|
app.getGuiNode().attachChild(foodFieldContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,7 +122,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(settingsContainer); // Entferne das Menü
|
app.getGuiNode().detachChild(foodFieldContainer); // 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
|
||||||
|
@ -5,7 +5,6 @@ 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;
|
||||||
@ -20,9 +19,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 settingsContainer;
|
private final Container gateFieldContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
private int index;
|
private int index = 5;
|
||||||
|
|
||||||
public GateFieldCard(MonopolyApp app) {
|
public GateFieldCard(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
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
|
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 das Menü
|
// Hauptcontainer für die Gebäudekarte
|
||||||
settingsContainer = new Container();
|
gateFieldContainer = new Container();
|
||||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0 / 255f, 0 / 255f, 0 / 255f, 1)));
|
gateFieldContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Titel
|
// 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.setFontSize(48);
|
||||||
settingsTitle.setColor(ColorRGBA.Black);
|
settingsTitle.setColor(ColorRGBA.Black);
|
||||||
|
|
||||||
|
// 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 = gateFieldContainer.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("„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.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 = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||||
quitButton.setFontSize(32);
|
quitButton.setFontSize(32);
|
||||||
// Kaufen-Button
|
// 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);
|
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(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
backgroundContainer.setPreferredSize(gateFieldContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
settingsContainer.setLocalTranslation(
|
gateFieldContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - gateFieldContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + gateFieldContainer.getPreferredSize().y) / 2,
|
||||||
8
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - gateFieldContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + gateFieldContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
7
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(settingsContainer);
|
app.getGuiNode().attachChild(gateFieldContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +115,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(settingsContainer); // Entferne das Menü
|
app.getGuiNode().detachChild(gateFieldContainer); // 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
|
||||||
|
Loading…
Reference in New Issue
Block a user