diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java index fbda80d..dcb7cee 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java @@ -311,7 +311,7 @@ public class Player implements Serializable { } if(!this.gatherers.isEmpty()){ - table.addRow(this.gatherers.size() + " Gatherers: \uD83C\uDF56:-" + 3*this.gatherers.size()); + table.addRow(this.gatherers.size() + " Gatherers: \uD83C\uDF56:" + 3*this.gatherers.size()); if(last == 3){ table.addSeparator(); } 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 94940e8..3e92be3 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 @@ -6,6 +6,8 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Cards.TribeCard; import it.polimi.ingsw.gc14.Model.Orders.OrderPlayer; import it.polimi.ingsw.gc14.Network.EventType; +import javafx.application.Platform; +import javafx.animation.PauseTransition; import javafx.animation.ScaleTransition; import javafx.animation.TranslateTransition; import javafx.event.Event; @@ -54,6 +56,8 @@ public class MainFXMLController { @FXML private Button skipBtn; /** Button that opens the game details popup. */ @FXML private Button detailsBtn; + /** Button that disconnects and closes the client. */ + @FXML private Button quitBtn; /** Label showing the current round number and game stage. */ @FXML private Label infoText; /** Maps each player's username to their current food-value label in the side panel. */ @@ -98,6 +102,30 @@ public class MainFXMLController { public void setController(ClientController controller) { this.controller = controller; skipBtn.setOnAction(e -> controller.skipTurn()); + + PauseTransition quitTimer = new PauseTransition(javafx.util.Duration.seconds(3)); + quitTimer.setOnFinished(e -> { + quitBtn.setText("Quit"); + quitBtn.setStyle(""); + }); + final boolean[] quitPending = {false}; + quitBtn.setOnAction(e -> { + if (quitPending[0]) { + controller.disconnect(); + Platform.exit(); + System.exit(0); + } else { + quitPending[0] = true; + quitBtn.setText("Sure?"); + quitBtn.setStyle("-fx-background-color: #c0392b; -fx-text-fill: white;"); + quitTimer.playFromStart(); + quitTimer.setOnFinished(ev -> { + quitPending[0] = false; + quitBtn.setText("Quit"); + quitBtn.setStyle(""); + }); + } + }); } /** Initializes the scene: loads fonts, sets up the popup, and registers input listeners. */ @@ -107,6 +135,7 @@ public class MainFXMLController { addHoverZoom(skipBtn); addHoverZoom(detailsBtn); + addHoverZoom(quitBtn); popup = new Popup(); mainHBox.sceneProperty().addListener((obs, oldScene, newScene) -> { if (newScene != null) { diff --git a/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java b/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java index 9650605..5d581b9 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java @@ -295,8 +295,8 @@ public class TUI implements IView { var upperCards = new AsciiTable(BorderStyle.ROUNDED, 2); var lowerCards = new AsciiTable(BorderStyle.ROUNDED, 2); - upperCards.addHeader("Char/Events", "Building"); - lowerCards.addHeader("Char/Events", "Building"); + upperCards.addHeader("Char/\033[38;5;180mEvents\033[0m", "Building"); + lowerCards.addHeader("Char/\033[38;5;180mEvents\033[0m", "Building"); int maxU = Math.max(model.upperListTribeCards.size(), model.upperListBuildingCards.size()); for (int i = 0; i < maxU; i++) { diff --git a/src/main/resources/GUIScene/main.fxml b/src/main/resources/GUIScene/main.fxml index f8a964b..741629d 100644 --- a/src/main/resources/GUIScene/main.fxml +++ b/src/main/resources/GUIScene/main.fxml @@ -70,7 +70,8 @@