event card complete

This commit is contained in:
Johannes Schmelz
2024-11-28 00:07:32 +01:00
parent 9e595b92ba
commit 6d72a94fe4
10 changed files with 66 additions and 35 deletions

View File

@@ -10,12 +10,16 @@ import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.popups.EventCard;
import pp.monopoly.notification.DiceRollEvent;
import pp.monopoly.notification.EventCardEvent;
import pp.monopoly.notification.GameEventListener;
/**
* TestWorld zeigt eine einfache Szene mit einem texturierten Quadrat.
* Die Kamera wird durch den CameraController gesteuert.
*/
public class TestWorld {
public class TestWorld implements GameEventListener{
private final MonopolyApp app;
private CameraController cameraController; // Steuert die Kamera
@@ -28,6 +32,7 @@ public class TestWorld {
*/
public TestWorld(MonopolyApp app) {
this.app = app;
app.getGameLogic().addListener(this);
}
/**
@@ -91,4 +96,9 @@ public class TestWorld {
app.getRootNode().attachChild(geom);
}
@Override
public void receivedEvent(EventCardEvent event) {
new EventCard(app, event.description()).open();
}
}

View File

@@ -195,6 +195,8 @@ public class Toolbar extends Dialog implements GameEventListener{
@Override
public void receivedEvent(UpdatePlayerView event) {
playerHandler = app.getGameLogic().getPlayerHandler();
System.err.println("Update Player View");
// Clear existing accountContainer and overviewContainer content
accountContainer.clearChildren();
overviewContainer.clearChildren();

View File

@@ -14,8 +14,6 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.model.card.Card; // TODO für den Import der Queue notwendig
import pp.monopoly.model.card.DeckHelper;
/**
* SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann.
*/
@@ -24,14 +22,13 @@ public class EventCard extends Dialog {
private final Geometry overlayBackground;
private final Container eventCardContainer;
private final Container backgroundContainer;
private final String description;
public EventCard(MonopolyApp app) {
public EventCard(MonopolyApp app, String description) {
super(app.getDialogManager());
this.app = app;
//Generate the corresponfing field
Card card = new DeckHelper().drawCard(); // TODO nimmt die Karten gerade unabhängig aus dem DeckHelper
this.description = description;
// Halbtransparentes Overlay hinzufügen
overlayBackground = createOverlayBackground();
@@ -56,7 +53,7 @@ public class EventCard extends Dialog {
// Text, der auf der Karte steht
// Die Preise werden dynamisch dem BoardManager entnommen
Container propertyValuesContainer = eventCardContainer.addChild(new Container());
propertyValuesContainer.addChild(new Label(card.getDescription(), new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label(description, new ElementId("label-Text")));
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
propertyValuesContainer.setPreferredSize(new Vector3f(300,200,10));
@@ -114,6 +111,6 @@ public class EventCard extends Dialog {
@Override
public void escape() {
new SettingsMenu(app).open();
close();
}
}