mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-01 06:17:40 +02:00
jail logic complete
This commit is contained in:
@@ -279,7 +279,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
//logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
|
||||
private void handleB(boolean isPressed) {
|
||||
if (isPressed) {
|
||||
Dialog tmp = new GulagInfo(this);
|
||||
Dialog tmp = new GulagInfo(this, 3);
|
||||
tmp.open();
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import pp.monopoly.client.gui.popups.EventCardPopup;
|
||||
import pp.monopoly.client.gui.popups.FoodFieldCard;
|
||||
import pp.monopoly.client.gui.popups.GateFieldCard;
|
||||
import pp.monopoly.client.gui.popups.Gulag;
|
||||
import pp.monopoly.client.gui.popups.GulagInfo;
|
||||
import pp.monopoly.client.gui.popups.LooserPopUp;
|
||||
import pp.monopoly.client.gui.popups.NoMoneyWarning;
|
||||
import pp.monopoly.client.gui.popups.Rent;
|
||||
@@ -380,8 +381,11 @@ public class TestWorld implements GameEventListener {
|
||||
new NoMoneyWarning(app).open();
|
||||
} else if(event.msg().equals("rent")) {
|
||||
new Rent(app, ( (NotificationMessage) event.message()).getRentOwner(), ( (NotificationMessage) event.message()).getRentAmount() ).open();
|
||||
} else if (event.msg().equals("jailtryagain")) {
|
||||
new GulagInfo(app, 1).open();
|
||||
} else if (event.msg().equals("jailpay")) {
|
||||
new GulagInfo(app, 3).open();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -9,10 +9,7 @@ import com.simsilica.lemur.style.ElementId;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.monopoly.client.MonopolyApp;
|
||||
import pp.monopoly.client.gui.SettingsMenu;
|
||||
import pp.monopoly.client.gui.TradeMenu;
|
||||
import pp.monopoly.message.client.TradeResponse;
|
||||
import pp.monopoly.model.TradeHandler;
|
||||
import pp.monopoly.model.fields.PropertyField;
|
||||
import pp.monopoly.message.client.NotificationAnswer;
|
||||
import pp.monopoly.notification.Sound;
|
||||
|
||||
/**
|
||||
@@ -24,7 +21,7 @@ public class GulagInfo extends Dialog {
|
||||
private final Container backgroundContainer;
|
||||
|
||||
|
||||
public GulagInfo(MonopolyApp app) {
|
||||
public GulagInfo(MonopolyApp app, int trys) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
@@ -54,12 +51,6 @@ public class GulagInfo extends Dialog {
|
||||
propertyValuesContainer.addChild(new Label("- löst eine Gulag-Frei-Karte ein", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("- wartest 3 Runden und bezahlst dann", new ElementId("label-Text")));// Leerzeile
|
||||
propertyValuesContainer.addChild(new Label("- oder du würfelst einen Pasch", new ElementId("label-Text")));
|
||||
/*propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
|
||||
propertyValuesContainer.addChild(new Label("- ", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("- EUR", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("- Sonderkaten", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
|
||||
propertyValuesContainer.addChild(new Label("tauschen, willst du das Angebot annehmen?", new ElementId("label-Text")));*/
|
||||
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
|
||||
|
||||
@@ -68,6 +59,7 @@ public class GulagInfo extends Dialog {
|
||||
negotiateButton.setFontSize(32);
|
||||
negotiateButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
app.getGameLogic().send(new NotificationAnswer("PayJail"));
|
||||
close();
|
||||
}));
|
||||
// Ereigniskarte-Button
|
||||
@@ -75,6 +67,7 @@ public class GulagInfo extends Dialog {
|
||||
confirmButton.setFontSize(32);
|
||||
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
app.getGameLogic().send(new NotificationAnswer("UseJailCard"));
|
||||
close();
|
||||
}));
|
||||
// Schließen-Button
|
||||
@@ -99,6 +92,14 @@ public class GulagInfo extends Dialog {
|
||||
7
|
||||
);
|
||||
|
||||
if(app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getNumJailCard() == 0) {
|
||||
confirmButton.setEnabled(false);
|
||||
}
|
||||
|
||||
if(trys == 3) {
|
||||
declineButton.setEnabled(false);
|
||||
}
|
||||
|
||||
app.getGuiNode().attachChild(confirmTradeContainer);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user