mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 22:56:15 +01:00
added documentation for SellHouse
This commit is contained in:
parent
531a3e263c
commit
821c9ec3fb
@ -32,20 +32,43 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SellHouse is a popup which appears when a player clicks on the "demolish"-button in the BuildingAdminMenu
|
* SellHouse is a popup that appears when a player clicks on the "Demolish" button
|
||||||
|
* in the BuildingAdminMenu.
|
||||||
|
* <p>
|
||||||
|
* This dialog allows players to select their properties and demolish houses or hotels
|
||||||
|
* for a partial refund of their purchase cost.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public class SellHouse extends Dialog {
|
public class SellHouse extends Dialog {
|
||||||
|
/** Reference to the Monopoly application instance. */
|
||||||
private final MonopolyApp app;
|
private final MonopolyApp app;
|
||||||
|
|
||||||
|
/** Main container for the SellHouse dialog UI. */
|
||||||
private final Container sellhouseContainer;
|
private final Container sellhouseContainer;
|
||||||
|
|
||||||
|
/** Background container providing a styled border around the main dialog. */
|
||||||
private final Container backgroundContainer;
|
private final Container backgroundContainer;
|
||||||
private TextField selectionDisplay; // TextField to display selections
|
|
||||||
|
/** Text field to display selected properties. */
|
||||||
|
private TextField selectionDisplay;
|
||||||
|
|
||||||
|
/** Reference to track selection changes in the property selector. */
|
||||||
private VersionedReference<Set<Integer>> selectionRef;
|
private VersionedReference<Set<Integer>> selectionRef;
|
||||||
|
|
||||||
|
/** Dropdown selector for displaying available properties. */
|
||||||
private Selector<String> propertySelector;
|
private Selector<String> propertySelector;
|
||||||
|
|
||||||
|
/** Set of properties selected for selling. */
|
||||||
private Set<String> selectedProperties = new HashSet<>();
|
private Set<String> selectedProperties = new HashSet<>();
|
||||||
|
|
||||||
|
/** Label to display the total refund amount for the selected properties. */
|
||||||
private Label cost = new Label("0", new ElementId("label-Text"));
|
private Label cost = new Label("0", new ElementId("label-Text"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new SellHouse dialog.
|
||||||
|
*
|
||||||
|
* @param app The MonopolyApp instance.
|
||||||
|
*/
|
||||||
public SellHouse(MonopolyApp app) {
|
public SellHouse(MonopolyApp app) {
|
||||||
super(app.getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.app = app;
|
this.app = app;
|
||||||
@ -180,6 +203,11 @@ public class SellHouse extends Dialog {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the dialog UI, tracking changes in the property selection.
|
||||||
|
*
|
||||||
|
* @param delta Time since the last update.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(float delta) {
|
public void update(float delta) {
|
||||||
if(selectionRef.update()) {
|
if(selectionRef.update()) {
|
||||||
@ -188,7 +216,9 @@ public class SellHouse extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles property selection changes.
|
* Handles changes to the property selection.
|
||||||
|
*
|
||||||
|
* @param playerProperties The dropdown menu's selection state.
|
||||||
*/
|
*/
|
||||||
private void onDropdownSelectionChanged(Selector<String> playerProperties) {
|
private void onDropdownSelectionChanged(Selector<String> playerProperties) {
|
||||||
String selected = playerProperties.getSelectedItem();
|
String selected = playerProperties.getSelectedItem();
|
||||||
@ -211,7 +241,7 @@ public class SellHouse extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schließt das Menü und entfernt die GUI-Elemente.
|
* Closes the dialog and removes GUI elements from the screen.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
@ -220,6 +250,9 @@ public class SellHouse extends Dialog {
|
|||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the escape action to close the dialog.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void escape() {
|
public void escape() {
|
||||||
new SettingsMenu(app).open();
|
new SettingsMenu(app).open();
|
||||||
|
Loading…
Reference in New Issue
Block a user