trigger NoMoneyPopUp

This commit is contained in:
Johannes Schmelz 2024-12-01 21:24:33 +01:00
parent 0c90d1f185
commit 29e9b54cc4
3 changed files with 5 additions and 0 deletions

View File

@ -294,6 +294,8 @@ public class TestWorld implements GameEventListener {
new ConfirmTrade(app).open();
} else if (event.msg().equals("goingToJail")) {
new Gulag(app).open();
} else if (event.msg().equals("NoMoneyWarning")) {
new NoMoneyWarning(app).open();
}
}

View File

@ -345,6 +345,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
notifyListeners(new PopUpEvent("rent", msg));
} else if (msg.getKeyWord().equals("jailpay")) {
notifyListeners(new PopUpEvent(msg.getKeyWord(), msg));
} else if(msg.getKeyWord().equals("NoMoneyWarning")) {
notifyListeners(new PopUpEvent("NoMoneyWarning", msg));
}
}
}

View File

@ -332,6 +332,7 @@ public class Player implements FieldVisitor<Void>{
public Void visit(BuildingProperty field) {
if(field.getOwner() == null) {
if (field.getPrice() <= accountBalance) getHandler().getLogic().send(this, new BuyPropertyRequest());
else getHandler().getLogic().send(this, new NotificationMessage("NoMoneyWarning"));
} else if (field.getOwner() != this){
int rent = field.calcRent();
field.getOwner().earnMoney(rent);