mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 22:56:15 +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 {
|
public class GulagInfo extends Dialog {
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
private final Container confirmTradeContainer;
|
private final Container gulagInfoContainer;
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
|
|
||||||
|
|
||||||
@ -31,19 +31,19 @@ public class GulagInfo extends Dialog {
|
|||||||
attachChild(backgroundContainer);
|
attachChild(backgroundContainer);
|
||||||
|
|
||||||
// Hauptcontainer für das Bestätigungspopup
|
// 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
|
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
|
// 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.setFontSize(48);
|
||||||
title.setColor(ColorRGBA.Black);
|
title.setColor(ColorRGBA.Black);
|
||||||
|
|
||||||
// Text, der auf der Karte steht
|
// Text, der auf der Karte steht
|
||||||
// Die Werte werden dem Handel entnommen (Iwas auch immer da dann ist)
|
// 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("„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("Es sei denn, du ...", new ElementId("label-Text")));// Leerzeile
|
||||||
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));
|
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));
|
||||||
@ -55,52 +55,52 @@ public class GulagInfo extends Dialog {
|
|||||||
|
|
||||||
|
|
||||||
// Bezahlen-Button
|
// Bezahlen-Button
|
||||||
Button negotiateButton = confirmTradeContainer.addChild(new Button("Bestechungsgeld bezahlen", new ElementId("button")));
|
Button payButton = gulagInfoContainer.addChild(new Button("Bestechungsgeld bezahlen", new ElementId("button")));
|
||||||
negotiateButton.setFontSize(32);
|
payButton.setFontSize(32);
|
||||||
negotiateButton.addClickCommands(s -> ifTopDialog( () -> {
|
payButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
app.getGameLogic().send(new NotificationAnswer("PayJail"));
|
app.getGameLogic().send(new NotificationAnswer("PayJail"));
|
||||||
close();
|
close();
|
||||||
}));
|
}));
|
||||||
// Ereigniskarte-Button
|
// Ereigniskarte-Button
|
||||||
Button confirmButton = confirmTradeContainer.addChild(new Button("Ereigniskarte nutzen", new ElementId("button")));
|
Button eventCardButton = gulagInfoContainer.addChild(new Button("Ereigniskarte nutzen", new ElementId("button")));
|
||||||
confirmButton.setFontSize(32);
|
eventCardButton.setFontSize(32);
|
||||||
confirmButton.addClickCommands(s -> ifTopDialog( () -> {
|
eventCardButton.addClickCommands(s -> ifTopDialog( () -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
app.getGameLogic().send(new NotificationAnswer("UseJailCard"));
|
app.getGameLogic().send(new NotificationAnswer("UseJailCard"));
|
||||||
close();
|
close();
|
||||||
}));
|
}));
|
||||||
// Schließen-Button
|
// Schließen-Button
|
||||||
Button declineButton = confirmTradeContainer.addChild(new Button("Schließen", new ElementId("button")));
|
Button closeButton = gulagInfoContainer.addChild(new Button("Schließen", new ElementId("button")));
|
||||||
declineButton.setFontSize(32);
|
closeButton.setFontSize(32);
|
||||||
declineButton.addClickCommands(s -> ifTopDialog(() -> {
|
closeButton.addClickCommands(s -> ifTopDialog(() -> {
|
||||||
app.getGameLogic().playSound(Sound.BUTTON);
|
app.getGameLogic().playSound(Sound.BUTTON);
|
||||||
close();
|
close();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
confirmTradeContainer.setLocalTranslation(
|
gulagInfoContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x) / 2,
|
(app.getCamera().getWidth() - gulagInfoContainer.getPreferredSize().x) / 2,
|
||||||
(app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y) / 2,
|
(app.getCamera().getHeight() + gulagInfoContainer.getPreferredSize().y) / 2,
|
||||||
8
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
// Zentriere das Menü
|
// Zentriere das Menü
|
||||||
backgroundContainer.setLocalTranslation(
|
backgroundContainer.setLocalTranslation(
|
||||||
(app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x - padding) / 2,
|
(app.getCamera().getWidth() - gulagInfoContainer.getPreferredSize().x - padding) / 2,
|
||||||
(app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y+ padding) / 2,
|
(app.getCamera().getHeight() + gulagInfoContainer.getPreferredSize().y+ padding) / 2,
|
||||||
7
|
7
|
||||||
);
|
);
|
||||||
|
|
||||||
if(app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getNumJailCard() == 0) {
|
if(app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getNumJailCard() == 0) {
|
||||||
confirmButton.setEnabled(false);
|
eventCardButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trys == 3) {
|
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
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
app.getGuiNode().detachChild(confirmTradeContainer); // Entferne das Menü
|
app.getGuiNode().detachChild(gulagInfoContainer); // Entferne das Menü
|
||||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user