From 8627870e86ce1aad8762a1d731468c149fde1844 Mon Sep 17 00:00:00 2001 From: Chiara Date: Mon, 4 May 2020 16:07:25 +0200 Subject: [PATCH] ajout menu pause --- src/ihm/controller/PauseController.java | 76 ++++++++++++++++ src/ihm/controller/PlateauController.java | 13 +++ src/ihm/ressources/Pause.fxml | 104 ++++++++++++++++++++++ src/ihm/ressources/PlateauTest2.fxml | 12 +++ src/ihm/ressources/img/pause.png | Bin 0 -> 11536 bytes 5 files changed, 205 insertions(+) create mode 100644 src/ihm/controller/PauseController.java create mode 100644 src/ihm/ressources/Pause.fxml create mode 100644 src/ihm/ressources/img/pause.png diff --git a/src/ihm/controller/PauseController.java b/src/ihm/controller/PauseController.java new file mode 100644 index 0000000..545c7ff --- /dev/null +++ b/src/ihm/controller/PauseController.java @@ -0,0 +1,76 @@ +package ihm.controller; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ResourceBundle; + +import ihm.EffetSonore; +import ihm.Musique; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.Node; +import javafx.scene.control.CheckBox; +import javafx.scene.input.MouseEvent; +import javafx.stage.Stage; + +public class PauseController implements Initializable{ + @FXML private CheckBox cbMusique; + @FXML private CheckBox cbEffet; + + String filepathMusique = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav"; + InputStream fileInput = getClass().getResourceAsStream("src//ihm//ressources//musique//The_Red_Fox_Tavern.wav"); + File fileMusique = new File("src//ihm//ressources//musique//The_Red_Fox_Tavern.wav"); + + public EffetSonore soundEffects = new EffetSonore(); + + @Override + public void initialize(URL arg0, ResourceBundle arg1) { + // TODO Auto-generated method stub + + } + + @FXML + public void reprendre(MouseEvent me) { + //Pour la musique + boolean MusiqueLancee = false; + if (fileMusique.exists()) { + if (cbMusique.isSelected()) { + System.out.println("\tLancement de la musique"); + if (Musique.clipTimePosition == 0 && MusiqueLancee == false) { // si la musique n'a jamais été lancé + Musique.playMusique(fileInput); + MusiqueLancee = true; + } else Musique.resumeMusique(Musique.clip); // si elle a deja été lancé mais mis en pause, reprend a partir du point d'arret + } else { + Musique.pauseMusique(Musique.clip); //met en pause la musique + System.out.println("\tMise en pause de la musique"); + } + } + + //Pour les effets sonores + if (cbEffet.isSelected() == true) { + System.out.println("\tEffets sonores activé"); + soundEffects.setSoundOK(true); + }else { + System.out.println("\tEffets sonores désactivé"); + soundEffects.setSoundOK(false); + } + + soundEffects.playSoundEffect("src//ihm//ressources//musique//BEEP1.wav"); //met un bruit sur le bouton si les effets sonores sont activés + + System.out.println("Retour au jeu"); + Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow(); + appStage.close(); + } + + + @FXML + public void quitter(MouseEvent me) throws IOException { + System.err.println("Fin de partie"); + Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow(); + appStage.close(); + + + } +} diff --git a/src/ihm/controller/PlateauController.java b/src/ihm/controller/PlateauController.java index 3b3f2b8..1934a2b 100644 --- a/src/ihm/controller/PlateauController.java +++ b/src/ihm/controller/PlateauController.java @@ -18,6 +18,7 @@ import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.control.Label; +import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; @@ -293,4 +294,16 @@ public class PlateauController implements Initializable { jIHM.deplacerPionVie(damage);*/ } + + @FXML + public void mettreEnPause(MouseEvent me) throws IOException { + System.out.println("Jeu en pause ..."); + final URL fxmlURL = getClass().getResource("../ressources/Pause.fxml"); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); + final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); + Pane root = (Pane)fxmlLoader.load(); + + PopUp pu = new PopUp(root, "Pause"); + pu.display(); + } } \ No newline at end of file diff --git a/src/ihm/ressources/Pause.fxml b/src/ihm/ressources/Pause.fxml new file mode 100644 index 0000000..5da995b --- /dev/null +++ b/src/ihm/ressources/Pause.fxml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ihm/ressources/PlateauTest2.fxml b/src/ihm/ressources/PlateauTest2.fxml index 9e296ec..3233098 100644 --- a/src/ihm/ressources/PlateauTest2.fxml +++ b/src/ihm/ressources/PlateauTest2.fxml @@ -355,6 +355,18 @@ + diff --git a/src/ihm/ressources/img/pause.png b/src/ihm/ressources/img/pause.png new file mode 100644 index 0000000000000000000000000000000000000000..55ac7fb4462f2be1bab9200d9c288d654d2db0e0 GIT binary patch literal 11536 zcma)Cc|6qH`#)nXl#Ie92H7fGWx1ANV#;>2wBE?5w5VyQ$jlgnl9(hy+{n^&D=nIv zHO!#Rnq^8&k&%56!x$zEejnZMm+#H}cXe1Lr7Q&i zSmor1-VJ~V^iu?^kbwU22`$smKUm;y2Rrbzas2?)5Iebj*LDD&#Y+p1h(qm_XB`g) z0-)Ho@CS22jco)#|DF?i`(6TOxSjaq(1qFgF_(*Vo-u1-4_mLU>XOJ?;X#c8T@qK- z!;XJIQCD1Y9+kbEoclrvFM<})-1OXIgO-HJ+O-}lVrvvcqzrEEPf%FXD&pNI2=T6( zGvv3kZ%y5{=nriq+9Wv~eTu(j5!l#2eqYe|c7@z=X4Tdm!71ck<0<-W!;Tb0J+0TX z1mmArQI~N(%UXZDr-N6Ze`B5ZT*urW^S0sFZCO6uv6Fa|A zc&ucvf9m@AA%`>RKFFcFBz&L1$X96wkp59Q@ z_I!SkI(2B=qCc>yUtLb_X7l~?&)=pThZ{7b4u-CtKE$^e2uzBJk$THD6gW-Y8#O_; z+-%yFb=T$q(E+VVg^lmYTb;bQ*Mg#ODEnz>QVT6dV@W)f>p}FQ>sY zsrw7=tlw0jh{=}3^%CCeP$jN=MoIjo)o=SX-mR62<@jZ=K_$FU6CTIVY zw!2$mxN`vkrdPG03mccJszY^7*P6R~?+x5wKe+OWb(@CtiA1CC_0CU!Pt#BI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