This commit is contained in:
Johannes Schmelz 2024-12-01 00:30:55 +01:00
commit 2e28b54936
2 changed files with 11 additions and 5 deletions

View File

@ -95,8 +95,14 @@ public class PropertyOverviewMenu extends Dialog {
// Fetch the current player // Fetch the current player
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()); Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
// Iterate through the player's properties // Fetch the player's properties using their indices
for (PropertyField property : currentPlayer.getPropertyFields()) { List<PropertyField> fields = new ArrayList<>();
for (Integer i : currentPlayer.getProperties()) {
fields.add((PropertyField) app.getGameLogic().getBoardManager().getFieldAtIndex(i));
}
// Iterate through the fetched properties
for (PropertyField property : fields) {
if (property instanceof BuildingProperty) { if (property instanceof BuildingProperty) {
BuildingProperty building = (BuildingProperty) property; BuildingProperty building = (BuildingProperty) property;
cards.add(createBuildingCard(building)); cards.add(createBuildingCard(building));

View File

@ -27,7 +27,7 @@ public class BuyCard extends Dialog {
super(app.getDialogManager()); super(app.getDialogManager());
this.app = app; this.app = app;
//Generate the corresponfing field //Generate the corresponding field
int index = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getFieldID(); int index = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getFieldID();
BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index); BuildingProperty field = (BuildingProperty) new BoardManager().getFieldAtIndex(index);
@ -84,14 +84,14 @@ public class BuyCard extends Dialog {
buyCardContainer.setLocalTranslation( buyCardContainer.setLocalTranslation(
(app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x) / 2, (app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x) / 2,
(app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y) / 2, (app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y) / 2,
8 10
); );
// Zentriere das Popup // Zentriere das Popup
backgroundContainer.setLocalTranslation( backgroundContainer.setLocalTranslation(
(app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x - padding) / 2,
(app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y+ padding) / 2, (app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y+ padding) / 2,
7 9
); );
app.getGuiNode().attachChild(buyCardContainer); app.getGuiNode().attachChild(buyCardContainer);