diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0c04b52..a2cda41 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -11,4 +11,4 @@
-
\ No newline at end of file
+
diff --git a/mvnw b/mvnw
old mode 100755
new mode 100644
diff --git a/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java b/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java
index b42f6ec..a555640 100644
--- a/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java
+++ b/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java
@@ -7,6 +7,7 @@ import it.polimi.ingsw.gc14.View.GUI.GUI;
import it.polimi.ingsw.gc14.View.GUI.LoginView;
import javafx.application.Application;
import javafx.application.Platform;
+import javafx.scene.text.Font;
import javafx.stage.Stage;
public class ClientLauncherGUI extends Application {
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java
index b549192..2c74d4c 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java
@@ -122,7 +122,7 @@ public class Game implements Serializable {
/**
* The order logic card associated with this game.
*/
- private OrderLogicCard orderLogicCard;
+ public OrderLogicCard orderLogicCard;
/**
* The board associated with this game.
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java b/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java
index fc2b9c8..dd6863c 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/OrderLogicCard.java
@@ -123,16 +123,17 @@ public abstract class OrderLogicCard implements Serializable {
}
/**
+ * TODO rifare javadoc
* Returns the {@code Player}'s position based on it's {@code Username}.
* @param username The desired {@code Player}'s username.
* @return {@code int} - the {@code Player}'s position.
* @see Player
*/
- protected int getPosition(String username)
+ public int getPosition(String username)
{
int pos = 0;
- for (Player p : players) {
- if (p.getUserName().equals(username))
+ for (OrderPlayer p : playerList) {
+ if (p.player.getUserName().equals(username))
return pos;
pos++;
}
diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java
index 7c32b35..9eaa70e 100644
--- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java
+++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java
@@ -10,13 +10,14 @@ import javafx.stage.Stage;
public class GUI implements IView { // stessa interfaccia che implementa TUI
private final Stage stage;
- private final MainView mainView = new MainView();
+ private final MainView mainView;
private Game model;
private ClientController controller;
private String username;
public GUI(Stage stage) {
this.stage = stage;
+ this.mainView = new MainView();
}
@Override
diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java
index 4fd4ae1..fc9b1bf 100644
--- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java
+++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java
@@ -1,269 +1,524 @@
package it.polimi.ingsw.gc14.View.GUI;
import it.polimi.ingsw.gc14.Controller.ClientController;
+import it.polimi.ingsw.gc14.Model.*;
+import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
-import it.polimi.ingsw.gc14.Model.Game;
-import it.polimi.ingsw.gc14.Model.Player;
-import it.polimi.ingsw.gc14.Model.Slot;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
+import javafx.animation.ScaleTransition;
+import javafx.event.Event;
import javafx.fxml.FXML;
-import javafx.geometry.Bounds;
+import javafx.geometry.Insets;
import javafx.geometry.Pos;
-import javafx.scene.control.Button;
+import javafx.scene.Cursor;
+import javafx.scene.Node;
+import javafx.scene.control.Label;
+import javafx.scene.effect.ColorAdjust;
+import javafx.scene.effect.DropShadow;
import javafx.scene.image.*;
+import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
+import javafx.scene.paint.Color;
import javafx.scene.shape.*;
+import javafx.scene.text.Font;
+import javafx.stage.Popup;
+import javafx.stage.Window;
+import javafx.util.Duration;
import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
import java.util.Map;
public class MainFXMLController {
+ @FXML private HBox mainHBox;
+
@FXML private HBox board;
@FXML private HBox upperList;
@FXML private HBox lowerList;
@FXML private HBox myHand;
- @FXML private VBox playersHand;
- @FXML private Button reload;
+ @FXML private VBox sidePanel;
+ @FXML private HBox info;
+
+ @FXML private Label era;
+ @FXML private Label round;
+ @FXML private Label player;
+
+ private Popup popup;
+ private HBox popupCards;
private Game model;
private ClientController controller;
private String username;
+ private final Map cardCache = new HashMap<>();
- public void setModel(Game model) {
- this.model = model;
- }
+ public void setModel(Game model) {this.model = model;}
public void setController(ClientController controller) {this.controller = controller;}
public void setUsername(String username) {this.username = username;}
+
+
+
+ @FXML
+ public void initialize() {
+ // Import font and apply CSS
+ Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14);
+ mainHBox.sceneProperty().addListener((obs, oldScene, newScene) -> {
+ if (newScene != null) {
+ newScene.getRoot().applyCss();
+ }
+ });
+
+ // Initialize popup
+ initPopup();
+ }
+
+
public void render() {
+ renderBackground();
+ renderUpper();
+ renderBoard();
+ renderLower();
+ renderMyHand();
+ renderSidePanel();
+ }
+
+ // ==== HELPER ====
+ private StackPane createOrder(String num, boolean withZoom, boolean withShadow) {
+ ImageView img = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Orders/order-" + num + ".png")));
+ img.setFitHeight(240);
+ img.setPreserveRatio(true);
+ Rectangle clip = new Rectangle();
+ clip.setWidth(img.getBoundsInLocal().getWidth());
+ clip.setHeight(240);
+ clip.setArcWidth(20);
+ clip.setArcHeight(20);
+ img.setClip(clip);
+ StackPane wrapper = new StackPane(img);
+ if (withShadow) {
+ addShadow(wrapper);
+ }
+ if (withZoom) {
+ addHoverZoom(wrapper);
+ }
+ return wrapper;
+ }
+
+ private StackPane createSlot(Slot slot, boolean withZoom, boolean withShadow) {
+ ImageView img = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Fronts/card-" + slot.getSlotId() + ".png")));
+ img.setFitHeight(240);
+ img.setPreserveRatio(true);
+ Rectangle clip = new Rectangle();
+ clip.setWidth(img.getBoundsInLocal().getWidth());
+ clip.setHeight(240);
+ clip.setArcWidth(20);
+ clip.setArcHeight(20);
+ img.setClip(clip);
+ StackPane wrapper = new StackPane(img);
+
+ Player player = model.getSlotMap().get(slot);
+ if (player != null) {
+ int index = model.getPlayers().indexOf(player);
+ ImageView totem = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Totems/totem_" + index + ".png")));
+ totem.setFitHeight(70);
+ totem.setPreserveRatio(true);
+ StackPane.setAlignment(totem, Pos.TOP_LEFT);
+ StackPane.setMargin(totem, new Insets(8, 0, 0, 57));
+ wrapper.getChildren().add(totem);
+ }
+
+ if (withShadow) {
+ addShadow(wrapper);
+ }
+ if (withZoom) {
+ addHoverZoom(wrapper);
+ }
+ return wrapper;
+ }
+ private StackPane createCard(PlayableCard card, boolean withZoom, boolean withShadow) {
+ String id = card.getIdIMG();
+ ImageView img;
+ if (cardCache.containsKey(id)) {
+ img = new ImageView(cardCache.get(id).getImage());
+ } else {
+ img = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Fronts/card-" + id + ".png")));
+ cardCache.put(id, img);
+ }
+ img.setFitHeight(200);
+ img.setPreserveRatio(true);
+
+ Rectangle clip = new Rectangle();
+ clip.setWidth(img.getBoundsInLocal().getWidth());
+ clip.setHeight(200);
+ clip.setArcWidth(20);
+ clip.setArcHeight(20);
+ img.setClip(clip);
+
+ StackPane wrapper = new StackPane(img);
+
+ if (withShadow) {
+ addShadow(wrapper);
+ }
+ if (withZoom) {
+ addHoverZoom(wrapper);
+ }
+ return wrapper;
+ }
+ private void addHoverZoom(Node node) {
+ ScaleTransition scaleUp = new ScaleTransition(Duration.millis(150), node);
+ scaleUp.setToX(1.1);
+ scaleUp.setToY(1.1);
+ ScaleTransition scaleDown = new ScaleTransition(Duration.millis(150), node);
+ scaleDown.setToX(1.0);
+ scaleDown.setToY(1.0);
+ node.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> { scaleUp.play(); node.setCursor(Cursor.HAND); });
+ node.addEventHandler(MouseEvent.MOUSE_EXITED, e -> { scaleDown.play(); node.setCursor(Cursor.DEFAULT); });
+ }
+
+ private void addShadow(Node node) {
+ DropShadow shadow = new DropShadow();
+ shadow.setColor(Color.rgb(0, 0, 0, 0.3));
+ shadow.setRadius(6);
+ shadow.setOffsetX(2);
+ shadow.setOffsetY(2);
+ node.setEffect(shadow);
+ node.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> {
+ shadow.setRadius(16);
+ shadow.setOffsetX(4);
+ shadow.setOffsetY(4);
+ shadow.setColor(Color.rgb(0, 0, 0, 0.5));
+ });
+ node.addEventHandler(MouseEvent.MOUSE_EXITED, e -> {
+ shadow.setRadius(6);
+ shadow.setOffsetX(2);
+ shadow.setOffsetY(2);
+ shadow.setColor(Color.rgb(0, 0, 0, 0.3));
+ });
+ }
- // Upper list
- upperList.setSpacing(6);
+
+ // ==== RENDER METHODS ====
+ // BACKGROUND
+ private void renderBackground() {
+ BackgroundSize size = new BackgroundSize(
+ BackgroundSize.AUTO, BackgroundSize.AUTO,
+ false, false, true, true
+ );
+ mainHBox.setBackground(new Background(new BackgroundImage(
+ new Image(getClass().getResourceAsStream("/GUIImages/Background.png")),
+ BackgroundRepeat.NO_REPEAT,
+ BackgroundRepeat.NO_REPEAT,
+ BackgroundPosition.CENTER,
+ size
+ )));
+ }
+
+ // UPPER, LOWER AND BOARD
+ private void renderUpper() {
+ upperList.setSpacing(14);
upperList.setAlignment(Pos.CENTER);
upperList.getChildren().clear();
int i = 0;
for (TribeCard card : model.getUpperListTribeCards()) {
final int index = i;
-
- Image tribeImg = new Image(getClass().getResourceAsStream("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));
- ImageView view = new ImageView(tribeImg);
- view.fitHeightProperty().bind(upperList.heightProperty().subtract(10));
- view.setPreserveRatio(true);
-
- view.setOnMouseClicked(e -> controller.drawUpperTribeCard(username, index));
-
- upperList.getChildren().add(view);
+ StackPane img = createCard(card, true, true);
+ img.setOnMouseClicked(e -> controller.drawUpperTribeCard(username, index));
+ upperList.getChildren().add(img);
i++;
}
+ i = 0;
+ for (BuildingCard card : model.getUpperListBuilding()) {
+ final int index = i;
+ StackPane img = createCard(card, true, true);
+ img.setOnMouseClicked(e -> controller.drawUpperBuildingCard(username, index));
+ upperList.getChildren().add(img);
+ i++;
+ }
+ }
+ private void renderOrder() {
+ StackPane card = createOrder(Integer.toString(model.getNPlayers()), false, false);
+ VBox overlay = new VBox(-20);
+ overlay.setPickOnBounds(false);
+ StackPane.setAlignment(overlay, Pos.TOP_LEFT);
+ StackPane.setMargin(overlay, new Insets(9, 0, 0, 57));
- // Board
- board.setSpacing(6);
+ int i = 0;
+ for (Player player : model.getPlayers()) {
+ final int index = i;
+
+ ImageView totem = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Totems/totem_" + index + ".png")));
+ totem.setFitHeight(70);
+ totem.setPreserveRatio(true);
+ if (!(model.orderLogicCard.getPosition(player.getUserName()) != -1 && !model.getSlotMap().containsValue(player))) {
+ totem.setOpacity(0.0);
+ }
+ overlay.getChildren().add(totem);
+ i++;
+ }
+ card.getChildren().add(overlay);
+ board.getChildren().add(card);
+ }
+ private void renderBoard() {
+ board.setSpacing(14);
board.setAlignment(Pos.CENTER);
board.getChildren().clear();
- i = 0;
+ String path = "";
+ switch (model.getCurrentState().getEra()) {
+ case 1 -> path = "/GUIImages/Backs/back-001.png";
+ case 2 -> path = "/GUIImages/Backs/back-030.png";
+ case 3 -> path = "/GUIImages/Backs/back-058.png";
+ }
+ ImageView back = new ImageView(new Image(getClass().getResourceAsStream(path)));
+ back.setFitHeight(240);
+ back.setPreserveRatio(true);
+ Rectangle clip = new Rectangle();
+ clip.setWidth(back.getBoundsInLocal().getWidth());
+ clip.setHeight(240);
+ clip.setArcWidth(20);
+ clip.setArcHeight(20);
+ back.setClip(clip);
+ addShadow(back);
+ addHoverZoom(back);
+ board.getChildren().add(back);
+
+
+ renderOrder();
+
+ int i = 0;
for (Map.Entry entry : model.getSlotMap().entrySet()) {
Slot slot = entry.getKey();
final int index = i;
-
- Image slotImg = new Image(getClass().getResourceAsStream("/GUIImages/Fronts/card-"+slot.getSlotId()+".png"));
- ImageView view = new ImageView(slotImg);
-
- view.fitHeightProperty().bind(board.heightProperty().subtract(10));
- view.setPreserveRatio(true);
-
- view.setOnMouseClicked(e -> controller.slotChoice(username, index));
-
- board.getChildren().add(view);
+ StackPane img = createSlot(slot, true, true);
+ img.setOnMouseClicked(e -> controller.slotChoice(username, index));
+ board.getChildren().add(img);
i++;
}
-
-
-
- // Lower list
- lowerList.setSpacing(6);
+ }
+ private void renderLower() {
+ lowerList.setSpacing(14);
lowerList.setAlignment(Pos.CENTER);
lowerList.getChildren().clear();
- i = 0;
+ int i = 0;
for (TribeCard card : model.getLowerListTribeCards()) {
final int index = i;
-
- Image tribeImg = new Image(getClass().getResourceAsStream("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));
- ImageView view = new ImageView(tribeImg);
- view.fitHeightProperty().bind(lowerList.heightProperty().subtract(10));
- view.setPreserveRatio(true);
-
- view.setOnMouseClicked(e -> controller.drawLowerTribeCard(username, index));
-
- lowerList.getChildren().add(view);
+ StackPane img = createCard(card, true, true);
+ img.setOnMouseClicked(e -> controller.drawLowerTribeCard(username, index));
+ lowerList.getChildren().add(img);
i++;
}
+ i = 0;
+ for (BuildingCard card : model.getLowerListBuilding()) {
+ final int index = i;
+ StackPane img = createCard(card, true, true);
+ img.setOnMouseClicked(e -> controller.drawLowerBuildingCard(username, index));
+ lowerList.getChildren().add(img);
+ i++;
+ }
+ }
-
- // My hand
+ // MY HAND
+ private void renderMyHand() {
myHand.getChildren().clear();
- myHand.setSpacing(6);
- //myHand.setAlignment(Pos.CENTER_LEFT);
+ myHand.setSpacing(14);
+ myHand.setAlignment(Pos.CENTER);
- myHand.getChildren().add(createCardPane(model.getPlayerByUsername(username).artists.stream().map(x -> (TribeCard) x).toList(), myHand));
- myHand.getChildren().add(createCardPane(model.getPlayerByUsername(username).gatherers.stream().map(x -> (TribeCard) x).toList(), myHand));
- myHand.getChildren().add(createCardPane(model.getPlayerByUsername(username).inventors.stream().map(x -> (TribeCard) x).toList(), myHand));
- myHand.getChildren().add(createCardPane(model.getPlayerByUsername(username).builders.stream().map(x -> (TribeCard) x).toList(), myHand));
- myHand.getChildren().add(createCardPane(model.getPlayerByUsername(username).shamans.stream().map(x -> (TribeCard) x).toList(), myHand));
- myHand.getChildren().add(createCardPane(model.getPlayerByUsername(username).hunters.stream().map(x -> (TribeCard) x).toList(), myHand));
-
-
-
- /**
- // Artists
- Pane artists = new Pane();
- artists.prefHeightProperty().bind(myHand.heightProperty());
- artists.prefWidthProperty().bind(
- artists.heightProperty().multiply(0.63).add((model.getPlayerByUsername(username).artists.size() - 1) * 50)
- );
- for (int j=0;j cardList) {
+ if (!cardList.isEmpty()) {
+ StackPane img = createCard(cardList.getLast(), true, true);
+ Label label = new Label(String.valueOf(cardList.size()));
+ label.setTranslateY(-55);
+ label.setTranslateX(10);
+ label.getStyleClass().add("label-large");
+ StackPane.setAlignment(label, Pos.TOP_RIGHT);
+ img.getChildren().add(label); // aggiungi il label dentro lo StackPane di createCard
+ img.setOnMouseClicked(e -> openPopup(cardList));
+ myHand.getChildren().add(img);
+ } else {
+ Region placeholder = new Region();
+ placeholder.setPrefHeight(200);
+ placeholder.setPrefWidth(200 * 0.675);
+ placeholder.setStyle("-fx-background-color: transparent;");
+ myHand.getChildren().add(placeholder);
}
- myHand.getChildren().add(artists);
-
- // Gatherers
- Pane gatherers=new Pane();
- gatherers.prefHeightProperty().bind(myHand.heightProperty());
- gatherers.prefWidthProperty().bind(
- gatherers.heightProperty().multiply(0.63).add((model.getPlayerByUsername(username).gatherers.size() - 1) * 50)
- );
- for (int j=0;j cards, HBox container) {
- Pane pane = new Pane();
- int n = cards.size();
- pane.prefHeightProperty().bind(container.heightProperty());
-
- for (int j = 0; j < n; j++) {
- TribeCard card = cards.get(j);
- Image tribeImg = new Image(getClass().getResourceAsStream("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));
- ImageView view = new ImageView(tribeImg);
- view.fitHeightProperty().bind(pane.heightProperty().subtract(10));
- view.setPreserveRatio(true);
- view.setLayoutX(j * 50);
- view.setLayoutY(5);
- pane.getChildren().add(view);
-
- if (j == 0) {
- view.layoutBoundsProperty().addListener(new ChangeListener() {
- @Override
- public void changed(ObservableValue extends Bounds> obs, Bounds old, Bounds bounds) {
- if (bounds.getWidth() > 0) {
- pane.setPrefWidth(bounds.getWidth() + (n - 1) * 50);
- view.layoutBoundsProperty().removeListener(this);
- }
- }
- });
+ // Riga 1: icona totem + nome
+ HBox headerRow = new HBox(8);
+ headerRow.setAlignment(Pos.CENTER);
+ int index = model.getPlayers().indexOf(player);
+ ImageView totem = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Totems/totem_" + index + ".png")));
+ totem.setFitHeight(20);
+ totem.setPreserveRatio(true);
+ Label usernameLabel = new Label(player.getUserName());
+ usernameLabel.getStyleClass().add("label-medium");
+ if (player.getUserName().equals(username)) {
+ usernameLabel.setStyle("-fx-text-fill: #9d0208");
}
+ headerRow.getChildren().addAll(totem, usernameLabel);
+
+ // Riga 2: cibo + prestigio
+ HBox statsRow = new HBox(10);
+ statsRow.setAlignment(Pos.CENTER);
+
+ HBox foodBox = new HBox(4);
+ foodBox.setAlignment(Pos.CENTER);
+ ImageView foodIcon = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Icons/Food.png")));
+ foodIcon.setFitHeight(20);
+ foodIcon.setPreserveRatio(true);
+ Label foodLabel = new Label(String.valueOf(player.getFoodValue()));
+ foodLabel.getStyleClass().add("label-small");
+ foodBox.getChildren().addAll(foodIcon, foodLabel);
+
+ HBox prestigeBox = new HBox(1);
+ prestigeBox.setAlignment(Pos.CENTER);
+ ImageView PPIcon = new ImageView(new Image(getClass().getResourceAsStream("/GUIImages/Icons/PrestigePoint.png")));
+ PPIcon.setFitHeight(35);
+ PPIcon.setPreserveRatio(true);
+ Label prestigeLabel = new Label(String.valueOf(player.getPrestigeValue()));
+ prestigeLabel.getStyleClass().add("label-small");
+ prestigeBox.getChildren().addAll(PPIcon, prestigeLabel);
+
+ statsRow.getChildren().addAll(foodBox, prestigeBox);
+
+ // Righe 3-4: icone carte (3 per riga)
+ HBox iconsRow1 = new HBox(6);
+ iconsRow1.setAlignment(Pos.CENTER);
+ HBox iconsRow2 = new HBox(6);
+ iconsRow2.setAlignment(Pos.CENTER);
+ renderIcons(iconsRow1, iconsRow2, player); // vedi sotto
+
+ card.getChildren().addAll(headerRow, statsRow, iconsRow1, iconsRow2);
+ playersHand.getChildren().add(card);
}
- return pane;
+
+ }
+ private void renderIcons(HBox iconsRow1, HBox iconsRow2, Player player) {
+ String[][] iconTypes = {
+ {"Artist", "artists"},
+ {"Gatherer", "gatherers"},
+ {"Inventor", "inventors"},
+ {"Builder", "builders"},
+ {"Shaman", "shamans"},
+ {"Hunter", "hunters"}
+ };
+
+ for (int i = 0; i < iconTypes.length; i++) {
+ String iconName = iconTypes[i][0];
+ String fieldName = iconTypes[i][1];
+
+ ImageView icon = new ImageView();
+ icon.setFitWidth(28);
+ icon.setFitHeight(28);
+ icon.setPreserveRatio(true);
+ icon.setImage(new Image(getClass().getResourceAsStream("/GUIImages/Icons/" + iconName + ".png")));
+
+ ArrayList cards = getPlayerCards(player.getUserName(), fieldName);
+ if (cards.isEmpty()) {
+ ColorAdjust grayscale = new ColorAdjust();
+ //grayscale.setSaturation(-1.0);
+ icon.setEffect(grayscale);
+ icon.setOpacity(0.3);
+ } else {
+ icon.setOnMouseClicked(e -> openPopup(cards));
+ addHoverZoom(icon);
+ }
+
+ if (i < 3) iconsRow1.getChildren().add(icon);
+ else iconsRow2.getChildren().add(icon);
+ }
+ }
+ private ArrayList getPlayerCards(String username, String type) {
+ Player p = model.getPlayerByUsername(username);
+ return switch (type) {
+ case "artists" -> new ArrayList<>(p.artists);
+ case "gatherers" -> new ArrayList<>(p.gatherers);
+ case "inventors" -> new ArrayList<>(p.inventors);
+ case "builders" -> new ArrayList<>(p.builders);
+ case "shamans" -> new ArrayList<>(p.shamans);
+ case "hunters" -> new ArrayList<>(p.hunters);
+ default -> new ArrayList<>();
+ };
+ }
+
+
+ // POPUP
+ private void initPopup() {
+ popupCards = new HBox(10);
+ popupCards.setAlignment(Pos.CENTER);
+ popupCards.setPadding(new Insets(10));
+ popupCards.setStyle(
+ "-fx-background-color: #b42224;" +
+ "-fx-border-color: black;" +
+ "-fx-border-width: 2;" +
+ "-fx-border-radius: 10;" +
+ "-fx-background-radius: 10;"
+ );
+
+ Rectangle clip = new Rectangle();
+ clip.setArcWidth(20);
+ clip.setArcHeight(20);
+ clip.widthProperty().bind(popupCards.widthProperty());
+ clip.heightProperty().bind(popupCards.heightProperty());
+ popupCards.setClip(clip);
+
+ popup = new Popup();
+ popup.getContent().add(popupCards);
+ popup.setAutoHide(true);
+
+ // Aspetta che la scena del popup esista, poi la rendi trasparente
+ popup.addEventHandler(Event.ANY, e -> {
+ if (popup.getScene() != null) {
+ popup.getScene().setFill(Color.TRANSPARENT);
+ }
+ });
+ }
+ private void openPopup(ArrayList extends PlayableCard> cardList) {
+ popupCards.getChildren().clear();
+ for (PlayableCard card : cardList) {
+ StackPane img = createCard(card, false, false);
+ popupCards.getChildren().add(img);
+ }
+ Window window = myHand.getScene().getWindow();
+ popup.show(window, (window.getWidth() - popup.getWidth()) / 2, (window.getHeight() - popup.getHeight()) / 2);
+
+ // La scena esiste solo dopo show()
+ popup.getScene().setFill(Color.TRANSPARENT);
}
}
diff --git a/src/main/resources/Fonts/InknutAntiqua-Black.ttf b/src/main/resources/Fonts/InknutAntiqua-Black.ttf
new file mode 100644
index 0000000..e4e1b09
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-Black.ttf differ
diff --git a/src/main/resources/Fonts/InknutAntiqua-Bold.ttf b/src/main/resources/Fonts/InknutAntiqua-Bold.ttf
new file mode 100644
index 0000000..a926d32
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-Bold.ttf differ
diff --git a/src/main/resources/Fonts/InknutAntiqua-ExtraBold.ttf b/src/main/resources/Fonts/InknutAntiqua-ExtraBold.ttf
new file mode 100644
index 0000000..62340b2
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-ExtraBold.ttf differ
diff --git a/src/main/resources/Fonts/InknutAntiqua-Light.ttf b/src/main/resources/Fonts/InknutAntiqua-Light.ttf
new file mode 100644
index 0000000..b986946
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-Light.ttf differ
diff --git a/src/main/resources/Fonts/InknutAntiqua-Medium.ttf b/src/main/resources/Fonts/InknutAntiqua-Medium.ttf
new file mode 100644
index 0000000..7c452a2
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-Medium.ttf differ
diff --git a/src/main/resources/Fonts/InknutAntiqua-Regular.ttf b/src/main/resources/Fonts/InknutAntiqua-Regular.ttf
new file mode 100644
index 0000000..241f222
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-Regular.ttf differ
diff --git a/src/main/resources/Fonts/InknutAntiqua-SemiBold.ttf b/src/main/resources/Fonts/InknutAntiqua-SemiBold.ttf
new file mode 100644
index 0000000..d169a5c
Binary files /dev/null and b/src/main/resources/Fonts/InknutAntiqua-SemiBold.ttf differ
diff --git a/src/main/resources/Fonts/OFL.txt b/src/main/resources/Fonts/OFL.txt
new file mode 100644
index 0000000..f18e45d
--- /dev/null
+++ b/src/main/resources/Fonts/OFL.txt
@@ -0,0 +1,93 @@
+Copyright (c) 2014 Claus Eggers Sørensen (es@forthehearts.net)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/main/resources/GUIImages/Background.png b/src/main/resources/GUIImages/Background.png
new file mode 100644
index 0000000..f342e39
Binary files /dev/null and b/src/main/resources/GUIImages/Background.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-001.png b/src/main/resources/GUIImages/Backs/back-001.png
index 89dec13..a0793ae 100644
Binary files a/src/main/resources/GUIImages/Backs/back-001.png and b/src/main/resources/GUIImages/Backs/back-001.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-030.png b/src/main/resources/GUIImages/Backs/back-030.png
index a196534..98bb464 100644
Binary files a/src/main/resources/GUIImages/Backs/back-030.png and b/src/main/resources/GUIImages/Backs/back-030.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-058.png b/src/main/resources/GUIImages/Backs/back-058.png
index a71865e..a36ca21 100644
Binary files a/src/main/resources/GUIImages/Backs/back-058.png and b/src/main/resources/GUIImages/Backs/back-058.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-095.png b/src/main/resources/GUIImages/Backs/back-095.png
index 8381fbc..f963717 100644
Binary files a/src/main/resources/GUIImages/Backs/back-095.png and b/src/main/resources/GUIImages/Backs/back-095.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-097.png b/src/main/resources/GUIImages/Backs/back-097.png
index 5905498..ee1bbdf 100644
Binary files a/src/main/resources/GUIImages/Backs/back-097.png and b/src/main/resources/GUIImages/Backs/back-097.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-103.png b/src/main/resources/GUIImages/Backs/back-103.png
index 033193c..b2ae7df 100644
Binary files a/src/main/resources/GUIImages/Backs/back-103.png and b/src/main/resources/GUIImages/Backs/back-103.png differ
diff --git a/src/main/resources/GUIImages/Backs/back-110.png b/src/main/resources/GUIImages/Backs/back-110.png
index efc1db5..88c01a7 100644
Binary files a/src/main/resources/GUIImages/Backs/back-110.png and b/src/main/resources/GUIImages/Backs/back-110.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-A.png b/src/main/resources/GUIImages/Fronts/card-A.png
index 805ba49..31bd2cf 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-A.png and b/src/main/resources/GUIImages/Fronts/card-A.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-B.png b/src/main/resources/GUIImages/Fronts/card-B.png
index 43ce33b..3e28b4d 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-B.png and b/src/main/resources/GUIImages/Fronts/card-B.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-C.png b/src/main/resources/GUIImages/Fronts/card-C.png
index a1ff0f8..7a99df1 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-C.png and b/src/main/resources/GUIImages/Fronts/card-C.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-D.png b/src/main/resources/GUIImages/Fronts/card-D.png
index c2c06cd..b87b2bc 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-D.png and b/src/main/resources/GUIImages/Fronts/card-D.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-E.png b/src/main/resources/GUIImages/Fronts/card-E.png
index d11087f..1a44b40 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-E.png and b/src/main/resources/GUIImages/Fronts/card-E.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-F.png b/src/main/resources/GUIImages/Fronts/card-F.png
index d387692..e413b45 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-F.png and b/src/main/resources/GUIImages/Fronts/card-F.png differ
diff --git a/src/main/resources/GUIImages/Fronts/card-G.png b/src/main/resources/GUIImages/Fronts/card-G.png
index 88d1515..71dba80 100644
Binary files a/src/main/resources/GUIImages/Fronts/card-G.png and b/src/main/resources/GUIImages/Fronts/card-G.png differ
diff --git a/src/main/resources/GUIImages/Icons/Artist.png b/src/main/resources/GUIImages/Icons/Artist.png
new file mode 100644
index 0000000..da912cd
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Artist.png differ
diff --git a/src/main/resources/GUIImages/Icons/Builder.png b/src/main/resources/GUIImages/Icons/Builder.png
new file mode 100644
index 0000000..f1c4456
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Builder.png differ
diff --git a/src/main/resources/GUIImages/Icons/Food.png b/src/main/resources/GUIImages/Icons/Food.png
new file mode 100644
index 0000000..c38606c
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Food.png differ
diff --git a/src/main/resources/GUIImages/Icons/Gatherer.png b/src/main/resources/GUIImages/Icons/Gatherer.png
new file mode 100644
index 0000000..1467953
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Gatherer.png differ
diff --git a/src/main/resources/GUIImages/Icons/Hunter.png b/src/main/resources/GUIImages/Icons/Hunter.png
new file mode 100644
index 0000000..303b034
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Hunter.png differ
diff --git a/src/main/resources/GUIImages/Icons/Inventor.png b/src/main/resources/GUIImages/Icons/Inventor.png
new file mode 100644
index 0000000..2847a49
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Inventor.png differ
diff --git a/src/main/resources/GUIImages/Icons/PrestigePoint.png b/src/main/resources/GUIImages/Icons/PrestigePoint.png
new file mode 100644
index 0000000..0c88ddd
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/PrestigePoint.png differ
diff --git a/src/main/resources/GUIImages/Icons/Shaman.png b/src/main/resources/GUIImages/Icons/Shaman.png
new file mode 100644
index 0000000..1997981
Binary files /dev/null and b/src/main/resources/GUIImages/Icons/Shaman.png differ
diff --git a/src/main/resources/GUIImages/Orders/order-2.png b/src/main/resources/GUIImages/Orders/order-2.png
new file mode 100644
index 0000000..d5fb664
Binary files /dev/null and b/src/main/resources/GUIImages/Orders/order-2.png differ
diff --git a/src/main/resources/GUIImages/Orders/order-3.png b/src/main/resources/GUIImages/Orders/order-3.png
new file mode 100644
index 0000000..07ddcdc
Binary files /dev/null and b/src/main/resources/GUIImages/Orders/order-3.png differ
diff --git a/src/main/resources/GUIImages/Orders/order-4.png b/src/main/resources/GUIImages/Orders/order-4.png
new file mode 100644
index 0000000..ad38d99
Binary files /dev/null and b/src/main/resources/GUIImages/Orders/order-4.png differ
diff --git a/src/main/resources/GUIImages/Orders/order-5.png b/src/main/resources/GUIImages/Orders/order-5.png
new file mode 100644
index 0000000..5bc424d
Binary files /dev/null and b/src/main/resources/GUIImages/Orders/order-5.png differ
diff --git a/src/main/resources/GUIImages/Totems/totem_0.png b/src/main/resources/GUIImages/Totems/totem_0.png
new file mode 100644
index 0000000..df06839
Binary files /dev/null and b/src/main/resources/GUIImages/Totems/totem_0.png differ
diff --git a/src/main/resources/GUIImages/Totems/totem_1.png b/src/main/resources/GUIImages/Totems/totem_1.png
new file mode 100644
index 0000000..dc6500a
Binary files /dev/null and b/src/main/resources/GUIImages/Totems/totem_1.png differ
diff --git a/src/main/resources/GUIImages/Totems/totem_2.png b/src/main/resources/GUIImages/Totems/totem_2.png
new file mode 100644
index 0000000..4002357
Binary files /dev/null and b/src/main/resources/GUIImages/Totems/totem_2.png differ
diff --git a/src/main/resources/GUIImages/Totems/totem_3.png b/src/main/resources/GUIImages/Totems/totem_3.png
new file mode 100644
index 0000000..76fef78
Binary files /dev/null and b/src/main/resources/GUIImages/Totems/totem_3.png differ
diff --git a/src/main/resources/GUIImages/Totems/totem_4.png b/src/main/resources/GUIImages/Totems/totem_4.png
new file mode 100644
index 0000000..87bd796
Binary files /dev/null and b/src/main/resources/GUIImages/Totems/totem_4.png differ
diff --git a/src/main/resources/GUIScene/main.fxml b/src/main/resources/GUIScene/main.fxml
index 2a5b6c7..62d9eb4 100644
--- a/src/main/resources/GUIScene/main.fxml
+++ b/src/main/resources/GUIScene/main.fxml
@@ -1,23 +1,71 @@
-
+
+
-
-
+
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/GUIScene/styles.css b/src/main/resources/GUIScene/styles.css
new file mode 100644
index 0000000..77d2670
--- /dev/null
+++ b/src/main/resources/GUIScene/styles.css
@@ -0,0 +1,50 @@
+.card-list {
+ -fx-background-color: rgba(255,255,255,0.35);
+ -fx-background-radius: 15;
+ -fx-padding: 10;
+}
+
+.side-panel {
+ -fx-background-color: rgba(255,255,255,0.35);
+ -fx-background-radius: 15;
+}
+
+.label-small {
+ -fx-font-family: 'Inknut Antiqua';
+ -fx-font-size: 12px;
+ -fx-font-weight: bold;
+ -fx-text-fill: black;
+}
+
+.label-medium {
+ -fx-font-family: 'Inknut Antiqua';
+ -fx-font-size: 18px;
+ -fx-font-weight: bold;
+ -fx-text-fill: black;
+}
+
+.label-large {
+ -fx-font-family: 'Inknut Antiqua';
+ -fx-font-size: 50px;
+ -fx-font-weight: bold;
+ -fx-text-fill: black;
+}
+
+.player-card {
+ -fx-border-color: #6a040f;
+ -fx-border-width: 2;
+ -fx-border-radius: 15;
+ -fx-background-radius: 15;
+ -fx-background-color: #f48c06;
+}
+
+.frame {
+ -fx-background-color:
+ #8B6914,
+ #FFF8DC,
+ #8B6914,
+ #FFF8DC;
+ -fx-background-insets: 0, 5, 10, 15;
+ -fx-background-radius: 15, 12, 8, 4;
+ -fx-padding: 15 15 15 15;
+}
\ No newline at end of file