Add: Added Building Icon in Player Side Panel

This commit is contained in:
rubenpirreram
2026-05-17 21:40:07 +02:00
parent 799eecc79f
commit 0fe7941c3e
@@ -236,6 +236,7 @@ public class MainFXMLController {
case "builders" -> new ArrayList<>(p.builders);
case "shamans" -> new ArrayList<>(p.shamans);
case "hunters" -> new ArrayList<>(p.hunters);
case "building" -> new ArrayList<>(p.buildingCards);
default -> new ArrayList<>();
};
}
@@ -345,7 +346,7 @@ public class MainFXMLController {
}
headerRow.getChildren().addAll(totem, usernameLabel);
// Riga 2: cibo + prestigio
// Riga 2: cibo + prestigio + building
HBox statsRow = new HBox(10);
statsRow.setAlignment(Pos.CENTER);
@@ -367,13 +368,31 @@ public class MainFXMLController {
prestigeLabel.getStyleClass().add("label-small");
prestigeBox.getChildren().addAll(PPIcon, prestigeLabel);
statsRow.getChildren().addAll(foodBox, prestigeBox);
ImageView icon = new ImageView();
icon.setFitWidth(28);
icon.setFitHeight(28);
icon.setPreserveRatio(true);
icon.setImage(loadImage("/GUIImages/Icons/Building.png"));
ArrayList<PlayableCard> cards = getPlayerCards(player.getUserName(), "building");
if (cards.isEmpty()) {
ColorAdjust grayscale = new ColorAdjust();
icon.setEffect(grayscale);
icon.setOpacity(0.3);
} else {
icon.setOnMouseClicked(e -> openPopup(new ArrayList<>(cards)));
addHoverZoom(icon);
}
statsRow.getChildren().addAll(foodBox, prestigeBox,icon);
// Righe 3-4: icone carte
HBox iconsRow1 = new HBox(6);
iconsRow1.setSpacing(20);
iconsRow1.setAlignment(Pos.CENTER);
HBox iconsRow2 = new HBox(6);
iconsRow2.setAlignment(Pos.CENTER);
iconsRow2.setSpacing(20);
renderIcons(iconsRow1, iconsRow2, player);
card.getChildren().addAll(headerRow, statsRow, iconsRow1, iconsRow2);