mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 19:33:40 +01:00
Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui
This commit is contained in:
commit
3b729c9a04
@ -17,7 +17,7 @@ import pp.monopoly.notification.Sound;
|
||||
*/
|
||||
public class GulagInfo extends Dialog {
|
||||
private final MonopolyApp app;
|
||||
private final Container confirmTradeContainer;
|
||||
private final Container gulagInfoContainer;
|
||||
private final Container backgroundContainer;
|
||||
|
||||
|
||||
@ -31,19 +31,19 @@ public class GulagInfo extends Dialog {
|
||||
attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für das Bestätigungspopup
|
||||
confirmTradeContainer = new Container();
|
||||
gulagInfoContainer = new Container();
|
||||
|
||||
float padding = 10; // Passt den backgroundContainer an die Größe des confirmTradeContainer an
|
||||
backgroundContainer.setPreferredSize(confirmTradeContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
backgroundContainer.setPreferredSize(gulagInfoContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
// Titel
|
||||
Label title = confirmTradeContainer.addChild(new Label( "Gulag", new ElementId("warning-title")));
|
||||
Label title = gulagInfoContainer.addChild(new Label( "Gulag", new ElementId("warning-title")));
|
||||
title.setFontSize(48);
|
||||
title.setColor(ColorRGBA.Black);
|
||||
|
||||
// Text, der auf der Karte steht
|
||||
// Die Werte werden dem Handel entnommen (Iwas auch immer da dann ist)
|
||||
Container propertyValuesContainer = confirmTradeContainer.addChild(new Container());
|
||||
Container propertyValuesContainer = gulagInfoContainer.addChild(new Container());
|
||||
propertyValuesContainer.addChild(new Label("„Du sitzt im Gefänginis und kommst nicht raus ...", new ElementId("label-Text")));
|
||||
propertyValuesContainer.addChild(new Label("Es sei denn, du ...", new ElementId("label-Text")));// Leerzeile
|
||||
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));
|
||||
@ -55,52 +55,52 @@ public class GulagInfo extends Dialog {
|
||||
|
||||
|
||||
// Bezahlen-Button
|
||||
Button negotiateButton = confirmTradeContainer.addChild(new Button("Bestechungsgeld bezahlen", new ElementId("button")));
|
||||
negotiateButton.setFontSize(32);
|
||||
negotiateButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
Button payButton = gulagInfoContainer.addChild(new Button("Bestechungsgeld bezahlen", new ElementId("button")));
|
||||
payButton.setFontSize(32);
|
||||
payButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
app.getGameLogic().send(new NotificationAnswer("PayJail"));
|
||||
close();
|
||||
}));
|
||||
// Ereigniskarte-Button
|
||||
Button confirmButton = confirmTradeContainer.addChild(new Button("Ereigniskarte nutzen", new ElementId("button")));
|
||||
confirmButton.setFontSize(32);
|
||||
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
Button eventCardButton = gulagInfoContainer.addChild(new Button("Ereigniskarte nutzen", new ElementId("button")));
|
||||
eventCardButton.setFontSize(32);
|
||||
eventCardButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
app.getGameLogic().send(new NotificationAnswer("UseJailCard"));
|
||||
close();
|
||||
}));
|
||||
// Schließen-Button
|
||||
Button declineButton = confirmTradeContainer.addChild(new Button("Schließen", new ElementId("button")));
|
||||
declineButton.setFontSize(32);
|
||||
declineButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
Button closeButton = gulagInfoContainer.addChild(new Button("Schließen", new ElementId("button")));
|
||||
closeButton.setFontSize(32);
|
||||
closeButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||
app.getGameLogic().playSound(Sound.BUTTON);
|
||||
close();
|
||||
}));
|
||||
|
||||
// Zentriere das Menü
|
||||
confirmTradeContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y) / 2,
|
||||
gulagInfoContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - gulagInfoContainer.getPreferredSize().x) / 2,
|
||||
(app.getCamera().getHeight() + gulagInfoContainer.getPreferredSize().y) / 2,
|
||||
8
|
||||
);
|
||||
|
||||
// Zentriere das Menü
|
||||
backgroundContainer.setLocalTranslation(
|
||||
(app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y+ padding) / 2,
|
||||
(app.getCamera().getWidth() - gulagInfoContainer.getPreferredSize().x - padding) / 2,
|
||||
(app.getCamera().getHeight() + gulagInfoContainer.getPreferredSize().y+ padding) / 2,
|
||||
7
|
||||
);
|
||||
|
||||
if(app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getNumJailCard() == 0) {
|
||||
confirmButton.setEnabled(false);
|
||||
eventCardButton.setEnabled(false);
|
||||
}
|
||||
|
||||
if(trys == 3) {
|
||||
declineButton.setEnabled(false);
|
||||
closeButton.setEnabled(false);
|
||||
}
|
||||
|
||||
app.getGuiNode().attachChild(confirmTradeContainer);
|
||||
app.getGuiNode().attachChild(gulagInfoContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ public class GulagInfo extends Dialog {
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
app.getGuiNode().detachChild(confirmTradeContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(gulagInfoContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
super.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user