added trigger for winner looser popup

This commit is contained in:
Johannes Schmelz
2024-11-29 06:23:08 +01:00
parent 2d9cd0e4e1
commit b0c21dfcb8
3 changed files with 12 additions and 8 deletions

View File

@@ -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"));
}
}

View File

@@ -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) {