mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-07-31 09:27:42 +02:00
miete erhalten popup
This commit is contained in:
@@ -352,6 +352,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
|
||||
notifyListeners(new PopUpEvent("jailpay", msg));
|
||||
} else if (msg.getKeyWord().equals("jailtryagain")) {
|
||||
notifyListeners(new PopUpEvent("jailtryagain", msg));
|
||||
} else if(msg.getKeyWord().equals("ReceivedRent")) {
|
||||
notifyListeners(new PopUpEvent("ReceivedRent", msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -331,6 +331,13 @@ public class Player implements FieldVisitor<Void>{
|
||||
state.useJailCard();
|
||||
}
|
||||
|
||||
private void sendRentNotification(String keyword, Player player, int amount) {
|
||||
NotificationMessage msg = new NotificationMessage(keyword);
|
||||
msg.setRentAmount(amount);
|
||||
msg.setRentOwnerId(player.getName());
|
||||
getHandler().getLogic().send(player, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visit(BuildingProperty field) {
|
||||
if(field.getOwner() == null) {
|
||||
@@ -340,10 +347,8 @@ public class Player implements FieldVisitor<Void>{
|
||||
int rent = field.calcRent();
|
||||
field.getOwner().earnMoney(rent);
|
||||
pay(rent);
|
||||
NotificationMessage msg = new NotificationMessage("rent");
|
||||
msg.setRentAmount(rent);
|
||||
msg.setRentOwnerId(field.getOwner().getName());
|
||||
getHandler().getLogic().send(this, msg);
|
||||
sendRentNotification("rent", field.getOwner(), rent);
|
||||
sendRentNotification("ReceivedRent", this, rent);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -360,10 +365,8 @@ public class Player implements FieldVisitor<Void>{
|
||||
int rent = rollResult.calcTotal()*factor;
|
||||
field.getOwner().earnMoney(rent);
|
||||
pay(rent);
|
||||
NotificationMessage msg = new NotificationMessage("rent");
|
||||
msg.setRentAmount(rent);
|
||||
msg.setRentOwnerId(field.getOwner().getName());
|
||||
getHandler().getLogic().send(this, msg);
|
||||
sendRentNotification("rent", field.getOwner(), rent);
|
||||
sendRentNotification("ReceivedRent", this, rent);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -377,10 +380,8 @@ public class Player implements FieldVisitor<Void>{
|
||||
|
||||
field.getOwner().earnMoney(rent);
|
||||
pay(rent);
|
||||
NotificationMessage msg = new NotificationMessage("rent");
|
||||
msg.setRentAmount(rent);
|
||||
msg.setRentOwnerId(field.getOwner().getName());
|
||||
getHandler().getLogic().send(this, msg);
|
||||
sendRentNotification("rent", field.getOwner(), rent);
|
||||
sendRentNotification("ReceivedRent", this, rent);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user