From abc6668bff7d4fe4148cb36bcdd14a14c63846d1 Mon Sep 17 00:00:00 2001 From: cemal Date: Sat, 4 Jun 2022 18:46:24 +0200 Subject: [PATCH] few changes to finished screen --- .../java/latice/application/LaticeApplicationWindow.java | 9 ++++++--- .../latice/controller/GameFinishedScreenController.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index 16ce422..c724798 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -351,11 +351,14 @@ public class LaticeApplicationWindow extends Application { private void switchToGameFinishedScreen() throws IOException { System.out.println("confirmBtnClickedCount : " + confirmBtnClickedCount); - if (confirmBtnClickedCount>=2) { + if (confirmBtnClickedCount>=20) { Parent loader = FXMLLoader.load(getClass().getResource("../view/GameFinishedScreen.fxml")); Scene gameFinishedScreenScene = new Scene(loader, 1280, 720); - System.out.println("lancement :::::" + stage); - //TODO saisir le nom du gagnant : GameFinishedScreenController.nameWinner.setText(); + if (confirmBtnClickedCount%2 == 0) { + GameFinishedScreenController.nameWinner.setText(player1.getName()); + }else { + GameFinishedScreenController.nameWinner.setText(player2.getName()); + } stage.setScene(gameFinishedScreenScene); //---------------------------------------- diff --git a/src/main/java/latice/controller/GameFinishedScreenController.java b/src/main/java/latice/controller/GameFinishedScreenController.java index ee92af2..a751711 100644 --- a/src/main/java/latice/controller/GameFinishedScreenController.java +++ b/src/main/java/latice/controller/GameFinishedScreenController.java @@ -12,7 +12,7 @@ public class GameFinishedScreenController { @FXML private Button quitBtn; @FXML - public static Label nameWinner; + public static Label nameWinner = new Label(); // Event Listener on Button[#replayBtn].onMouseClicked @FXML