Menu
This commit is contained in:
commit
5930322daf
@ -10,8 +10,12 @@ import javafx.stage.Stage;
|
|||||||
public class Main extends Application{
|
public class Main extends Application{
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception{
|
public void start(Stage primaryStage) throws Exception{
|
||||||
|
<<<<<<< HEAD
|
||||||
System.out.println("Lancement de l'application");
|
System.out.println("Lancement de l'application");
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("ressources/Menu.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("ressources/Menu.fxml"));
|
||||||
|
=======
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource("ressources/Choix_joueur.fxml"));
|
||||||
|
>>>>>>> 8234d1247461715477e5a73a00bb6c077372e26d
|
||||||
primaryStage.setTitle("Shadow Hunters");
|
primaryStage.setTitle("Shadow Hunters");
|
||||||
primaryStage.setScene(new Scene(root));
|
primaryStage.setScene(new Scene(root));
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
@ -1,25 +1,85 @@
|
|||||||
package ihm;
|
package ihm;
|
||||||
|
|
||||||
|
|
||||||
|
import java.awt.Window.Type;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
|
import javafx.embed.swing.JFXPanel;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.StageStyle;
|
||||||
|
|
||||||
public class PopUp {
|
public class PopUp{
|
||||||
private Scene scene;
|
private Scene scene;
|
||||||
private Stage popupwindow;
|
private Stage popup;
|
||||||
|
|
||||||
|
private double xOffSet = 0;
|
||||||
|
private double yOffSet = 0;
|
||||||
|
|
||||||
public PopUp (Parent p, String titre) {
|
public PopUp (Parent p, String titre) {
|
||||||
|
|
||||||
popupwindow = new Stage();
|
|
||||||
popupwindow.initModality(Modality.APPLICATION_MODAL);
|
popup = new Stage();
|
||||||
popupwindow.setTitle(titre);
|
|
||||||
|
|
||||||
|
|
||||||
|
popup.initModality(Modality.NONE);
|
||||||
|
|
||||||
|
popup.initStyle(StageStyle.UNDECORATED);
|
||||||
|
|
||||||
|
popup.setTitle(titre);
|
||||||
|
|
||||||
scene = new Scene(p);
|
scene = new Scene(p);
|
||||||
|
|
||||||
|
p.setOnMousePressed(new EventHandler<MouseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(MouseEvent event){
|
||||||
|
|
||||||
|
xOffSet = event.getSceneX();
|
||||||
|
yOffSet = event.getSceneY();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
p.setOnMouseDragged(new EventHandler<MouseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(MouseEvent event){
|
||||||
|
|
||||||
|
popup.setX(event.getScreenX() - xOffSet);
|
||||||
|
popup.setY(event.getScreenY() - yOffSet);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
popup.focusedProperty().addListener((obs,wasFocused,isNowFocused) -> {
|
||||||
|
|
||||||
|
if(!isNowFocused) {
|
||||||
|
popup.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void display() {
|
public void display() {
|
||||||
popupwindow.setScene(scene);
|
|
||||||
popupwindow.showAndWait();
|
popup.setScene(scene);
|
||||||
|
|
||||||
|
popup.showAndWait();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,15 @@ import javafx.fxml.Initializable;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
|
|
||||||
public class MenuController implements Initializable{
|
public class MenuController implements Initializable{
|
||||||
@FXML private Pane rootPane;
|
@FXML private AnchorPane rootPane;
|
||||||
@FXML private ImageView titre;
|
@FXML private ImageView titre;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
FileInputStream input;
|
FileInputStream input;
|
||||||
try {
|
try {
|
||||||
input = new FileInputStream("src\\ihm\\ressources\\img\\logo.png");
|
input = new FileInputStream("src\\ihm\\ressources\\img\\logo.png");
|
||||||
@ -34,8 +33,13 @@ public class MenuController implements Initializable{
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
|
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
|
||||||
|
<<<<<<< HEAD
|
||||||
System.out.println("Passage à l'écran de choix des joueurs");
|
System.out.println("Passage à l'écran de choix des joueurs");
|
||||||
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
|
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
|
||||||
|
=======
|
||||||
|
System.out.println("Passage à l'écran de choix des joueurs");
|
||||||
|
AnchorPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
|
||||||
|
>>>>>>> 8234d1247461715477e5a73a00bb6c077372e26d
|
||||||
rootPane.getChildren().setAll(pane);
|
rootPane.getChildren().setAll(pane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class PlayersController implements Initializable{
|
|||||||
private List<TextField> txt = new ArrayList<TextField>();
|
private List<TextField> txt = new ArrayList<TextField>();
|
||||||
private List<CheckBox> ia = new ArrayList<CheckBox>();
|
private List<CheckBox> ia = new ArrayList<CheckBox>();
|
||||||
|
|
||||||
private List<Joueur> joueur = new ArrayList<Joueur>();
|
private List<Joueur> joueurs = new ArrayList<Joueur>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,22 +78,26 @@ public class PlayersController implements Initializable{
|
|||||||
@FXML
|
@FXML
|
||||||
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
||||||
//ajout des joueurs finalement selectionner
|
//ajout des joueurs finalement selectionner
|
||||||
int nbJoueur = 0;
|
int nbJoueurs = 0;
|
||||||
|
|
||||||
for (HBox hb : ligne) {
|
for (HBox hb : ligne) {
|
||||||
|
|
||||||
TextField tf = (TextField) hb.getChildren().get(0);
|
TextField tf = (TextField) hb.getChildren().get(0);
|
||||||
CheckBox cb = (CheckBox) hb.getChildren().get(2);
|
CheckBox cb = (CheckBox) hb.getChildren().get(2);
|
||||||
Joueur j;
|
Joueur j;
|
||||||
|
|
||||||
if (tf.isEditable()) {
|
if (tf.isEditable()) {
|
||||||
if(cb.isSelected())
|
if(cb.isSelected()) {
|
||||||
j = new JoueurVirtuel(tf.getText());
|
joueurs.add(new Joueur(tf.getText()));
|
||||||
else
|
}
|
||||||
j = new Joueur(tf.getText());
|
else {
|
||||||
nbJoueur++;
|
joueurs.add(new JoueurVirtuel(tf.getText()));
|
||||||
}else j = null;
|
}
|
||||||
joueur.add(j);
|
nbJoueurs++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbJoueur <4) {
|
if (nbJoueurs < 4) {
|
||||||
Alert alert = new Alert(AlertType.WARNING, "Il faut au moins de 4 joueurs !");
|
Alert alert = new Alert(AlertType.WARNING, "Il faut au moins de 4 joueurs !");
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}else {
|
}else {
|
||||||
@ -102,12 +106,14 @@ public class PlayersController implements Initializable{
|
|||||||
Parent root = loader.load();
|
Parent root = loader.load();
|
||||||
|
|
||||||
PlateauController pc = loader.getController();
|
PlateauController pc = loader.getController();
|
||||||
pc.showInformation(joueur);
|
pc.showInformation(joueurs);
|
||||||
|
|
||||||
rootPane.getChildren().setAll(root);
|
rootPane.getChildren().setAll(root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autorise a <EFBFBD>crire dans le text filed le nom du joueur ajouter
|
* Autorise a <EFBFBD>crire dans le text filed le nom du joueur ajouter
|
||||||
*
|
*
|
||||||
|
@ -5,12 +5,16 @@
|
|||||||
<?import javafx.scene.control.CheckBox?>
|
<?import javafx.scene.control.CheckBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.TextField?>
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.BorderPane?>
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<BorderPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.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.PlayersController">
|
|
||||||
|
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlayersController">
|
||||||
|
<children>
|
||||||
|
<BorderPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/menu.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<left>
|
<left>
|
||||||
<VBox alignment="CENTER" prefHeight="688.0" prefWidth="240.0" BorderPane.alignment="CENTER">
|
<VBox alignment="CENTER" prefHeight="688.0" prefWidth="240.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
@ -151,7 +155,8 @@
|
|||||||
<Label styleClass="titre" stylesheets="@style/menu.css" text="Cochez la case pour avoir un joueur virtuel">
|
<Label styleClass="titre" stylesheets="@style/menu.css" text="Cochez la case pour avoir un joueur virtuel">
|
||||||
<font>
|
<font>
|
||||||
<Font size="36.0" />
|
<Font size="36.0" />
|
||||||
</font></Label>
|
</font>
|
||||||
|
</Label>
|
||||||
<Button fx:id="btnCommencer" mnemonicParsing="false" onMouseClicked="#commencerJeux" styleClass="bouton" stylesheets="@style/menu.css" text="Commencer la partie">
|
<Button fx:id="btnCommencer" mnemonicParsing="false" onMouseClicked="#commencerJeux" styleClass="bouton" stylesheets="@style/menu.css" text="Commencer la partie">
|
||||||
<font>
|
<font>
|
||||||
<Font size="24.0" />
|
<Font size="24.0" />
|
||||||
@ -190,10 +195,13 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
<HBox fx:id="hb2" alignment="CENTER" rotate="180.0">
|
<HBox fx:id="hb2" alignment="CENTER" rotate="180.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField accessibleRole="PARENT">
|
||||||
<font>
|
<font>
|
||||||
<Font size="24.0" />
|
<Font size="24.0" />
|
||||||
</font>
|
</font>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</HBox.margin>
|
||||||
</TextField>
|
</TextField>
|
||||||
<Button mnemonicParsing="false" prefHeight="55.0" prefWidth="55.0" styleClass="bouton" stylesheets="@style/menu.css" text="+">
|
<Button mnemonicParsing="false" prefHeight="55.0" prefWidth="55.0" styleClass="bouton" stylesheets="@style/menu.css" text="+">
|
||||||
<font>
|
<font>
|
||||||
@ -273,4 +281,6 @@
|
|||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
</bottom>
|
</bottom>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
@ -5,14 +5,18 @@
|
|||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.image.ImageView?>
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.BorderPane?>
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.shape.Circle?>
|
<?import javafx.scene.shape.Circle?>
|
||||||
|
|
||||||
<BorderPane fx:id="root" 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.PlateauController">
|
|
||||||
|
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlateauController">
|
||||||
|
<children>
|
||||||
|
<BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<top>
|
<top>
|
||||||
<HBox alignment="CENTER" prefHeight="149.0" prefWidth="1280.0" BorderPane.alignment="CENTER">
|
<HBox alignment="CENTER" prefHeight="149.0" prefWidth="1343.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<VBox fx:id="joueur1" alignment="CENTER" prefHeight="164.0" prefWidth="212.0" rotate="180.0">
|
<VBox fx:id="joueur1" alignment="CENTER" prefHeight="164.0" prefWidth="212.0" rotate="180.0">
|
||||||
<children>
|
<children>
|
||||||
@ -162,7 +166,7 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
</bottom>
|
</bottom>
|
||||||
<left>
|
<left>
|
||||||
<VBox alignment="CENTER" prefHeight="496.0" prefWidth="160.0" BorderPane.alignment="CENTER">
|
<VBox alignment="CENTER_LEFT" prefHeight="496.0" prefWidth="160.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<VBox fx:id="joueur5" alignment="CENTER" prefHeight="181.0" prefWidth="333.0" rotate="90.0">
|
<VBox fx:id="joueur5" alignment="CENTER" prefHeight="181.0" prefWidth="333.0" rotate="90.0">
|
||||||
<children>
|
<children>
|
||||||
@ -236,7 +240,7 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</left>
|
</left>
|
||||||
<right>
|
<right>
|
||||||
<VBox prefHeight="496.0" prefWidth="214.0" BorderPane.alignment="CENTER">
|
<VBox alignment="CENTER_RIGHT" prefHeight="496.0" prefWidth="214.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<VBox fx:id="joueur6" alignment="CENTER" prefHeight="163.0" prefWidth="329.0" rotate="270.0">
|
<VBox fx:id="joueur6" alignment="CENTER" prefHeight="163.0" prefWidth="329.0" rotate="270.0">
|
||||||
<children>
|
<children>
|
||||||
@ -310,9 +314,9 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</right>
|
</right>
|
||||||
<center>
|
<center>
|
||||||
<HBox prefHeight="496.0" prefWidth="869.0" BorderPane.alignment="CENTER">
|
<HBox alignment="CENTER" prefHeight="496.0" prefWidth="869.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<VBox alignment="CENTER" prefHeight="496.0" prefWidth="22.0">
|
<VBox alignment="CENTER_LEFT" prefWidth="22.0">
|
||||||
<children>
|
<children>
|
||||||
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteLumiere" stylesheets="@style/plateau.css">
|
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteLumiere" stylesheets="@style/plateau.css">
|
||||||
<children>
|
<children>
|
||||||
@ -333,13 +337,10 @@
|
|||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
<HBox.margin>
|
|
||||||
<Insets right="15.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox prefHeight="496.0" prefWidth="739.0">
|
<VBox alignment="CENTER" prefHeight="496.0" prefWidth="739.0">
|
||||||
<children>
|
<children>
|
||||||
<HBox prefHeight="339.0" prefWidth="676.0">
|
<HBox alignment="TOP_CENTER" prefHeight="339.0" prefWidth="676.0">
|
||||||
<children>
|
<children>
|
||||||
<VBox alignment="CENTER" prefHeight="223.0" prefWidth="0.0">
|
<VBox alignment="CENTER" prefHeight="223.0" prefWidth="0.0">
|
||||||
<children>
|
<children>
|
||||||
@ -398,7 +399,7 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox prefHeight="200.0" prefWidth="100.0">
|
<VBox alignment="BOTTOM_CENTER" prefHeight="200.0" prefWidth="100.0">
|
||||||
<children>
|
<children>
|
||||||
<HBox alignment="CENTER_RIGHT" prefHeight="60.0" prefWidth="671.0">
|
<HBox alignment="CENTER_RIGHT" prefHeight="60.0" prefWidth="671.0">
|
||||||
<children>
|
<children>
|
||||||
@ -582,7 +583,7 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox alignment="CENTER" prefHeight="496.0" prefWidth="29.0">
|
<VBox alignment="CENTER_RIGHT" prefHeight="496.0" prefWidth="29.0">
|
||||||
<children>
|
<children>
|
||||||
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteLumiere" stylesheets="@style/plateau.css">
|
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteLumiere" stylesheets="@style/plateau.css">
|
||||||
<children>
|
<children>
|
||||||
@ -603,11 +604,10 @@
|
|||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
<HBox.margin>
|
|
||||||
<Insets left="15.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</center>
|
</center>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
@ -1,15 +1,34 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import effet.Effet;
|
import effet.Effet;
|
||||||
|
|
||||||
public class GestionnaireJeu {
|
public class GestionnaireJeu {
|
||||||
|
|
||||||
|
|
||||||
private Plateau plateau;
|
private Plateau plateau;
|
||||||
private View view;
|
private View view;
|
||||||
|
|
||||||
public GestionnaireJeu (Plateau p) {
|
|
||||||
plateau = p;
|
|
||||||
|
public GestionnaireJeu() {
|
||||||
|
this.plateau = new Plateau(new ArrayList<Joueur>());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
switch(1){
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
lancerPartie();
|
||||||
|
case 2:
|
||||||
|
lancerConfiguration();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plateau getPlateau() {
|
public Plateau getPlateau() {
|
||||||
@ -20,11 +39,15 @@ public class GestionnaireJeu {
|
|||||||
this.plateau = plateau;
|
this.plateau = plateau;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lancerPartie(Configuration c) {
|
public static void lancerPartie() {
|
||||||
//TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configuration lancerConfiguration() {
|
public void jouer(Configuration c) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Configuration lancerConfiguration() {
|
||||||
//TODO
|
//TODO
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,25 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
public class View {
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class View extends Application{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception{
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource("ressources/Plateau.fxml"));
|
||||||
|
primaryStage.setTitle("Shadow Hunters");
|
||||||
|
primaryStage.setScene(new Scene(root));
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import main.Plateau;
|
|||||||
|
|
||||||
public class Charles extends CartePersonnage{
|
public class Charles extends CartePersonnage{
|
||||||
|
|
||||||
public Charles(String nom, int hp, Joueur joueur) {
|
public Charles(Joueur joueur) {
|
||||||
super(nom, nom, hp, joueur);
|
super("Charles", "desc", 11, joueur);
|
||||||
|
|
||||||
Action action = new ActionAltererStatistiquesJoueur("HP",-2,true);
|
Action action = new ActionAltererStatistiquesJoueur("HP",-2,true);
|
||||||
Effet effet = new EffetSelf(action);
|
Effet effet = new EffetSelf(action);
|
||||||
|
75
tests/personnage/CharlesTest.java
Normal file
75
tests/personnage/CharlesTest.java
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package personnage;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import main.Joueur;
|
||||||
|
import main.Plateau;
|
||||||
|
|
||||||
|
class CharlesTest {
|
||||||
|
|
||||||
|
Joueur j1;
|
||||||
|
Joueur j2;
|
||||||
|
Plateau p;
|
||||||
|
Allie a;
|
||||||
|
Charles c;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
List<Joueur> joueurs = new ArrayList<Joueur>();
|
||||||
|
j1 = new Joueur("Michou");
|
||||||
|
j2= new Joueur("MicheMiche");
|
||||||
|
|
||||||
|
joueurs.add(j1);
|
||||||
|
joueurs.add(j2);
|
||||||
|
|
||||||
|
p = new Plateau(joueurs);
|
||||||
|
|
||||||
|
a = new Allie(j1);
|
||||||
|
c = new Charles(j2);
|
||||||
|
|
||||||
|
j1.setPlateau(p);
|
||||||
|
j1.setCartePersonnage(a);
|
||||||
|
|
||||||
|
j2.setPlateau(p);
|
||||||
|
j2.setCartePersonnage(c);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void attaquer() {
|
||||||
|
|
||||||
|
// Le joueur n'est pas révélé (Charles), il attaque seulement 1 fois.
|
||||||
|
j2.setRevele(false);
|
||||||
|
j2.getCartePersonnage().attaquer(j1, 2);
|
||||||
|
j1.setStat(Joueur.PLAYER_HP, 6);
|
||||||
|
int pvAllie = j1.getCartePersonnage().getPv();
|
||||||
|
|
||||||
|
//on verifie que le joueur qui joue Allie n'est pas full hp
|
||||||
|
assertNotEquals((j1.getStat(Joueur.PLAYER_HP)),pvAllie);
|
||||||
|
|
||||||
|
//je verifie que le joueur de Allie a bien subi 2 de dégâts
|
||||||
|
assertTrue((j1.getStat(Joueur.PLAYER_HP))==6);
|
||||||
|
|
||||||
|
//Le joueur jouant Charles se révèle
|
||||||
|
j2.setRevele(true);
|
||||||
|
j2.getCartePersonnage().attaquer(j1, 2);
|
||||||
|
j1.setStat(Joueur.PLAYER_HP, 6);
|
||||||
|
//Charles réattaque en infligeant 3 point de blessures
|
||||||
|
j2.getCartePersonnage().attaquer(j1, 3);
|
||||||
|
|
||||||
|
//je verifie que le joueur de Allie a bien subi 5 point de dégâts au total (2 au premier coup et 3 au deuxième)
|
||||||
|
j1.setStat(Joueur.PLAYER_HP, 3);
|
||||||
|
assertTrue((j1.getStat(Joueur.PLAYER_HP))==3);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user