possibilité d'accéder aux regles depuis le menu pause

This commit is contained in:
Bastien NOEL 2020-05-10 16:00:46 +02:00
parent 57376feddb
commit 0cb58a15aa
5 changed files with 100 additions and 5 deletions

View File

@ -164,11 +164,11 @@ public class ParametreController implements Initializable {
* }
*/
// Quitter les paramètres
EffetSonore.playSoundEffect(fileSound1); // emet un bruit sur le bouton si les effets sonores sont activés
System.out.println("slidevalueeffet enregistre = " + slideValueEffets);
// Quitter les paramètres
final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue",
ParametreController.LaLangue);

View File

@ -12,6 +12,8 @@ import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Slider;
import javafx.scene.input.MouseEvent;
@ -28,6 +30,9 @@ public class PauseController implements Initializable {
private Slider sliderMusiquePause;
@FXML
private Slider sliderEffetsPause;
@FXML
private Button reglesPause;
String filepathMusique = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav";
InputStream fileMusique = getClass().getResourceAsStream("/ihm/ressources/musique/The_Red_Fox_Tavern.wav");
@ -141,6 +146,24 @@ public class PauseController implements Initializable {
EffetSonore.setVolumeEffets(sliderEffetsPause.getValue());
slideValueEffetPause = sliderEffetsPause.getValue();
}
@FXML
public void afficherReglePause(MouseEvent mouseEvent) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("Passage à l'écran des règles");
final URL fxmlURL = getClass().getResource("/ihm/ressources/ReglesPause.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", ParametreController.LaLangue);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
AnchorPane pane = fxmlLoader.load();
Scene scene = new Scene(pane);
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
appStage.setScene(scene);
appStage.show();
}
/*

View File

@ -110,4 +110,17 @@ public class ReglesControlleur implements Initializable {
}
@FXML
public void retourEnJeu(MouseEvent me) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("Retour au jeu");
Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow();
appStage.close();
}
}

View File

@ -69,6 +69,14 @@
<Slider fx:id="sliderEffetsPause" blockIncrement="1.0" majorTickUnit="1.0" max="0.0" min="-20.0" minorTickCount="10" onMouseClicked="#slideVolumeEffets" prefHeight="14.0" prefWidth="194.0" />
</children>
</HBox>
<Button fx:id="règlesPause" mnemonicParsing="false" onMouseClicked="#afficherReglePause" text="Règles">
<font>
<Font size="14.0" />
</font>
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
</Button>
<Label style="-fx-border-width: 0 0 0.5 0; -fx-border-color: #e2e2e2;" text="Jeux">
<VBox.margin>
<Insets top="50.0" />

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ReglesControlleur">
<children>
<VBox alignment="CENTER" layoutX="-3.0" layoutY="-7.0" prefHeight="802.0" prefWidth="1290.0">
<children>
<ImageView fx:id="imageRegles" fitHeight="654.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true">
<VBox.margin>
<Insets />
</VBox.margin>
</ImageView>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<Button fx:id="precedent" layoutX="519.0" layoutY="31.0" mnemonicParsing="false" onMouseClicked="#pagePrecedente" prefHeight="59.0" prefWidth="225.0" styleClass="bouton" text="Page précédente">
<font>
<Font size="24.0" />
</font>
<HBox.margin>
<Insets right="20.0" />
</HBox.margin>
</Button>
<Button mnemonicParsing="false" onMouseClicked="#retourEnJeu" prefHeight="59.0" prefWidth="117.0" styleClass="bouton" text="Retour">
<font>
<Font size="24.0" />
</font>
<HBox.margin>
<Insets left="20.0" right="20.0" />
</HBox.margin>
</Button>
<Button fx:id="suivant" mnemonicParsing="false" onMouseClicked="#pageSuivante" prefHeight="59.0" prefWidth="195.0" styleClass="bouton" text="Page suivante">
<font>
<Font size="24.0" />
</font>
<HBox.margin>
<Insets left="20.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</children>
</VBox>
</children>
</AnchorPane>