Merge branch 'development' of https://github.com/PTE-SH/ShadowHunterGame into development

This commit is contained in:
Paul Gross 2020-05-06 14:40:24 +02:00
commit 1b554ad75c
9 changed files with 167 additions and 4 deletions

View File

@ -17,7 +17,7 @@ public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
final URL fxmlURL = getClass().getResource("ressources/Menu.fxml"); // "ressources/Jouer_tour(1)lancer_des.fxml"
final URL fxmlURL = getClass().getResource("ressources/Menu.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = fxmlLoader.load();

View File

@ -66,13 +66,27 @@ public class MenuController implements Initializable{
}
@FXML
public void quitterLappli(MouseEvent mouseEvent) throws IOException{
System.exit(0);
}
public void afficherRegle(MouseEvent mouseEvent) {
@FXML
public void afficherRegle(MouseEvent mouseEvent) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("blaaaa");
System.out.println("Passage à l'écran des règles");
final URL fxmlURL = getClass().getResource("/ihm/ressources/Regles.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
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

@ -0,0 +1,90 @@
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;
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.scene.layout.Pane;
import javafx.stage.Stage;
public class ReglesControlleur implements Initializable {
@FXML
private AnchorPane rootPane;
@FXML
private ImageView imageRegles;
private int index = 1;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle1.png");
Image image = new Image(input);
imageRegles.setImage(image);
}
@FXML
public void pageSuivante(MouseEvent mouseEvent) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
if (index < 4) {
index++;
}
System.out.println("Page suivante");
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle" + index + ".png");
Image image = new Image(input);
imageRegles.setImage(image);
}
@FXML
public void pagePrecedente(MouseEvent mouseEvent) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
if (index > 1) {
index--;
}
System.out.println("Page précédente");
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle" + index + ".png");
Image image = new Image(input);
imageRegles.setImage(image);
}
@FXML
public void retourMenu(MouseEvent mouseEvent) throws IOException {
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("Retour au Menu");
final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
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

@ -40,6 +40,14 @@
<Insets top="50.0" />
</VBox.margin>
</Button>
<Button mnemonicParsing="false" onMouseClicked="#quitterLappli" prefHeight="48.0" prefWidth="108.0" styleClass="bouton" text="quitter">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="50.0" />
</VBox.margin>
</Button>
</children>
</VBox>
</children>

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 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="#retourMenu" prefHeight="59.0" prefWidth="106.0" styleClass="bouton" text="Menu">
<font>
<Font size="24.0" />
</font>
<HBox.margin>
<Insets left="20.0" right="20.0" />
</HBox.margin>
</Button>
<Button 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB