mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
added documentation for ConfirmTrade
This commit is contained in:
parent
4ac02a1a7b
commit
25361933d7
@ -20,12 +20,23 @@ import pp.monopoly.notification.Sound;
|
||||
* ConfirmTrade is a popup which appears when a trade is proposed to this certain player.
|
||||
*/
|
||||
public class ConfirmTrade extends Dialog {
|
||||
/** Reference to the Monopoly application instance. */
|
||||
private final MonopolyApp app;
|
||||
|
||||
/** Main container for the "Confirm Trade" popup UI. */
|
||||
private final Container confirmTradeContainer;
|
||||
|
||||
/** Background container providing a border for the popup. */
|
||||
private final Container backgroundContainer;
|
||||
|
||||
/** The trade handler managing the details of the trade proposal. */
|
||||
private TradeHandler tradeHandler;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the "Confirm Trade" popup.
|
||||
*
|
||||
* @param app the Monopoly application instance
|
||||
*/
|
||||
public ConfirmTrade(MonopolyApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
@ -33,13 +44,12 @@ public class ConfirmTrade extends Dialog {
|
||||
|
||||
// Create the background container
|
||||
backgroundContainer = new Container();
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background
|
||||
backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f)));
|
||||
attachChild(backgroundContainer);
|
||||
|
||||
// Hauptcontainer für das Bestätigungspopup
|
||||
confirmTradeContainer = new Container();
|
||||
|
||||
float padding = 10; // Passt den backgroundContainer an die Größe des confirmTradeContainer an
|
||||
float padding = 10;
|
||||
backgroundContainer.setPreferredSize(confirmTradeContainer.getPreferredSize().addLocal(padding, padding, 0));
|
||||
|
||||
// Titel
|
||||
@ -122,15 +132,18 @@ public class ConfirmTrade extends Dialog {
|
||||
}
|
||||
|
||||
/**
|
||||
* Schließt das Menü und entfernt die GUI-Elemente.
|
||||
* Closes the popup and removes its GUI elements.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
app.getGuiNode().detachChild(confirmTradeContainer); // Entferne das Menü
|
||||
app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand
|
||||
app.getGuiNode().detachChild(confirmTradeContainer);
|
||||
app.getGuiNode().detachChild(backgroundContainer);
|
||||
super.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the settings menu when the escape key is pressed.
|
||||
*/
|
||||
@Override
|
||||
public void escape() {
|
||||
new SettingsMenu(app).open();
|
||||
|
Loading…
Reference in New Issue
Block a user