Merge branch 'development' of https://github.com/PTE-SH/ShadowHunterGame into development
This commit is contained in:
commit
3e13aefcce
@ -14,7 +14,7 @@ public class Musique {
|
|||||||
public static long clipTimePosition = 0;
|
public static long clipTimePosition = 0;
|
||||||
|
|
||||||
public static boolean musiqueEnCours = false;
|
public static boolean musiqueEnCours = false;
|
||||||
static FloatControl volume ;
|
public static FloatControl volume ;
|
||||||
|
|
||||||
public static void playMusique(InputStream path) {
|
public static void playMusique(InputStream path) {
|
||||||
|
|
||||||
@ -62,4 +62,13 @@ public class Musique {
|
|||||||
volume.setValue(volume.getValue() -valeur);
|
volume.setValue(volume.getValue() -valeur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setVolume(Float fValeur) {
|
||||||
|
volume.setValue(fValeur);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setVolume(double dValeur) {
|
||||||
|
float decibel = (float) (Math.log(dValeur) / Math.log(10) * 20);
|
||||||
|
volume.setValue(decibel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import javafx.fxml.FXMLLoader;
|
|||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
|
import javafx.scene.control.Slider;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
@ -28,9 +29,13 @@ public class ParametreController implements Initializable {
|
|||||||
private CheckBox clair;
|
private CheckBox clair;
|
||||||
@FXML
|
@FXML
|
||||||
private ComboBox<String> langues;
|
private ComboBox<String> langues;
|
||||||
|
@FXML
|
||||||
|
private Slider sliderMusique;
|
||||||
|
|
||||||
public static boolean cbMusiqueCoche = false; // verifi si la checbox musical est coche
|
public static boolean cbMusiqueCoche = false; // verifi si la checbox musical est coche
|
||||||
public static boolean cbSonCoche = false;
|
public static boolean cbSonCoche = false;
|
||||||
public static boolean cbClair = false;
|
public static boolean cbClair = false;
|
||||||
|
public static double slideValue;
|
||||||
|
|
||||||
boolean MusiqueLancee = false; //verifi si la musique a déja été lancé une première fois
|
boolean MusiqueLancee = false; //verifi si la musique a déja été lancé une première fois
|
||||||
|
|
||||||
@ -48,7 +53,7 @@ public class ParametreController implements Initializable {
|
|||||||
cmusique.setSelected(cbMusiqueCoche);
|
cmusique.setSelected(cbMusiqueCoche);
|
||||||
cbEffetSonore.setSelected(cbSonCoche);
|
cbEffetSonore.setSelected(cbSonCoche);
|
||||||
clair.setSelected(cbClair);
|
clair.setSelected(cbClair);
|
||||||
|
sliderMusique.setValue(slideValue);
|
||||||
|
|
||||||
|
|
||||||
langues.getItems().add("Anglais");
|
langues.getItems().add("Anglais");
|
||||||
@ -74,6 +79,7 @@ public class ParametreController implements Initializable {
|
|||||||
|
|
||||||
} else if (Musique.musiqueEnCours != true) {
|
} else if (Musique.musiqueEnCours != true) {
|
||||||
Musique.resumeMusique(Musique.clip); // si elle a deja été lancé mais mis en pause, reprend a partir du point d'arret
|
Musique.resumeMusique(Musique.clip); // si elle a deja été lancé mais mis en pause, reprend a partir du point d'arret
|
||||||
|
Musique.musiqueEnCours = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -150,6 +156,16 @@ public class ParametreController implements Initializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void slideVolumeMusique(MouseEvent mouseEvent) throws IOException{
|
||||||
|
|
||||||
|
if(Musique.musiqueEnCours == true) {
|
||||||
|
Musique.setVolume(sliderMusique.getValue());
|
||||||
|
slideValue = sliderMusique.getValue();
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void monterVolume(MouseEvent mouseEvent) throws IOException{
|
public void monterVolume(MouseEvent mouseEvent) throws IOException{
|
||||||
Musique.volumeUp(5.f);
|
Musique.volumeUp(5.f);
|
||||||
@ -161,5 +177,10 @@ public class ParametreController implements Initializable {
|
|||||||
Musique.volumeDown(5.f);
|
Musique.volumeDown(5.f);
|
||||||
System.out.println("on baisse le son");
|
System.out.println("on baisse le son");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import ihm.EffetSonore;
|
import ihm.EffetSonore;
|
||||||
@ -13,33 +12,34 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.Slider;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import main.GestionnaireJeu;
|
import main.GestionnaireJeu;
|
||||||
import main.Joueur;
|
|
||||||
|
|
||||||
public class PauseController implements Initializable {
|
public class PauseController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbMusique;
|
private CheckBox cbMusique;
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox cbEffet;
|
private CheckBox cbEffet;
|
||||||
|
@FXML
|
||||||
|
private Slider sliderMusiquePause;
|
||||||
|
|
||||||
String filepathMusique = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav";
|
String filepathMusique = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav";
|
||||||
InputStream fileMusique = getClass().getResourceAsStream("/ihm/ressources/musique/The_Red_Fox_Tavern.wav");
|
InputStream fileMusique = getClass().getResourceAsStream("/ihm/ressources/musique/The_Red_Fox_Tavern.wav");
|
||||||
|
|
||||||
boolean MusiqueLancee = ParametreController.cbMusiqueCoche;
|
boolean MusiqueLancee = ParametreController.cbMusiqueCoche;
|
||||||
boolean SonLance = ParametreController.cbSonCoche;
|
boolean SonLance = ParametreController.cbSonCoche;
|
||||||
|
public static double slideValuePause;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
|
|
||||||
cbMusique.setSelected(ParametreController.cbMusiqueCoche);
|
cbMusique.setSelected(ParametreController.cbMusiqueCoche);
|
||||||
cbEffet.setSelected(ParametreController.cbSonCoche);
|
cbEffet.setSelected(ParametreController.cbSonCoche);
|
||||||
|
sliderMusiquePause.setValue(ParametreController.slideValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -56,11 +56,12 @@ public class PauseController implements Initializable {
|
|||||||
Musique.playMusique(fileMusique);
|
Musique.playMusique(fileMusique);
|
||||||
Musique.musiqueEnCours = true;
|
Musique.musiqueEnCours = true;
|
||||||
MusiqueLancee = true;
|
MusiqueLancee = true;
|
||||||
} else if (MusiqueLancee ==false && Musique.musiqueEnCours != true) {
|
} else if (MusiqueLancee == false && Musique.musiqueEnCours != true) {
|
||||||
Musique.resumeMusique(Musique.clip); // si elle a deja été lancé mais mis en pause, reprend a partir du point d'arret
|
Musique.resumeMusique(Musique.clip); // si elle a deja été lancé mais mis en pause, reprend a partir du point d'arret
|
||||||
|
Musique.musiqueEnCours = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (MusiqueLancee == true){
|
} else if (MusiqueLancee == true) {
|
||||||
Musique.pauseMusique(Musique.clip); // met en pause la musique
|
Musique.pauseMusique(Musique.clip); // met en pause la musique
|
||||||
Musique.musiqueEnCours = false;
|
Musique.musiqueEnCours = false;
|
||||||
MusiqueLancee = false;
|
MusiqueLancee = false;
|
||||||
@ -82,6 +83,7 @@ public class PauseController implements Initializable {
|
|||||||
|
|
||||||
ParametreController.cbSonCoche = cbEffet.isSelected();
|
ParametreController.cbSonCoche = cbEffet.isSelected();
|
||||||
ParametreController.cbMusiqueCoche = cbMusique.isSelected();
|
ParametreController.cbMusiqueCoche = cbMusique.isSelected();
|
||||||
|
ParametreController.slideValue = slideValuePause;
|
||||||
|
|
||||||
EffetSonore.playSoundEffect(fileSound1); // met un bruit sur le bouton si les effets sonores sont activés
|
EffetSonore.playSoundEffect(fileSound1); // met un bruit sur le bouton si les effets sonores sont activés
|
||||||
|
|
||||||
@ -99,14 +101,13 @@ public class PauseController implements Initializable {
|
|||||||
Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow();
|
Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow();
|
||||||
appStage.close();
|
appStage.close();
|
||||||
|
|
||||||
/* final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
/*
|
||||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH);
|
* final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
* final ResourceBundle bundle =
|
||||||
AnchorPane root = fxmlLoader.load(); */
|
* 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 URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH);
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH);
|
||||||
@ -116,15 +117,32 @@ public class PauseController implements Initializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void monterVolume(MouseEvent mouseEvent) throws IOException{
|
public void slideVolumeMusique(MouseEvent mouseEvent) throws IOException {
|
||||||
|
|
||||||
|
if (Musique.musiqueEnCours == true) {
|
||||||
|
System.out.println("slide");
|
||||||
|
Musique.setVolume(sliderMusiquePause.getValue());
|
||||||
|
slideValuePause = sliderMusiquePause.getValue();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
System.out.println("probleme");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@FXML
|
||||||
|
public void monterVolume(MouseEvent mouseEvent) throws IOException {
|
||||||
Musique.volumeUp(5.f);
|
Musique.volumeUp(5.f);
|
||||||
System.out.println("on monte le son");
|
System.out.println("on monte le son");
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void baisserVolume(MouseEvent mouseEvent) throws IOException{
|
public void baisserVolume(MouseEvent mouseEvent) throws IOException {
|
||||||
Musique.volumeDown(5.f);
|
Musique.volumeDown(5.f);
|
||||||
System.out.println("on baisse le son");
|
System.out.println("on baisse le son");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.CheckBox?>
|
<?import javafx.scene.control.CheckBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.Slider?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
@ -45,28 +46,10 @@
|
|||||||
<Insets bottom="5.0" />
|
<Insets bottom="5.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox prefHeight="38.0" prefWidth="337.0">
|
<HBox prefHeight="0.0" prefWidth="540.0">
|
||||||
<children>
|
<children>
|
||||||
<Button mnemonicParsing="false" onMouseClicked="#monterVolume" text="Volume +">
|
<Slider fx:id="sliderMusiquePause" blockIncrement="1.0" majorTickUnit="1.0" max="1.0" minorTickCount="10" onMouseClicked="#slideVolumeMusique" prefHeight="14.0" prefWidth="194.0" showTickLabels="true" showTickMarks="true" value="0.1" />
|
||||||
<font>
|
|
||||||
<Font size="14.0" />
|
|
||||||
</font>
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets right="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
<Button mnemonicParsing="false" onMouseClicked="#baisserVolume" text="Volume -">
|
|
||||||
<font>
|
|
||||||
<Font size="14.0" />
|
|
||||||
</font>
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets left="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
|
||||||
<Insets bottom="10.0" top="10.0" />
|
|
||||||
</padding>
|
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER_LEFT">
|
<HBox alignment="CENTER_LEFT">
|
||||||
<children>
|
<children>
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
<?import javafx.scene.control.CheckBox?>
|
<?import javafx.scene.control.CheckBox?>
|
||||||
<?import javafx.scene.control.ComboBox?>
|
<?import javafx.scene.control.ComboBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.Slider?>
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<Pane fx:id="rootPane" prefHeight="595.0" prefWidth="758.0" styleClass="background" stylesheets="@style/menu.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ParametreController">
|
<Pane fx:id="rootPane" onMouseClicked="#slideVolumeMusique" prefHeight="595.0" prefWidth="758.0" styleClass="background" stylesheets="@style/menu.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ParametreController">
|
||||||
<children>
|
<children>
|
||||||
<HBox alignment="TOP_CENTER" layoutX="146.0" layoutY="171.0" prefHeight="242.0" prefWidth="507.0" spacing="10.0">
|
<HBox alignment="TOP_CENTER" layoutX="146.0" layoutY="171.0" prefHeight="242.0" prefWidth="507.0" spacing="10.0">
|
||||||
<children>
|
<children>
|
||||||
@ -18,23 +19,7 @@
|
|||||||
<children>
|
<children>
|
||||||
<CheckBox fx:id="clair" mnemonicParsing="false" styleClass="checkBox" text="%mode.claire" />
|
<CheckBox fx:id="clair" mnemonicParsing="false" styleClass="checkBox" text="%mode.claire" />
|
||||||
<CheckBox fx:id="cmusique" mnemonicParsing="false" styleClass="checkBox" text="%musique" />
|
<CheckBox fx:id="cmusique" mnemonicParsing="false" styleClass="checkBox" text="%musique" />
|
||||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="195.0">
|
<Slider fx:id="sliderMusique" blockIncrement="1.0" majorTickUnit="1.0" max="1.0" minorTickCount="10" onMouseClicked="#slideVolumeMusique" showTickLabels="true" showTickMarks="true" value="0.1" />
|
||||||
<children>
|
|
||||||
<Button mnemonicParsing="false" onMouseClicked="#monterVolume" styleClass="bouton" stylesheets="@style/menu.css" text="Volume +">
|
|
||||||
<opaqueInsets>
|
|
||||||
<Insets />
|
|
||||||
</opaqueInsets>
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets right="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
<Button layoutX="10.0" layoutY="10.0" mnemonicParsing="false" onMouseClicked="#baisserVolume" styleClass="bouton" stylesheets="@style/menu.css" text="Volume -">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets left="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<CheckBox fx:id="cbEffetSonore" mnemonicParsing="false" styleClass="checkBox" text="%effet" />
|
<CheckBox fx:id="cbEffetSonore" mnemonicParsing="false" styleClass="checkBox" text="%effet" />
|
||||||
<VBox prefHeight="86.0" prefWidth="195.0" spacing="10.0">
|
<VBox prefHeight="86.0" prefWidth="195.0" spacing="10.0">
|
||||||
<children>
|
<children>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user