added documentation for NoMoneyWarning

This commit is contained in:
Yvonne Schmidt 2024-12-02 09:00:43 +01:00
parent 821c9ec3fb
commit 446ecfd4b5

View File

@ -15,16 +15,32 @@ import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
/**
* Bankrupt is a Warning-Popup which appears when the balance is negative at the end of a player´s turn
* NoMoneyWarning is a warning popup that appears when a player tries to perform
* an action they cannot afford due to insufficient funds, such as attempting
* to purchase a property or building.
* <p>
* This dialog notifies the player of their lack of funds and provides a single
* confirmation button to close the dialog.
* </p>
*/
public class NoMoneyWarning extends Dialog {
/** Reference to the Monopoly application instance. */
private final MonopolyApp app;
/** Semi-transparent overlay background for the warning popup. */
private final Geometry overlayBackground;
/** Main container for the NoMoneyWarning dialog UI. */
private final Container noMoneyWarningContainer;
/** Background container providing a styled border around the main dialog. */
private final Container backgroundContainer;
/**
* Constructs a new NoMoneyWarning dialog.
*
* @param app The MonopolyApp instance.
*/
public NoMoneyWarning(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
@ -85,9 +101,9 @@ public class NoMoneyWarning extends Dialog {
}
/**
* Erstellt einen halbtransparenten Hintergrund für das Menü.
* Creates a semi-transparent overlay background for the dialog.
*
* @return Geometrie des Overlays
* @return The geometry representing the overlay background.
*/
private Geometry createOverlayBackground() {
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
@ -111,6 +127,9 @@ public class NoMoneyWarning extends Dialog {
super.close();
}
/**
* Handles the escape action to close the dialog.
*/
@Override
public void escape() {
close();