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

This commit is contained in:
Yessine-iut
2020-05-12 01:23:44 +02:00
18 changed files with 359 additions and 76 deletions

View File

@ -0,0 +1,26 @@
package ihm;
import carte.CarteEquipement;
import javafx.scene.image.ImageView;
public class ImageViewEquipement extends ImageView{
private CarteEquipement ce;
public ImageViewEquipement(CarteEquipement ce) {
this.ce = ce;
}
public CarteEquipement getCp() {
return ce;
}
public void setCp(CarteEquipement ce) {
this.ce = ce;
}
public boolean contains(CarteEquipement ce) {
return this.ce == ce;
}
}

View File

@ -0,0 +1,26 @@
package ihm.controller;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
public class AlterationVieZJ implements Initializable {
@FXML private Label label;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
}
public void changeLabel(int valeur) {
if(valeur > 0 ) {
this.label.setText("Vous êtes soigné de "+valeur+"PV");
}else {
this.label.setText("Vous êtes blessé de "+valeur+"PV");
}
}
}

View File

@ -1,17 +1,15 @@
package ihm.controller;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import carte.CarteEquipement;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import carte.CarteEquipement;
public class ChoisirEquipement implements Initializable{
@FXML private GridPane grilleEquipement;

View File

@ -1,7 +1,11 @@
package ihm.controller;
import carte.CarteEquipement;
import ihm.ImageViewEquipement;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
@ -11,6 +15,7 @@ import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import main.Joueur;
@ -71,6 +76,7 @@ public class JoueurIHM {
}
public void setZoneJoueur(Pane p) {
AnchorPane ap = (AnchorPane) zoneJoueur.getChildren().get(1);
ap.getChildren().setAll(p);
@ -94,11 +100,6 @@ public class JoueurIHM {
Label label = getLabelJoueur();
label.setText(name);
}
public Label getPaneEquipement() {
Pane p = (Pane) zoneJoueur.getChildren().get(2);
return (Label) p.getChildren().get(1);
}
public int getPosition() {
return position;
@ -129,4 +130,36 @@ public class JoueurIHM {
}
public void resetZoneJoueur() {
this.getZoneJoueur().getChildren().setAll();
}
public HBox getPaneEquipement(){
ScrollPane sp = (ScrollPane) this.zoneJoueur.getChildren().get(3);
HBox p = (HBox) sp.getContent();
return p;
}
public void ajouterEquipement(CarteEquipement e) {
HBox hb = getPaneEquipement();
ImageViewEquipement ive = new ImageViewEquipement(e);
hb.getChildren().add(new ImageViewEquipement(e));
ive.fitHeightProperty().bind(hb.heightProperty());
}
public void retirerEquipement(CarteEquipement e) {
HBox hb = getPaneEquipement();
for(Node n : hb.getChildren()) {
if(n instanceof ImageViewEquipement) {
ImageViewEquipement ive = (ImageViewEquipement) n;
if(ive.contains(e)) {
hb.getChildren().remove(ive);
}
}
}
}
}

View File

@ -8,6 +8,7 @@ import java.util.ResourceBundle;
import ihm.EffetSonore;
import ihm.Musique;
import ihm.PopUp;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
@ -167,10 +168,17 @@ public class PauseController implements Initializable {
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();
/*
PopUp pu = new PopUp(pane, "Regles");
pu.display();
*/
}

View File

@ -18,6 +18,8 @@ import carte.CarteLieu;
import database.RessourceLoader;
import ihm.EffetSonore;
import ihm.PopUp;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
@ -28,22 +30,16 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.BackgroundPosition;
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.util.Duration;
import main.Contexte;
import main.GestionnaireJeu;
import main.Joueur;
import personnage.CartePersonnage;
public class PlateauController implements Initializable {
@ -357,6 +353,26 @@ public class PlateauController implements Initializable {
jihm.setZoneJoueur(root);
}
public void afficherAlterationVie(Joueur j, int valeur) throws IOException, InterruptedException {
final URL fxmlURL = getClass().getResource("/ihm/ressources/AlterationVieZJ.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = (Pane)fxmlLoader.load();
AlterationVieZJ avzj = fxmlLoader.getController();
avzj.changeLabel(valeur);
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(root);
Timeline timeline = new Timeline(new KeyFrame(
Duration.millis(2500),
ae -> {
jihm.resetZoneJoueur();
GestionnaireJeu.notifyPlateau();
}));
timeline.play();
}
public void afficherLieu(Joueur j) throws IOException {
final URL fxmlURL = getClass().getResource("/ihm/ressources/LieuZJ.fxml");
@ -367,20 +383,16 @@ public class PlateauController implements Initializable {
lzj.setImageView(this.getImageCarte(j.getCarteLieu()));
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(root);
}
public void afficherChoisirJoueur(Joueur j, List<Joueur> joueurs, Contexte contexte) throws IOException {
final URL fxmlURL = getClass().getResource("/ihm/ressources/choixJoueurAttq.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = (Pane)fxmlLoader.load();
this.cj = fxmlLoader.getController();
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(root);
}
final URL fxmlURL = getClass().getResource("/ihm/ressources/choixJoueurAttq.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = (Pane)fxmlLoader.load();
this.cj = fxmlLoader.getController();
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(root);
}
public CarteEquipement getChoixEquipementVole(Joueur joueur) {
JoueurIHM jihm = getJoueurIHM(joueur);
@ -441,5 +453,21 @@ public class PlateauController implements Initializable {
}
public void ajouterEquipement(Joueur j, CarteEquipement e) {
JoueurIHM jihm = getJoueurIHM(j);
jihm.ajouterEquipement(e);
}
public void retirerEquipement(Joueur j, CarteEquipement e) {
JoueurIHM jihm = getJoueurIHM(j);
jihm.retirerEquipement(e);
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>
<AnchorPane 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.AlterationVieZJ">
<children>
<Pane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label fx:id="label" alignment="CENTER" contentDisplay="CENTER" layoutX="86.0" layoutY="92.0" styleClass="text" text="Label" />
</children>
</Pane>
</children>
</AnchorPane>

View File

@ -5,6 +5,7 @@
<?import javafx.scene.Group?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
@ -63,11 +64,18 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox prefHeight="144.0" prefWidth="270.0" styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -104,11 +112,18 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefHeight="144.0" prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox prefHeight="144.0" prefWidth="270.0" styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -166,11 +181,18 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox prefHeight="144.0" prefWidth="270.0" styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -207,11 +229,18 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox prefHeight="144.0" prefWidth="270.0" styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -650,11 +679,21 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefHeight="144.0" prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox styleClass="background" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
<GridPane.margin>
<Insets />
</GridPane.margin>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -691,11 +730,18 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefHeight="144.0" prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -750,11 +796,22 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox prefHeight="144.0" prefWidth="270.0" styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ImageView fitHeight="95.0" fitWidth="88.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>
@ -791,11 +848,22 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefHeight="144.0" prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
</FlowPane>
<ScrollPane hbarPolicy="NEVER" prefHeight="144.0" prefWidth="144.0" styleClass="pane" vbarPolicy="NEVER" GridPane.columnIndex="2" GridPane.rowIndex="1">
<content>
<AnchorPane prefHeight="143.0" prefWidth="270.0">
<children>
<HBox prefHeight="144.0" prefWidth="270.0" styleClass="background" AnchorPane.bottomAnchor="-1.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ImageView fitHeight="95.0" fitWidth="88.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
</children>
</AnchorPane>
</content>
<padding>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding>
</ScrollPane>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
</children>
<padding>

View File

@ -23,6 +23,21 @@
<padding>
<Insets top="-20.0" />
</padding></Slider>
<HBox prefHeight="18.0" prefWidth="249.0">
<children>
<Label prefHeight="18.0" prefWidth="198.0" styleClass="text" stylesheets="@style/plateau.css" text="The Red Fox Tavern - Curran Son">
<opaqueInsets>
<Insets />
</opaqueInsets>
<HBox.margin>
<Insets />
</HBox.margin>
</Label>
</children>
<VBox.margin>
<Insets top="-35.0" />
</VBox.margin>
</HBox>
<CheckBox fx:id="cbEffetSonore" mnemonicParsing="false" styleClass="checkBox" text="%effet" />
<Slider fx:id="sliderEffets" blockIncrement="1.0" layoutX="10.0" layoutY="125.0" majorTickUnit="1.0" max="0.0" min="-20.0" minorTickCount="10" onMouseClicked="#slideVolumeEffet" value="-10.0">
<padding>