open buy popups

This commit is contained in:
Johannes Schmelz
2024-11-28 22:56:02 +01:00
parent e000dcfc51
commit 1e6188cf24
16 changed files with 133 additions and 41 deletions

View File

@@ -10,10 +10,18 @@ import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.popups.BuyCard;
import pp.monopoly.client.gui.popups.EventCard;
import pp.monopoly.client.gui.popups.FoodFieldCard;
import pp.monopoly.client.gui.popups.GateFieldCard;
import pp.monopoly.model.fields.BuildingProperty;
import pp.monopoly.model.fields.FoodField;
import pp.monopoly.model.fields.GateField;
import pp.monopoly.model.fields.PropertyField;
import pp.monopoly.notification.DiceRollEvent;
import pp.monopoly.notification.EventCardEvent;
import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.PopUpEvent;
/**
* TestWorld zeigt eine einfache Szene mit einem texturierten Quadrat.
@@ -101,4 +109,22 @@ public class TestWorld implements GameEventListener{
public void receivedEvent(EventCardEvent event) {
new EventCard(app, event.description()).open();
}
@Override
public void receivedEvent(PopUpEvent event) {
System.err.println("Trigger ?");
// if (event.desc() == "BuyCard") {
int field = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field);
if (fieldObject instanceof BuildingProperty) {
new BuyCard(app).open();
} else if (fieldObject instanceof GateField){
new GateFieldCard(app).open();
} else if (fieldObject instanceof FoodField) {
new FoodFieldCard(app).open();
}
// }
}
}

View File

@@ -9,7 +9,7 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.message.client.BuyPropertyRequest;
import pp.monopoly.message.client.BuyPropertyResponse;
import pp.monopoly.model.fields.BoardManager;
import pp.monopoly.model.fields.BuildingProperty;
import pp.monopoly.notification.Sound;
@@ -64,6 +64,7 @@ public class BuyCard extends Dialog {
Button quitButton = buyCardContainer.addChild(new Button("Beenden", new ElementId("button")));
quitButton.setFontSize(32);
quitButton.addClickCommands(s -> ifTopDialog(() -> {
System.err.println("Button does something?");
app.getGameLogic().playSound(Sound.BUTTON);
close();
}));
@@ -72,7 +73,8 @@ public class BuyCard extends Dialog {
buyButton.setFontSize(32);
buyButton.addClickCommands(s -> ifTopDialog( () -> {
app.getGameLogic().playSound(Sound.BUTTON);
app.getGameLogic().send(new BuyPropertyRequest());
close();
app.getGameLogic().send(new BuyPropertyResponse());
}));
float padding = 10; // Padding around the settingsContainer for the background

View File

@@ -9,7 +9,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.message.client.BuyPropertyRequest;
import pp.monopoly.notification.Sound;
/**
@@ -72,14 +71,12 @@ public class ConfirmTrade extends Dialog {
negotiateButton.setFontSize(32);
negotiateButton.addClickCommands(s -> ifTopDialog( () -> {
app.getGameLogic().playSound(Sound.BUTTON);
app.getGameLogic().send(new BuyPropertyRequest());
}));
// Kaufen-Button
Button confirmButton = confirmTradeContainer.addChild(new Button("Bestätigen", new ElementId("button"))); //TODO ggf die Buttons Sprachabhängig von den Properties machen
confirmButton.setFontSize(32);
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
app.getGameLogic().playSound(Sound.BUTTON);
app.getGameLogic().send(new BuyPropertyRequest());
}));
float padding = 10; // Padding around the settingsContainer for the background

View File

@@ -14,7 +14,7 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.message.client.BuyPropertyRequest;
import pp.monopoly.message.client.BuyPropertyResponse;
import pp.monopoly.model.fields.FoodField;
import pp.monopoly.notification.Sound;
@@ -83,7 +83,7 @@ public class FoodFieldCard extends Dialog {
buyButton.setFontSize(32);
buyButton.addClickCommands(s -> ifTopDialog( () -> {
app.getGameLogic().playSound(Sound.BUTTON);
app.getGameLogic().send(new BuyPropertyRequest());
app.getGameLogic().send(new BuyPropertyResponse());
}));
float padding = 10; // Padding around the settingsContainer for the background

View File

@@ -13,7 +13,7 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.message.client.BuyPropertyRequest;
import pp.monopoly.message.client.BuyPropertyResponse;
import pp.monopoly.model.fields.GateField;
import pp.monopoly.notification.Sound;
@@ -78,7 +78,7 @@ public class GateFieldCard extends Dialog {
buyButton.setFontSize(32);
buyButton.addClickCommands(s -> ifTopDialog(() -> {
app.getGameLogic().playSound(Sound.BUTTON);
app.getGameLogic().send(new BuyPropertyRequest());
app.getGameLogic().send(new BuyPropertyResponse());
close();
}));

View File

@@ -12,7 +12,7 @@ import com.simsilica.lemur.style.ElementId;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.message.client.BuyPropertyRequest;
import pp.monopoly.message.client.BuyPropertyResponse;
import pp.monopoly.notification.Sound;
/**
@@ -76,7 +76,7 @@ public class SellHouse extends Dialog {
confirmButton.setFontSize(32);
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
app.getGameLogic().playSound(Sound.BUTTON);
app.getGameLogic().send(new BuyPropertyRequest());
//TODO
}));