diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java index 2f3d820..5d6b2fd 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java @@ -21,6 +21,7 @@ import pp.monopoly.client.gui.popups.BuyCard; import pp.monopoly.game.client.ClientGameLogic; import pp.monopoly.game.client.MonopolyClient; import pp.monopoly.game.client.ServerConnection; +import pp.monopoly.model.fields.BoardManager; import pp.monopoly.notification.GameEventListener; import pp.monopoly.notification.InfoTextEvent; import pp.monopoly.server.MonopolyServer; @@ -41,10 +42,11 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga private boolean inputBlocked = false; private MonopolyServer monopolyServer; private NetworkSupport networkSupport; + private BoardManager boardManager = new BoardManager(); // TODO Temp später entfernen - private BuildingProperty buildingProperty; + private BuildingPropertyCard buildingProperty; private FoodField foodField; private GateField gateField; private BuyCard buyCard; @@ -85,6 +87,10 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga return logic; } + public BoardManager getBoardManager() { + return boardManager; + } + public NetworkSupport getNetworkSupport() { return networkSupport; } @@ -158,7 +164,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga } else { // Öffne das SettingsMenu System.out.println("Öffne BuyCardPopup..."); - buildingProperty = new BuildingProperty(this); + buildingProperty = new BuildingPropertyCard(this); buildingProperty.open(); setBuyCardPopupOpen(true); } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingProperty.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingPropertyCard.java similarity index 80% rename from Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingProperty.java rename to Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingPropertyCard.java index 2bcf2ad..e13edb0 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingProperty.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingPropertyCard.java @@ -10,22 +10,30 @@ import com.simsilica.lemur.Container; import com.simsilica.lemur.Label; 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.BuildingProperty; /** + * TODO Kommentare fixen * SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann. */ -public class BuildingProperty extends Dialog { +public class BuildingPropertyCard extends Dialog { private final MonopolyApp app; private final Geometry overlayBackground; private final Container settingsContainer; private final Container backgroundContainer; + private int index = 23; - public BuildingProperty(MonopolyApp app) { + public BuildingPropertyCard(MonopolyApp app) { super(app.getDialogManager()); this.app = app; + // Titel + //Generate the corresponfing field + BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index); + // Halbtransparentes Overlay hinzufügen overlayBackground = createOverlayBackground(); app.getGuiNode().attachChild(overlayBackground); @@ -38,30 +46,27 @@ public class BuildingProperty extends Dialog { // 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(new ColorRGBA(2 / 255f, 112 / 255f, 191 / 255f, 1))); //dunkel + settingsContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor())); //dunkel - // Titel - Label settingsTitle = settingsContainer.addChild(new Label("Gebäude Arsch", 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); - int i = 0; - int a = 10; - int b = -45; - // Effekt-Sound: Slider und Checkbox Container propertyValuesContainer = settingsContainer.addChild(new Container()); - propertyValuesContainer.addChild(new Label("„Grundstückswert:" + i, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„Miete allein:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„-mit 1 Haus:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„-mit 2 Häuser:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„-mit 3 Häuser:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„-mit 4 Häuser:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„-mit 1 Hotel:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„-1 Haus kostet:" + 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("„Grundstückswert: " + field.getPrice() + " 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 2 Häuser: " + field.getAllRent().get(2) + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-mit 3 Häuser: " + field.getAllRent().get(3) + " 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("„-1 Haus kostet: " + field.getHousePrice()+ " 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))); // Beenden-Button @@ -120,6 +125,9 @@ public class BuildingProperty extends Dialog { app.unblockInputs(); // Eingaben wieder aktivieren System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe } - + + public void setIndex(int index) { + this.index = index; + } } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java index 3102e25..f0a9bd0 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java @@ -5,7 +5,7 @@ import com.jme3.math.ColorRGBA; /** * Enum representing eight distinct colors for properties in the game. */ -enum FieldColor { +public enum FieldColor { BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)), GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)), YELLOW(new ColorRGBA(252 / 255f, 241 / 255f, 1 / 255f, 1)),