effets sonores fonctionnels
This commit is contained in:
parent
eb5aacc8ce
commit
c94e1a46af
@ -8,15 +8,11 @@ import javax.sound.sampled.Clip;
|
||||
|
||||
public class EffetSonore {
|
||||
|
||||
boolean soundOK;
|
||||
static boolean soundOK;
|
||||
|
||||
public EffetSonore() {
|
||||
this.soundOK = false;
|
||||
}
|
||||
public static void playSoundEffect(String path) {
|
||||
|
||||
public void playSoundEffect(String path) {
|
||||
|
||||
if (this.soundOK == true) {
|
||||
if (soundOK == true) {
|
||||
|
||||
try {
|
||||
|
||||
@ -41,16 +37,18 @@ public class EffetSonore {
|
||||
|
||||
}
|
||||
|
||||
public boolean isSoundOK() {
|
||||
public static boolean isSoundOK() {
|
||||
return soundOK;
|
||||
}
|
||||
|
||||
public void setSoundOK(boolean soundOK) {
|
||||
this.soundOK = soundOK;
|
||||
public static void setSoundOK(boolean soundOK) {
|
||||
EffetSonore.soundOK = soundOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ihm.EffetSonore;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.Node;
|
||||
|
||||
public class MenuController implements Initializable{
|
||||
@FXML private AnchorPane rootPane;
|
||||
@ -32,6 +32,9 @@ public class MenuController implements Initializable{
|
||||
|
||||
@FXML
|
||||
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
|
||||
|
||||
EffetSonore.playSoundEffect("src//ihm//ressources//musique//BEEP1.wav");
|
||||
|
||||
System.out.println("Passage à l'écran de choix des joueurs");
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Choix_joueur.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
@ -41,9 +44,12 @@ public class MenuController implements Initializable{
|
||||
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
|
||||
appStage.setScene(scene);
|
||||
appStage.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void afficherRegle(MouseEvent mouseEvent) {
|
||||
EffetSonore.playSoundEffect("src//ihm//ressources//musique//BEEP1.wav");
|
||||
System.out.println("blaaaa");
|
||||
|
||||
}
|
||||
|
@ -31,8 +31,6 @@ public class ParametreController implements Initializable {
|
||||
boolean coche = false; // verifi si la checbox musical est coche
|
||||
boolean MusiqueLancee = false; //verifi si la musique a déja été lancé une première fois
|
||||
|
||||
public EffetSonore soundEffects = new EffetSonore();
|
||||
|
||||
String filepathMusique = "/ihm/ressources/musique/The_Red_Fox_Tavern.wav"; // lien vers la musique : https://www.youtube.com/watch?v=LBpKUIyOHdo
|
||||
InputStream fileMusique = getClass().getResourceAsStream("/ihm/ressources/musique/The_Red_Fox_Tavern.wav");
|
||||
|
||||
@ -82,14 +80,14 @@ public class ParametreController implements Initializable {
|
||||
|
||||
//Pour les effets sonores
|
||||
if (cbEffetSonore.isSelected() == true) {
|
||||
soundEffects.setSoundOK(true);
|
||||
EffetSonore.setSoundOK(true);
|
||||
|
||||
System.out.println(soundEffects.isSoundOK());
|
||||
System.out.println(EffetSonore.isSoundOK());
|
||||
}
|
||||
|
||||
else {
|
||||
soundEffects.setSoundOK(false);
|
||||
System.out.println(soundEffects.isSoundOK());
|
||||
EffetSonore.setSoundOK(false);
|
||||
System.out.println(EffetSonore.isSoundOK());
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +120,7 @@ public class ParametreController implements Initializable {
|
||||
|
||||
}*/
|
||||
|
||||
soundEffects.playSoundEffect("src//ihm//ressources//musique//BEEP1.wav"); //emet un bruit sur le bouton si les effets sonores sont activés
|
||||
EffetSonore.playSoundEffect("src//ihm//ressources//musique//BEEP1.wav"); //emet un bruit sur le bouton si les effets sonores sont activés
|
||||
|
||||
// Quitter les paramètres
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||
@ -136,18 +134,4 @@ public class ParametreController implements Initializable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//getters and setters
|
||||
public EffetSonore getSoundEffects() {
|
||||
return soundEffects;
|
||||
}
|
||||
|
||||
public void setSoundEffects(EffetSonore soundEffects) {
|
||||
this.soundEffects = soundEffects;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ihm.Couple;
|
||||
import ihm.EffetSonore;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
@ -118,6 +119,8 @@ public class PlayersController implements Initializable{
|
||||
// Creer une configuration
|
||||
//View.applyConfiguration(new Configuration(joueurs, nbJoueursV, nbJoueursH));
|
||||
|
||||
EffetSonore.playSoundEffect("src//ihm//ressources//musique//BEEP1.wav");
|
||||
|
||||
System.out.println(this.joueurs);
|
||||
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
||||
gj.setConfiguration(new Configuration(this.joueurs));
|
||||
@ -139,6 +142,7 @@ public class PlayersController implements Initializable{
|
||||
appStage.setScene(scene);
|
||||
appStage.show();
|
||||
gj.lancerPartie();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user