added documentation for AcceptTrade

This commit is contained in:
Yvonne Schmidt 2024-12-02 07:55:07 +01:00
parent 3539b1cf23
commit 3a43ea10d9

View File

@ -17,16 +17,32 @@ import pp.monopoly.message.server.TradeReply;
import pp.monopoly.notification.Sound;
/**
* Bankrupt is a Warning-Popup which appears when the balance is negative at the end of a player´s turn
* Represents a confirmation dialog that appears when a trade is accepted .
* <p>
* Displays a message to the user informing them that the trade they proposed has been accepted,
* along with a confirmation button to close the dialog.
* </p>
*/
public class AcceptTrade extends Dialog {
/** Reference to the Monopoly application instance. */
private final MonopolyApp app;
/** Semi-transparent overlay background for the dialog. */
private final Geometry overlayBackground;
/** Container for the warning message content. */
private final Container noMoneyWarningContainer;
/** Background container providing a border for the dialog. */
private final Container backgroundContainer;
/**
* Constructs the accept trade dialog.
*
* @param app the Monopoly application instance
* @param msg the trade reply message containing details about the trade
*/
public AcceptTrade(MonopolyApp app, TradeReply msg) {
super(app.getDialogManager());
this.app = app;
@ -92,9 +108,9 @@ public class AcceptTrade extends Dialog {
}
/**
* Erstellt einen halbtransparenten Hintergrund für das Menü.
* Creates a semi-transparent background overlay for the dialog.
*
* @return Geometrie des Overlays
* @return the geometry of the overlay
*/
private Geometry createOverlayBackground() {
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
@ -108,7 +124,7 @@ public class AcceptTrade extends Dialog {
}
/**
* Closes the menu and removes the GUI elements.
* Closes the dialog and removes the associated GUI elements.
*/
@Override
public void close() {
@ -118,6 +134,9 @@ public class AcceptTrade extends Dialog {
super.close();
}
/**
* Handles the escape key action by closing the dialog.
*/
@Override
public void escape() {
close();