added documentation for TimeOut

This commit is contained in:
Yvonne Schmidt 2024-12-02 08:51:22 +01:00
parent e81cdf3b40
commit 4917208818

View File

@ -17,16 +17,29 @@ import pp.monopoly.notification.Sound;
import static pp.monopoly.Resources.lookup;
/**
* TimeOut is a warning popup that is triggered when the connection to the server is interrupted.
* TimeOut is a warning popup triggered when the connection to the server is interrupted.
* <p>
* This popup informs the user about the loss of connection and provides an option to acknowledge it.
* </p>
*/
public class TimeOut extends Dialog {
/** Reference to the Monopoly application instance. */
private final MonopolyApp app;
/** Semi-transparent overlay background for the dialog. */
private final Geometry overlayBackground;
/** Main container for the TimeOut dialog UI. */
private final Container timeOutContainer;
/** Background container providing a styled border around the main dialog. */
private final Container backgroundContainer;
/**
* Constructs a new TimeOut dialog to notify the user about a connection loss.
*
* @param app The MonopolyApp instance.
*/
public TimeOut(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
@ -86,9 +99,9 @@ public class TimeOut 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 overlay geometry.
*/
private Geometry createOverlayBackground() {
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
@ -102,8 +115,9 @@ public class TimeOut extends Dialog {
}
/**
* Schließt das Menü und entfernt die GUI-Elemente.
* Closes the TimeOut dialog and removes its GUI elements.
*/
@Override
public void close() {
app.getGuiNode().detachChild(timeOutContainer); // Entferne das Menü
@ -112,6 +126,9 @@ public class TimeOut extends Dialog {
super.close();
}
/**
* Handles the escape action to close the dialog.
*/
@Override
public void escape() {
close();