mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 22: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.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
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user