mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 04:56:15 +01:00
added trigger for winner looser popup
This commit is contained in:
parent
2d9cd0e4e1
commit
b0c21dfcb8
@ -7,6 +7,8 @@ import pp.monopoly.client.gui.popups.BuyCard;
|
|||||||
import pp.monopoly.client.gui.popups.EventCard;
|
import pp.monopoly.client.gui.popups.EventCard;
|
||||||
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
||||||
import pp.monopoly.client.gui.popups.GateFieldCard;
|
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.game.server.Player;
|
||||||
import pp.monopoly.model.fields.BuildingProperty;
|
import pp.monopoly.model.fields.BuildingProperty;
|
||||||
import pp.monopoly.model.fields.FoodField;
|
import pp.monopoly.model.fields.FoodField;
|
||||||
@ -130,8 +132,7 @@ public class TestWorld implements GameEventListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receivedEvent(PopUpEvent event) {
|
public void receivedEvent(PopUpEvent event) {
|
||||||
System.err.println("Trigger ?");
|
if(event.msg().equals("Buy")) {
|
||||||
// if (event.desc() == "BuyCard") {
|
|
||||||
int field = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
int field = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID();
|
||||||
Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field);
|
Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field);
|
||||||
|
|
||||||
@ -142,6 +143,11 @@ public class TestWorld implements GameEventListener{
|
|||||||
} else if (fieldObject instanceof FoodField) {
|
} else if (fieldObject instanceof FoodField) {
|
||||||
new FoodFieldCard(app).open();
|
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
|
@Override
|
||||||
|
@ -226,12 +226,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
@Override
|
@Override
|
||||||
public void received(GameOver msg) {
|
public void received(GameOver msg) {
|
||||||
if (msg.isWinner()) {
|
if (msg.isWinner()) {
|
||||||
|
notifyListeners(new PopUpEvent("Winner"));
|
||||||
//Winner popup
|
|
||||||
playSound(Sound.WINNER);
|
playSound(Sound.WINNER);
|
||||||
} else {
|
} else {
|
||||||
|
notifyListeners(new PopUpEvent("Looser"));
|
||||||
// Looser popup
|
|
||||||
playSound(Sound.LOSER);
|
playSound(Sound.LOSER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,6 +331,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(BuyPropertyRequest msg) {
|
public void received(BuyPropertyRequest msg) {
|
||||||
notifyListeners(new PopUpEvent());
|
notifyListeners(new PopUpEvent("Buy"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package pp.monopoly.notification;
|
package pp.monopoly.notification;
|
||||||
|
|
||||||
public record PopUpEvent() implements GameEvent{
|
public record PopUpEvent(String msg) implements GameEvent{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyListener(GameEventListener listener) {
|
public void notifyListener(GameEventListener listener) {
|
||||||
|
Loading…
Reference in New Issue
Block a user