food field dynamic value allocation

This commit is contained in:
Johannes Schmelz 2024-11-23 17:54:11 +01:00
parent 44c55ce3a6
commit b24c14900c

View File

@ -10,8 +10,12 @@ 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;
import com.simsilica.lemur.style.ElementId; import com.simsilica.lemur.style.ElementId;
import groovyjarjarantlr4.v4.parse.ANTLRParser.prequelConstruct_return;
import pp.dialog.Dialog; import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp; import pp.monopoly.client.MonopolyApp;
import pp.monopoly.model.fields.BuildingProperty;
import pp.monopoly.model.fields.FoodField;
/** /**
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann. * SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
@ -21,11 +25,15 @@ public class FoodFieldCard extends Dialog {
private final Geometry overlayBackground; private final Geometry overlayBackground;
private final Container settingsContainer; private final Container settingsContainer;
private final Container backgroundContainer; private final Container backgroundContainer;
private int index = 12;
public FoodFieldCard(MonopolyApp app) { public FoodFieldCard(MonopolyApp app) {
super(app.getDialogManager()); super(app.getDialogManager());
this.app = app; this.app = app;
//Generate the corresponfing field
FoodField field = (FoodField) app.getBoardManager().getFieldAtIndex(index);
// Halbtransparentes Overlay hinzufügen // Halbtransparentes Overlay hinzufügen
overlayBackground = createOverlayBackground(); overlayBackground = createOverlayBackground();
app.getGuiNode().attachChild(overlayBackground); app.getGuiNode().attachChild(overlayBackground);
@ -42,18 +50,14 @@ public class FoodFieldCard extends Dialog {
// Titel // 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.setFontSize(48);
int i = 0;
int a = 10;
int b = -45;
// Effekt-Sound: Slider und Checkbox // Effekt-Sound: Slider und Checkbox
Container propertyValuesContainer = settingsContainer.addChild(new Container()); Container propertyValuesContainer = settingsContainer.addChild(new Container());
propertyValuesContainer.addChild(new Label("„Preis:" + i, new ElementId("label-Text")));//TODO Variable hier einsetzen propertyValuesContainer.addChild(new Label("„Preis:" + field.getPrice(), new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("„Miete:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen propertyValuesContainer.addChild(new Label("„Miete:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen
propertyValuesContainer.addChild(new Label("„Hypothek:" + b, new ElementId("label-Text")));//TODO Variable hier einsetzen propertyValuesContainer.addChild(new Label("„Hypothek:" + field.getHypo(), 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)));
// Beenden-Button // Beenden-Button
@ -113,5 +117,8 @@ public class FoodFieldCard extends Dialog {
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
} }
public void setIndex(int index) {
this.index = index;
}
} }