mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 21:19:44 +01:00
BuildingPropertyCard adjusted
This commit is contained in:
parent
9a6ce27fe1
commit
225a8c0e08
@ -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 (gateField != null && isBuyCardPopupOpen) {
|
if (buyCard != null && isBuyCardPopupOpen) {
|
||||||
// Schließe das SettingsMenu
|
// Schließe das SettingsMenu
|
||||||
System.out.println("Schließe BuyCardPopup...");
|
System.out.println("Schließe BuyCardPopup...");
|
||||||
gateField.close();
|
buyCard.close();
|
||||||
gateField = null;
|
buyCard = null;
|
||||||
setBuyCardPopupOpen(false);
|
setBuyCardPopupOpen(false);
|
||||||
} else {
|
} else {
|
||||||
// Öffne das SettingsMenu
|
// Öffne das SettingsMenu
|
||||||
System.out.println("Öffne BuyCardPopup...");
|
System.out.println("Öffne BuyCardPopup...");
|
||||||
gateField = new GateFieldCard(this);
|
buyCard = new BuyCard(this);
|
||||||
gateField.open();
|
buyCard.open();
|
||||||
setBuyCardPopupOpen(true);
|
setBuyCardPopupOpen(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class BuildingPropertyCard extends Dialog {
|
|||||||
private final Geometry overlayBackground;
|
private final Geometry overlayBackground;
|
||||||
private final Container buildingPropertyContainer;
|
private final Container buildingPropertyContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
private int index = 39;
|
private int index = 37;
|
||||||
|
|
||||||
public BuildingPropertyCard(MonopolyApp app) {
|
public BuildingPropertyCard(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
|
@ -3,7 +3,6 @@ package pp.monopoly.client.gui.popups;
|
|||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.material.RenderState.BlendMode;
|
import com.jme3.material.RenderState.BlendMode;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
|
||||||
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.*;
|
import com.simsilica.lemur.*;
|
||||||
@ -11,6 +10,7 @@ import com.simsilica.lemur.component.QuadBackgroundComponent;
|
|||||||
import com.simsilica.lemur.style.ElementId;
|
import com.simsilica.lemur.style.ElementId;
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
import pp.monopoly.model.fields.BuildingProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||||
@ -18,13 +18,18 @@ import pp.monopoly.client.MonopolyApp;
|
|||||||
public class BuyCard extends Dialog {
|
public class BuyCard 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 buyCardContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
|
|
||||||
|
private int index = 37;
|
||||||
|
|
||||||
public BuyCard(MonopolyApp app) {
|
public BuyCard(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
|
//Generate the corresponfing field
|
||||||
|
BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index);
|
||||||
|
|
||||||
// Halbtransparentes Overlay hinzufügen
|
// Halbtransparentes Overlay hinzufügen
|
||||||
overlayBackground = createOverlayBackground();
|
overlayBackground = createOverlayBackground();
|
||||||
app.getGuiNode().attachChild(overlayBackground);
|
app.getGuiNode().attachChild(overlayBackground);
|
||||||
@ -34,52 +39,55 @@ public class BuyCard 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();
|
buyCardContainer = new Container();
|
||||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
buyCardContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor()));
|
||||||
|
|
||||||
|
|
||||||
|
Label settingsTitle = buyCardContainer.addChild(new Label( field.getName(), new ElementId("settings-title")));
|
||||||
// Titel
|
|
||||||
Label settingsTitle = settingsContainer.addChild(new Label("Gebäude 30", new ElementId("settings-title"))); //TODO Dynamische Gebäudezahl einfügen
|
|
||||||
settingsTitle.setFontSize(48);
|
settingsTitle.setFontSize(48);
|
||||||
|
|
||||||
int i = 0;
|
// Text, der auf der Karte steht
|
||||||
int a = 10;
|
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||||
int b = -45;
|
Container propertyValuesContainer = buyCardContainer.addChild(new Container());
|
||||||
|
propertyValuesContainer.addChild(new Label("„Grundstückswert: " + field.getPrice() + " EUR", new ElementId("label-Text")));
|
||||||
// Effekt-Sound: Slider und Checkbox
|
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
|
||||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
propertyValuesContainer.addChild(new Label("„Miete allein: " + field.getAllRent().get(0)+ " EUR", new ElementId("label-Text")));
|
||||||
propertyValuesContainer.addChild(new Label("„Preis:" + i, new ElementId("label-Text")));//TODO Variable hier einsetzen
|
propertyValuesContainer.addChild(new Label("„-mit 1 Haus: " + field.getAllRent().get(1) + " EUR", new ElementId("label-Text")));
|
||||||
propertyValuesContainer.addChild(new Label("„Miete:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen
|
propertyValuesContainer.addChild(new Label("„-mit 2 Häuser: " + field.getAllRent().get(2) + " EUR", new ElementId("label-Text")));
|
||||||
propertyValuesContainer.addChild(new Label("„Hypothek:" + b, new ElementId("label-Text")));//TODO Variable hier einsetzen
|
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("", 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)));
|
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||||
|
|
||||||
// Beenden-Button
|
// Beenden-Button
|
||||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
Button quitButton = buyCardContainer.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 = buyCardContainer.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(buyCardContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||||
|
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
settingsContainer.setLocalTranslation(
|
buyCardContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y) / 2,
|
||||||
8
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
7
|
||||||
);
|
);
|
||||||
|
|
||||||
app.getGuiNode().attachChild(settingsContainer);
|
app.getGuiNode().attachChild(buyCardContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,7 +112,7 @@ public class BuyCard 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(buyCardContainer); // 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