diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java index 04bdc2a..06612bf 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java @@ -7,6 +7,8 @@ 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.client.gui.popups.LooserPopUp; +import pp.monopoly.client.gui.popups.WinnerPopUp; import pp.monopoly.game.server.Player; import pp.monopoly.model.fields.BuildingProperty; import pp.monopoly.model.fields.FoodField; @@ -130,8 +132,7 @@ public class TestWorld implements GameEventListener{ @Override public void receivedEvent(PopUpEvent event) { - System.err.println("Trigger ?"); - // if (event.desc() == "BuyCard") { + if(event.msg().equals("Buy")) { int field = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID(); Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field); @@ -142,6 +143,11 @@ public class TestWorld implements GameEventListener{ } else if (fieldObject instanceof FoodField) { new FoodFieldCard(app).open(); } + } else if(event.msg().equals("Winner")) { + new WinnerPopUp(app).open(); + } else if(event.msg().equals("Looser")) { + new LooserPopUp(app).open(); + } } @Override diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java index 1b817c3..31c97d1 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java @@ -226,12 +226,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { @Override public void received(GameOver msg) { if (msg.isWinner()) { - - //Winner popup + notifyListeners(new PopUpEvent("Winner")); playSound(Sound.WINNER); } else { - - // Looser popup + notifyListeners(new PopUpEvent("Looser")); playSound(Sound.LOSER); } } @@ -333,6 +331,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { @Override public void received(BuyPropertyRequest msg) { - notifyListeners(new PopUpEvent()); + notifyListeners(new PopUpEvent("Buy")); } } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java index 85febde..a808eed 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java @@ -1,6 +1,6 @@ package pp.monopoly.notification; -public record PopUpEvent() implements GameEvent{ +public record PopUpEvent(String msg) implements GameEvent{ @Override public void notifyListener(GameEventListener listener) {