From 7a689e600728151a16f63144160d7009b166a186 Mon Sep 17 00:00:00 2001 From: Kruss Date: Tue, 12 May 2020 09:40:11 +0200 Subject: [PATCH] impl bouton quitter jeu --- src/ihm/controller/MenuController.java | 1 - src/ihm/controller/PauseController.java | 15 ++------------- src/ihm/controller/PlateauController.java | 11 ++++++++++- src/main/GestionnaireJeu.java | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/ihm/controller/MenuController.java b/src/ihm/controller/MenuController.java index 5e2685d..2638250 100644 --- a/src/ihm/controller/MenuController.java +++ b/src/ihm/controller/MenuController.java @@ -3,7 +3,6 @@ package ihm.controller; import java.io.IOException; import java.io.InputStream; import java.net.URL; -import java.util.Locale; import java.util.ResourceBundle; import ihm.EffetSonore; diff --git a/src/ihm/controller/PauseController.java b/src/ihm/controller/PauseController.java index 339a039..eb10d54 100644 --- a/src/ihm/controller/PauseController.java +++ b/src/ihm/controller/PauseController.java @@ -117,21 +117,10 @@ public class PauseController implements Initializable { EffetSonore.playSoundEffect(fileSound1); GestionnaireJeu.endGame(); System.err.println("Fin de partie"); + PlateauController platcontr = GestionnaireJeu.pc; Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow(); appStage.close(); - - /* - * final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml"); - * final ResourceBundle bundle = - * ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH); final - * FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); AnchorPane root = - * fxmlLoader.load(); - */ - - final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml"); - final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH); - final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); - AnchorPane root = fxmlLoader.load(); + platcontr.close(); } diff --git a/src/ihm/controller/PlateauController.java b/src/ihm/controller/PlateauController.java index 8127b98..ef9f053 100644 --- a/src/ihm/controller/PlateauController.java +++ b/src/ihm/controller/PlateauController.java @@ -50,7 +50,6 @@ public class PlateauController implements Initializable { @FXML private GridPane gridPaneVie; @FXML public GridPane gridPaneLieux; - private ChoisirBoolean cb; private ChoisirEquipement ce; private ChoisirJoueur cj; @@ -464,6 +463,16 @@ public class PlateauController implements Initializable { jihm.retirerEquipement(e); } + + public void close () throws IOException { + final URL fxmlURL = PlateauController.class.getResource("/ihm/ressources/Menu.fxml"); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); + + final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); + Pane pane = fxmlLoader.load(); + rootPane.getChildren().setAll(pane); + } + diff --git a/src/main/GestionnaireJeu.java b/src/main/GestionnaireJeu.java index b639971..bc2abf1 100644 --- a/src/main/GestionnaireJeu.java +++ b/src/main/GestionnaireJeu.java @@ -24,7 +24,7 @@ public class GestionnaireJeu { private RessourceLoader ressourceLoader; private static Plateau plateau; - private static PlateauController pc; + public static PlateauController pc; private GestionnaireJeu() {}