added documentation for RejectTrade

This commit is contained in:
Yvonne Schmidt 2024-12-02 08:34:53 +01:00
parent 72e0fc7cbd
commit a50821f2e6

View File

@ -17,16 +17,33 @@ import pp.monopoly.message.server.TradeReply;
import pp.monopoly.notification.Sound; 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 * RejectTrade is a popup that appears when a trade proposal is rejected by another player
* in the Monopoly application.
* <p>
* Displays a message indicating that the proposed trade has been declined, along with
* details of the involved players and provides an option to close the popup.
* </p>
*/ */
public class RejectTrade extends Dialog { public class RejectTrade extends Dialog {
/** Reference to the Monopoly application instance. */
private final MonopolyApp app; private final MonopolyApp app;
/** Semi-transparent overlay background for the popup. */
private final Geometry overlayBackground; private final Geometry overlayBackground;
/** Main container for the rejection message content. */
private final Container noMoneyWarningContainer; private final Container noMoneyWarningContainer;
/** Background container providing a border for the popup. */
private final Container backgroundContainer; private final Container backgroundContainer;
/**
* Constructs the RejectTrade popup displaying the rejection of a trade proposal.
*
* @param app the Monopoly application instance
* @param msg the trade reply message containing details about the rejected trade
*/
public RejectTrade(MonopolyApp app, TradeReply msg) { public RejectTrade(MonopolyApp app, TradeReply msg) {
super(app.getDialogManager()); super(app.getDialogManager());
this.app = app; this.app = app;
@ -92,9 +109,9 @@ public class RejectTrade extends Dialog {
} }
/** /**
* Erstellt einen halbtransparenten Hintergrund für das Menü. * Creates a semi-transparent background overlay for the popup.
* *
* @return Geometrie des Overlays * @return the geometry of the overlay
*/ */
private Geometry createOverlayBackground() { private Geometry createOverlayBackground() {
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight()); Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
@ -118,6 +135,9 @@ public class RejectTrade extends Dialog {
super.close(); super.close();
} }
/**
* Handles the escape key action by closing the popup.
*/
@Override @Override
public void escape() { public void escape() {
close(); close();