mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 20:09:45 +01:00
Compare commits
No commits in common. "e7a680248854be09de88f4eb26924dae83ff044c" and "9a6ce27fe13559159a298122fd12d2de0dd48e44" have entirely different histories.
e7a6802488
...
9a6ce27fe1
@ -17,7 +17,10 @@ import pp.dialog.DialogBuilder;
|
||||
import pp.dialog.DialogManager;
|
||||
import pp.graphics.Draw;
|
||||
import pp.monopoly.client.gui.*;
|
||||
import pp.monopoly.client.gui.popups.*;
|
||||
import pp.monopoly.client.gui.popups.BuildingPropertyCard;
|
||||
import pp.monopoly.client.gui.popups.BuyCard;
|
||||
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
||||
import pp.monopoly.client.gui.popups.GateFieldCard;
|
||||
import pp.monopoly.game.client.ClientGameLogic;
|
||||
import pp.monopoly.game.client.MonopolyClient;
|
||||
import pp.monopoly.game.client.ServerConnection;
|
||||
@ -46,7 +49,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
|
||||
// TODO Temp später entfernen
|
||||
|
||||
private EventCard eventCard;
|
||||
private BuildingPropertyCard buildingProperty;
|
||||
private FoodFieldCard foodField;
|
||||
private GateFieldCard gateField;
|
||||
@ -158,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
|
||||
private void handleB(boolean isPressed) {
|
||||
if (isPressed) {
|
||||
if (eventCard != null && isBuyCardPopupOpen) {
|
||||
if (gateField != null && isBuyCardPopupOpen) {
|
||||
// Schließe das SettingsMenu
|
||||
System.out.println("Schließe BuyCardPopup...");
|
||||
eventCard.close();
|
||||
eventCard = null;
|
||||
gateField.close();
|
||||
gateField = null;
|
||||
setBuyCardPopupOpen(false);
|
||||
} else {
|
||||
// Öffne das SettingsMenu
|
||||
System.out.println("Öffne BuyCardPopup...");
|
||||
eventCard = new EventCard(this);
|
||||
eventCard.open();
|
||||
gateField = new GateFieldCard(this);
|
||||
gateField.open();
|
||||
setBuyCardPopupOpen(true);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class BuildingPropertyCard extends Dialog {
|
||||
private final Geometry overlayBackground;
|
||||
private final Container buildingPropertyContainer;
|
||||
private final Container backgroundContainer;
|
||||
private int index = 37;
|
||||
private int index = 39;
|
||||
|
||||
public BuildingPropertyCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
@ -121,7 +121,7 @@ public class BuildingPropertyCard extends Dialog {
|
||||
app.getGuiNode().detachChild(buildingPropertyContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package pp.monopoly.client.gui.popups;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.simsilica.lemur.*;
|
||||
@ -10,7 +11,6 @@ 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;
|
||||
|
||||
/**
|
||||
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||
@ -18,18 +18,13 @@ import pp.monopoly.model.fields.BuildingProperty;
|
||||
public class BuyCard extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Geometry overlayBackground;
|
||||
private final Container buyCardContainer;
|
||||
private final Container settingsContainer;
|
||||
private final Container backgroundContainer;
|
||||
|
||||
private int index = 37;
|
||||
|
||||
public BuyCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
//Generate the corresponfing field
|
||||
BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index);
|
||||
|
||||
// Halbtransparentes Overlay hinzufügen
|
||||
overlayBackground = createOverlayBackground();
|
||||
app.getGuiNode().attachChild(overlayBackground);
|
||||
@ -39,55 +34,52 @@ public class BuyCard extends Dialog {
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
app.getGuiNode().attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für die Gebäudekarte
|
||||
buyCardContainer = new Container();
|
||||
buyCardContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor()));
|
||||
// Hauptcontainer für das Menü
|
||||
settingsContainer = new Container();
|
||||
settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f)));
|
||||
|
||||
|
||||
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);
|
||||
|
||||
// Text, der auf der Karte steht
|
||||
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||
Container propertyValuesContainer = buyCardContainer.addChild(new Container());
|
||||
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("„-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("", new ElementId("label-Text")));// Leerzeile
|
||||
propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text")));
|
||||
int i = 0;
|
||||
int a = 10;
|
||||
int b = -45;
|
||||
|
||||
// Effekt-Sound: Slider und Checkbox
|
||||
Container propertyValuesContainer = settingsContainer.addChild(new Container());
|
||||
propertyValuesContainer.addChild(new Label("„Preis:" + i, 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.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
|
||||
// Beenden-Button
|
||||
Button quitButton = buyCardContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
// Kaufen-Button
|
||||
Button buyButton = buyCardContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
buyButton.setFontSize(32);
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
backgroundContainer.setPreferredSize(buyCardContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
buyCardContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y) / 2,
|
||||
settingsContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2,
|
||||
8
|
||||
);
|
||||
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y+ padding) / 2,
|
||||
(app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2,
|
||||
7
|
||||
);
|
||||
|
||||
app.getGuiNode().attachChild(buyCardContainer);
|
||||
app.getGuiNode().attachChild(settingsContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,11 +104,13 @@ public class BuyCard extends Dialog {
|
||||
@Override
|
||||
public void close() {
|
||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||
app.getGuiNode().detachChild(buyCardContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,119 +0,0 @@
|
||||
package pp.monopoly.client.gui.popups;
|
||||
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.simsilica.lemur.Button;
|
||||
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;
|
||||
|
||||
/**
|
||||
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
|
||||
*/
|
||||
public class EventCard extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Geometry overlayBackground;
|
||||
private final Container eventCardContainer;
|
||||
private final Container backgroundContainer;
|
||||
|
||||
private int index = 37;
|
||||
|
||||
public EventCard(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
//Generate the corresponfing field
|
||||
BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index);
|
||||
|
||||
// Halbtransparentes Overlay hinzufügen
|
||||
overlayBackground = createOverlayBackground();
|
||||
app.getGuiNode().attachChild(overlayBackground);
|
||||
|
||||
// Create the background container
|
||||
backgroundContainer = new Container();
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
app.getGuiNode().attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für die Gebäudekarte
|
||||
eventCardContainer = new Container();
|
||||
eventCardContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f)));
|
||||
|
||||
// Titel
|
||||
// Die Namen werden dynamisch dem BoardManager entnommen
|
||||
Label gateFieldTitle = eventCardContainer.addChild(new Label("Ereigniskarte", new ElementId("settings-title")));
|
||||
gateFieldTitle.setFontSize(48);
|
||||
gateFieldTitle.setColor(ColorRGBA.Black);
|
||||
|
||||
// Text, der auf der Karte steht
|
||||
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||
Container propertyValuesContainer = eventCardContainer.addChild(new Container());
|
||||
propertyValuesContainer.addChild(new Label("Hier könnte ihre Beschreibung stehen ", new ElementId("label-Text")));
|
||||
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
|
||||
// Beenden-Button
|
||||
Button quitButton = eventCardContainer.addChild(new Button("Jawohl", new ElementId("button")));
|
||||
quitButton.setFontSize(32);
|
||||
quitButton.addClickCommands(source -> close());
|
||||
|
||||
|
||||
// TODO Kaufen-Button wird nicht mehr benötigt, prüfen ob weg kann
|
||||
//Button buyButton = buyCardContainer.addChild(new Button("Kaufen", new ElementId("button")));
|
||||
//buyButton.setFontSize(32);
|
||||
|
||||
float padding = 10; // Padding around the settingsContainer for the background
|
||||
backgroundContainer.setPreferredSize(eventCardContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
|
||||
// Zentriere das Menü
|
||||
eventCardContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y) / 2,
|
||||
8
|
||||
);
|
||||
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y+ padding) / 2,
|
||||
7
|
||||
);
|
||||
|
||||
app.getGuiNode().attachChild(eventCardContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt einen halbtransparenten Hintergrund für das Menü.
|
||||
*
|
||||
* @return Geometrie des Overlays
|
||||
*/
|
||||
private Geometry createOverlayBackground() {
|
||||
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
||||
Geometry overlay = new Geometry("Overlay", quad);
|
||||
Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
material.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f)); // Halbtransparent
|
||||
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
|
||||
overlay.setMaterial(material);
|
||||
overlay.setLocalTranslation(0, 0, 0);
|
||||
return overlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schließt das Menü und entfernt die GUI-Elemente.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe
|
||||
app.getGuiNode().detachChild(eventCardContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setBuyCardPopupOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp
|
||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
|
||||
}
|
||||
}
|
@ -125,7 +125,7 @@ public class FoodFieldCard extends Dialog {
|
||||
app.getGuiNode().detachChild(foodFieldContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ public class GateFieldCard extends Dialog {
|
||||
|
||||
// Titel
|
||||
// Die Namen werden dynamisch dem BoardManager entnommen
|
||||
Label gateFieldTitle = gateFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||
gateFieldTitle.setFontSize(48);
|
||||
gateFieldTitle.setColor(ColorRGBA.Black);
|
||||
Label settingsTitle = gateFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title")));
|
||||
settingsTitle.setFontSize(48);
|
||||
settingsTitle.setColor(ColorRGBA.Black);
|
||||
|
||||
// Text, der auf der Karte steht
|
||||
// Die Preise werden dynamisch dem BoardManager entnommen
|
||||
@ -118,7 +118,7 @@ public class GateFieldCard extends Dialog {
|
||||
app.getGuiNode().detachChild(gateFieldContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp
|
||||
app.setSettingsMenuOpen(false); // Menü als geschlossen markieren
|
||||
app.unblockInputs(); // Eingaben wieder aktivieren
|
||||
System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe
|
||||
}
|
||||
|
@ -168,7 +168,6 @@ public class Player implements FieldVisitor<Void>{
|
||||
public void buyProperty(PropertyField property) {
|
||||
if (property.getOwner() == null && accountBalance >= property.getPrice()) {
|
||||
properties.add(property);
|
||||
property.setOwner(this);
|
||||
pay(property.getPrice());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user