mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-01 06:27:40 +02:00
open buy popups
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
}));
|
||||
|
||||
|
@@ -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
|
||||
}));
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user