dynamically allocate values

This commit is contained in:
Johannes Schmelz 2024-11-23 17:58:17 +01:00
parent b24c14900c
commit 62ec6f6bef

View File

@ -12,6 +12,7 @@ import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.model.fields.GateField;
/**
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
@ -21,11 +22,15 @@ public class GateFieldCard extends Dialog {
private final Geometry overlayBackground;
private final Container settingsContainer;
private final Container backgroundContainer;
private int index;
public GateFieldCard(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
//Generate the corresponfing field
GateField field = (GateField) app.getBoardManager().getFieldAtIndex(index);
// Halbtransparentes Overlay hinzufügen
overlayBackground = createOverlayBackground();
app.getGuiNode().attachChild(overlayBackground);
@ -42,16 +47,16 @@ public class GateFieldCard extends Dialog {
// Titel
Label settingsTitle = settingsContainer.addChild(new Label("Gebäude 30", new ElementId("settings-title"))); //TODO Dynamische Gebäudezahl einfügen
Label settingsTitle = settingsContainer.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());
propertyValuesContainer.addChild(new Label("„Preis:", new ElementId("label-Text")));//TODO Variable hier einsetzen
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("„Hypothek:", new ElementId("label-Text")));//TODO Variable hier einsetzen
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)));
// Beenden-Button
@ -111,5 +116,7 @@ public class GateFieldCard extends Dialog {
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
}
public void setIndex(int index) {
this.index = index;
}
}