Lancer de dés, nouvelle disposition IHM etc...

This commit is contained in:
Paul Gross 2020-04-27 11:40:14 +02:00
parent 3b590540ac
commit 94e6c00001
32 changed files with 898 additions and 40 deletions

60
src/ihm/Dice.java Normal file
View File

@ -0,0 +1,60 @@
package ihm;
/**
* @author https://www.programcreek.com/java-api-examples/?code=AlmasB%2FFXTutorials%2FFXTutorials-master%2Fsrc%2Fcom%2Falmasb%2Ftutorial5%2FDice.java
*
*/
import javafx.animation.RotateTransition;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.geometry.Pos;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.util.Duration;
public class Dice extends StackPane {
public static int MAX_VALUE = 6;
public static final int MIN_VALUE = 1;
public final SimpleIntegerProperty valueProperty = new SimpleIntegerProperty();
int i = 0;
public Dice(int valeurMax) {
MAX_VALUE = valeurMax;
Rectangle rect = new Rectangle(50, 50);
Text text = new Text();
text.setFill(Color.WHITE);
text.textProperty().bind(valueProperty.asString());
this.setAlignment(Pos.CENTER);
getChildren().addAll(rect, text);
this.setOnMouseClicked(event -> roll());
}
public void roll() {
RotateTransition rt = new RotateTransition(Duration.seconds(0.5), this);
rt.setFromAngle(0);
rt.setToAngle(360);
int cycles = 2000;
rt.setOnFinished(event -> {
valueProperty.set((int)(Math.random() * (MAX_VALUE - MIN_VALUE + 1)) + MIN_VALUE);
if(cycles < i) {
rt.play();
i++;
}
});
rt.play();
}
}

View File

@ -3,7 +3,6 @@ package ihm;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
@ -12,11 +11,15 @@ public class Main extends Application {
public void start(Stage primaryStage) throws Exception {
System.out.println("Lancement de l'application");
Pane root = FXMLLoader.load(getClass().getResource("ressources/Menu.fxml")); // "ressources/Jouer_tour(1)lancer_des.fxml"
Pane root = FXMLLoader.load(getClass().getResource("ressources/PlateauTestPaul.fxml")); // "ressources/Jouer_tour(1)lancer_des.fxml"
primaryStage.show();
primaryStage.setTitle("Shadow Hunters");
primaryStage.setScene(new Scene(root));
primaryStage.centerOnScreen();
primaryStage.setMaximized(true);
primaryStage.show();
}
@ -24,7 +27,7 @@ public class Main extends Application {
String filepath = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav"; // lien vers la musique :
// https://www.youtube.com/watch?v=LBpKUIyOHdo
Musique musiqueObjet = new Musique();
//Musique musiqueObjet = new Musique();
//musiqueObjet.playMusique(filepath);
launch(args);

View File

@ -21,10 +21,6 @@ public class PopUpBoolean {
private double xOffSet = 0;
private double yOffSet = 0;
public PopUpBoolean (Parent p, String titre) {
@ -62,8 +58,6 @@ public class PopUpBoolean {
});
}
public boolean display() {
popup.setScene(scene);

View File

@ -0,0 +1,47 @@
package ihm;
import javafx.animation.Interpolator;
import javafx.animation.Transition;
import javafx.geometry.Rectangle2D;
import javafx.scene.image.ImageView;
import javafx.util.Duration;
public class SpriteAnimation extends Transition {
private final ImageView imageView;
private final int count;
private final int columns;
private final int offsetX;
private final int offsetY;
private final int width;
private final int height;
private int lastIndex;
public SpriteAnimation(
ImageView imageView,
Duration duration,
int count, int columns,
int offsetX, int offsetY,
int width, int height) {
this.imageView = imageView;
this.count = count;
this.columns = columns;
this.offsetX = offsetX;
this.offsetY = offsetY;
this.width = width;
this.height = height;
setCycleDuration(duration);
setInterpolator(Interpolator.LINEAR);
}
protected void interpolate(double k) {
final int index = Math.min((int) Math.floor(k * count), count - 1);
if (index != lastIndex) {
final int x = (index % columns) * width + offsetX;
final int y = (index / columns) * height + offsetY;
imageView.setViewport(new Rectangle2D(x, y, width, height));
lastIndex = index;
}
}
}

View File

@ -23,14 +23,13 @@ public class ChoisirBoolean implements Initializable{
public void initialize(URL arg0, ResourceBundle arg1) {
}
@FXML
public void choixOui(MouseEvent mouseEvent) throws IOException{
PopUpBoolean.result = true;
final Node source = (Node) mouseEvent.getSource();
final Stage stage = (Stage) source.getScene().getWindow();
stage.close();
return;
}
@FXML
@ -40,6 +39,5 @@ public class ChoisirBoolean implements Initializable{
final Node source = (Node) mouseEvent.getSource();
final Stage stage = (Stage) source.getScene().getWindow();
stage.close();
return;
}
}

View File

@ -10,15 +10,23 @@ import java.util.ResourceBundle;
import ihm.PopUp;
import ihm.PopUpBoolean;
import ihm.SpriteAnimation;
import javafx.animation.Animation;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Rectangle2D;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import main.GestionnaireJeu;
import javafx.util.Duration;
import main.Joueur;
import main.View;
@ -40,6 +48,10 @@ public class PlateauController implements Initializable {
@FXML private VBox joueur7;
@FXML private VBox joueur8;
public static int DICE_SIX = 2;
public static int DICE_QUATRE = 1;
public static int DICE_BOTH = 0;
/**
* initialise les donn<EFBFBD>es du plateau
*/
@ -114,8 +126,6 @@ public class PlateauController implements Initializable {
PopUpBoolean popup = new PopUpBoolean(root, "Consulter sa carte");
return popup.display();
}
/**
@ -146,4 +156,11 @@ public class PlateauController implements Initializable {
}
}
}
public void rollDice(Joueur joueur, int typeDice, int[] rolls) {
}
}

View File

@ -0,0 +1,161 @@
package ihm.controller;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import ihm.PopUp;
import ihm.PopUpBoolean;
import ihm.SpriteAnimation;
import javafx.animation.Animation;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Rectangle2D;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.util.Duration;
import main.Joueur;
public class PlateauControllerTest implements Initializable {
private List<Joueur> listJoueur = new ArrayList<Joueur>();
private List<VBox> vboxJoueur = new ArrayList<VBox>();
private List<Button> btnRevelation = new ArrayList<Button>();
private List<Button> btnCartePerso = new ArrayList<Button>();
private List<Label> nomPerso = new ArrayList<Label>();
private List<Label> factionPerso = new ArrayList<Label>();
private List<Label> nomJoueur = new ArrayList<Label>();
@FXML private AnchorPane anchorPane1;
@FXML private AnchorPane anchorPane2;
@FXML private AnchorPane anchorPane3;
@FXML private AnchorPane anchorPane4;
@FXML private AnchorPane anchorPane5;
@FXML private AnchorPane anchorPane6;
@FXML private AnchorPane anchorPane7;
@FXML private AnchorPane anchorPane8;
/**
* initialise les donn<EFBFBD>es du plateau
*/
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
//initialisation des attributs des joueurs
int OFFSET_X = 0;
int OFFSET_Y = 0;
int WIDTH = 557;
int HEIGHT = 557;
int COUNT = 6;
int COLUMNS = 6;
//anchorPane1.getChildren().setAll(imageView);
ImageView imageView;
try {
imageView = FXMLLoader.load(getClass().getResource("../ressources/Dés.fxml"));
imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT));
imageView.fitWidthProperty().bind(anchorPane1.widthProperty());
final SpriteAnimation animation = new SpriteAnimation(
imageView,
Duration.millis(250),
COUNT, COLUMNS,
OFFSET_X, OFFSET_Y,
WIDTH, HEIGHT
);
animation.setCycleCount(Animation.INDEFINITE);
animation.play();
anchorPane1.getChildren().addAll(new Group(imageView));
anchorPane1.setOnMousePressed(new EventHandler<Event>(
) {
@Override
public void handle(Event arg0) {
animation.stop();
}
});
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* Affiche aux yeux de tous la carte personnage du joueur
*
* @param j : Le joueur sur lequel on a cliqu<EFBFBD>
*/
public void seReveler(int numJoueur) throws IOException {
System.out.println(listJoueur.get(numJoueur).getNom() + " se revele");
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/Reveler_son_identite.fxml"));
Parent root = loader.load();
RevelationController rc = loader.getController();
rc.showInformation(listJoueur.get(numJoueur));
PopUp popup = new PopUp(root, "Consulter sa carte");
popup.display();
}
public boolean choisir(Joueur j) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/choisirBoolean.fxml"));
Parent root = loader.load();
PopUpBoolean popup = new PopUpBoolean(root, "Consulter sa carte");
return popup.display();
}
public void rollDice(Joueur j, int typeDice, int[] resultats) {
}
/**
* Permet de consulter sa carte perssonage en cas d'oublie
*
* @param j : Le joueur sur lequel on a cliqu<EFBFBD>
*/
public void consulterSaCarte(int numJoueur) throws IOException {
System.out.println(listJoueur.get(numJoueur).getNom() + " consulte sa carte");
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/afficher_carte_perso.fxml"));
Parent root = loader.load();
AfficherCarteController acc = loader.getController();
acc.showInformation(listJoueur.get(numJoueur));
PopUp popup = new PopUp(root, "Consulter sa carte");
popup.display();
}
public void showInformation(Map<Integer, Joueur> j) {
System.out.println("\tplacement des joueurs");
for (int i=0; i<this.vboxJoueur.size(); i++) {
if (j.get(i) != null)
nomJoueur.get(i).setText(j.get(i).getNom());
else {
vboxJoueur.get(i).setVisible(false);
}
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<ImageView fitHeight="202.0" fitWidth="173.0" preserveRatio="true" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<image>
<Image url="@img/dé.png" />
</image>
</ImageView>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<ImageView fitHeight="189.0" fitWidth="379.0" preserveRatio="true" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<image>
<Image url="@img/dice.sprite.png" />
</image>
</ImageView>

View File

@ -0,0 +1,523 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.String?>
<?import javafx.geometry.Insets?>
<?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?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<AnchorPane prefHeight="992.0" prefWidth="1822.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlateauControllerTest">
<children>
<BorderPane fx:id="root" prefHeight="1359.0" prefWidth="1610.0" styleClass="background" stylesheets="@style/plateau.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<top>
<HBox alignment="CENTER" spacing="30.0">
<children>
<AnchorPane>
<children>
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane fx:id="anchorPane6" prefHeight="150.0" prefWidth="150.0" />
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@img/dosCartesPersonnage.jpg" />
</image>
</ImageView>
<ScrollPane hbarPolicy="NEVER" prefHeight="200.0" prefWidth="200.0" vbarPolicy="NEVER">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="148.0" prefWidth="200.0" />
</content>
</ScrollPane>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane>
<children>
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ScrollPane hbarPolicy="NEVER" prefHeight="200.0" prefWidth="200.0" vbarPolicy="NEVER">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="148.0" prefWidth="200.0" />
</content>
</ScrollPane>
<ImageView fitHeight="150.0" fitWidth="106.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@img/dosCartesPersonnage.jpg" />
</image>
</ImageView>
<AnchorPane fx:id="anchorPane5" prefHeight="150.0" prefWidth="150.0" HBox.hgrow="ALWAYS" />
</children>
</HBox>
</children>
</AnchorPane>
</children>
</HBox>
</top>
<bottom>
<HBox alignment="CENTER" spacing="10.0">
<children>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
<children>
<HBox alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children>
<AnchorPane fx:id="anchorPane1" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children>
<ImageView fitHeight="150.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<image>
<Image url="@img/dosCartesPersonnage.jpg" />
</image>
</ImageView>
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children>
<ScrollPane hbarPolicy="NEVER" layoutY="-85.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" vbarPolicy="NEVER" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" />
</content>
</ScrollPane>
</children>
</AnchorPane>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
<children>
<HBox alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children>
<ScrollPane hbarPolicy="NEVER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" vbarPolicy="NEVER" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" />
</content>
</ScrollPane>
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children>
<ImageView fitHeight="150.0" fitWidth="139.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<image>
<Image url="@img/dosCartesPersonnage.jpg" />
</image>
</ImageView>
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children>
<AnchorPane fx:id="anchorPane2" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</children>
</HBox>
</children>
</AnchorPane>
</children>
</HBox>
</bottom>
<left>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="465.0" minHeight="10.0" prefHeight="341.5" vgrow="SOMETIMES" />
<RowConstraints maxHeight="341.0" minHeight="10.0" prefHeight="341.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane fx:id="anchorPane7" />
<ImageView fitHeight="115.0" fitWidth="150.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="1">
<image>
<Image url="@img/dosCartesPersonnageRot.jpg" />
</image>
</ImageView>
<ScrollPane hbarPolicy="NEVER" vbarPolicy="NEVER" GridPane.rowIndex="2">
<content>
<AnchorPane />
</content>
</ScrollPane>
</children>
</GridPane>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ScrollPane hbarPolicy="NEVER" vbarPolicy="NEVER">
<content>
<AnchorPane />
</content>
</ScrollPane>
<ImageView fitHeight="150.0" fitWidth="150.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="1">
<image>
<Image url="@img/dosCartesPersonnageRot.jpg" />
</image>
</ImageView>
<AnchorPane fx:id="anchorPane8" GridPane.rowIndex="2" />
</children>
</GridPane>
</children>
</GridPane>
</left>
<right>
<VBox alignment="CENTER" spacing="10.0">
<children>
<AnchorPane>
<VBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</VBox.margin>
<children>
<VBox alignment="CENTER" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane fx:id="anchorPane4" prefHeight="150.0" prefWidth="150.0" VBox.vgrow="ALWAYS" />
<ImageView fitHeight="150.0" fitWidth="150.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@img/dosCartesPersonnageRot.jpg" />
</image>
</ImageView>
<ScrollPane hbarPolicy="NEVER" prefHeight="200.0" prefWidth="200.0" vbarPolicy="NEVER">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="200.0" prefWidth="200.0" />
</content>
</ScrollPane>
</children>
</VBox>
</children>
</AnchorPane>
<AnchorPane>
<VBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</VBox.margin>
<children>
<VBox alignment="CENTER" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ScrollPane hbarPolicy="NEVER" prefHeight="200.0" prefWidth="200.0" vbarPolicy="NEVER">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="200.0" prefWidth="200.0" />
</content>
</ScrollPane>
<ImageView fitHeight="154.0" fitWidth="150.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@img/dosCartesPersonnageRot.jpg" />
</image>
</ImageView>
<AnchorPane fx:id="anchorPane3" prefHeight="150.0" prefWidth="150.0" VBox.vgrow="ALWAYS" />
</children>
</VBox>
</children>
</AnchorPane>
</children>
</VBox>
</right>
<center>
<HBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" spacing="10.0">
<children>
<VBox alignment="CENTER_LEFT" prefWidth="22.0" HBox.hgrow="NEVER">
<children>
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteLumiere" stylesheets="@style/plateau.css">
<children>
<ImageView fitHeight="97.8" fitWidth="70.05" pickOnBounds="true" preserveRatio="true" styleClass="background" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteVision" stylesheets="@style/plateau.css">
<children>
<ImageView fitHeight="97.8" fitWidth="70.05" pickOnBounds="true" preserveRatio="true" />
</children>
<VBox.margin>
<Insets bottom="30.0" top="30.0" />
</VBox.margin>
</HBox>
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteTenebre" stylesheets="@style/plateau.css">
<children>
<ImageView fitHeight="97.8" fitWidth="70.05" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
</children>
</VBox>
<VBox alignment="CENTER" prefWidth="732.0" HBox.hgrow="NEVER">
<children>
<HBox alignment="TOP_CENTER">
<children>
<VBox alignment="CENTER">
<children>
<Circle fill="#ff1f1f" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#ffd71f" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#ecff1f" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#64ff1f" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
</children>
</VBox>
<HBox alignment="TOP_CENTER" styleClass="lieux" stylesheets="@style/plateau.css">
<children>
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ImageView>
</children>
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</HBox>
<HBox alignment="BOTTOM_CENTER" styleClass="lieux" stylesheets="@style/plateau.css">
<children>
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ImageView>
</children>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</HBox>
<HBox alignment="TOP_CENTER" styleClass="lieux" stylesheets="@style/plateau.css">
<children>
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ImageView>
</children>
<HBox.margin>
<Insets left="5.0" right="10.0" />
</HBox.margin>
</HBox>
<VBox alignment="CENTER">
<children>
<Circle fill="#21ffee" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#2168ff" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#d921ff" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#ff21ad" radius="10.0" stroke="BLACK" strokeType="INSIDE" />
</children>
</VBox>
</children>
</HBox>
<VBox alignment="BOTTOM_CENTER">
<children>
<HBox alignment="CENTER_RIGHT">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" styleClass="text" stylesheets="@style/plateau.css" text="Allie" />
<VBox alignment="CENTER">
<children>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Bob" />
<Label styleClass="text" stylesheets="@style/plateau.css" text="Emi" />
</children>
</VBox>
<VBox alignment="CENTER">
<children>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Inconnu" />
<Label styleClass="text" stylesheets="@style/plateau.css" text="Charles" />
</children>
</VBox>
<Label alignment="CENTER" contentDisplay="CENTER" styleClass="text" stylesheets="@style/plateau.css" text="Franklin" />
<VBox alignment="CENTER">
<children>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Vampire" />
<Label styleClass="text" stylesheets="@style/plateau.css" text="Daniel" />
</children>
</VBox>
<VBox alignment="CENTER">
<children>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Loup-" />
<Label styleClass="text" stylesheets="@style/plateau.css" text="garou" />
<Label styleClass="text" stylesheets="@style/plateau.css" text="George" />
</children>
</VBox>
</children>
</HBox>
<HBox>
<children>
<HBox prefHeight="100.0" prefWidth="0.0" />
<HBox alignment="CENTER" prefHeight="64.0" prefWidth="50.0" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="87.0" prefWidth="2.0">
<children>
<Circle fill="#ff1f1f" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#ffd71f" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#ecff1f" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#64ff1f" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
</children>
</VBox>
<VBox prefHeight="87.0" prefWidth="4.0">
<children>
<Circle fill="#21ffee" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#2168ff" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#d921ff" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
<Circle fill="#ff21ad" radius="8.0" stroke="BLACK" strokeType="INSIDE" />
</children>
</VBox>
</children>
<styleClass>
<String fx:value="barreDeVie" />
<String fx:value="zero" />
</styleClass>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
<styleClass>
<String fx:value="barreDeVie" />
<String fx:value="un" />
</styleClass>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
<styleClass>
<String fx:value="barreDeVie" />
<String fx:value="deux" />
</styleClass>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
<styleClass>
<String fx:value="barreDeVie" />
<String fx:value="trois" />
</styleClass>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
<styleClass>
<String fx:value="barreDeVie" />
<String fx:value="quatre" />
</styleClass>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="50.0" styleClass="barreDeVie" stylesheets="@style/plateau.css">
<children>
<VBox prefHeight="64.0" prefWidth="25.0" />
<VBox prefHeight="200.0" prefWidth="25.0" />
</children>
</HBox>
</children>
</HBox>
<HBox>
<children>
<VBox>
<children>
<Label styleClass="text" stylesheets="@style/plateau.css" text="Pas de" />
<Label styleClass="text" stylesheets="@style/plateau.css" text="dégats" />
</children>
</VBox>
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="1" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="2" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="3" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="4" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="5" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="6" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="7" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="8" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="9" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="10" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="11" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="12" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="13" textAlignment="CENTER" />
<Label alignment="CENTER" prefWidth="50.0" styleClass="text" stylesheets="@style/plateau.css" text="14" textAlignment="CENTER" />
</children>
</HBox>
</children>
</VBox>
</children>
</VBox>
</children>
</HBox>
</center>
</BorderPane>
</children>
</AnchorPane>

View File

@ -2,22 +2,23 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<Pane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="414.0" prefWidth="535.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ChoisirBoolean">
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="334.0" prefWidth="449.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ChoisirBoolean">
<children>
<Label layoutX="21.0" layoutY="39.0" text="Voulez vous faire cette action ?">
<Label layoutX="8.0" layoutY="32.0" text="Voulez vous faire cette action ?" AnchorPane.bottomAnchor="215.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="32.0">
<font>
<Font size="36.0" />
</font>
</Label>
<Button fx:id="ouiButton" layoutX="45.0" layoutY="257.0" mnemonicParsing="false" onMouseClicked="#choixOui" prefHeight="82.0" prefWidth="157.0" text="Oui" />
<Label layoutX="202.0" layoutY="99.0">
<Button fx:id="ouiButton" layoutX="68.0" layoutY="147.0" mnemonicParsing="false" onMouseClicked="#choixOui" text="Oui" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="68.0" AnchorPane.rightAnchor="268.0" AnchorPane.topAnchor="147.0" />
<Label layoutX="377.0" layoutY="245.0" AnchorPane.bottomAnchor="187.0" AnchorPane.leftAnchor="181.0" AnchorPane.rightAnchor="312.0" AnchorPane.topAnchor="60.0">
<font>
<Font size="36.0" />
</font>
</Label>
<Button fx:id="nonButton" layoutX="333.0" layoutY="257.0" mnemonicParsing="false" onMouseClicked="#choixNon" prefHeight="82.0" prefWidth="157.0" text="Non" />
<Button fx:id="nonButton" layoutX="286.0" layoutY="147.0" mnemonicParsing="false" onMouseClicked="#choixNon" text="Non" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="286.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="147.0" />
</children>
</Pane>
</AnchorPane>

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<ImageView fitHeight="33.0" fitWidth="200.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<image>
<Image url="@dice.sprite.png" />
</image>
</ImageView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -67,6 +67,12 @@ public class GestionnaireJeu {
return false;
}
public void rollDice(Joueur joueur, int typeDice, int ... rolls){
pc.rollDice(joueur,typeDice,rolls);
}
public static void setConfiguration(Configuration c) {
List<Joueur> joueurs = new ArrayList<Joueur>();

View File

@ -1,7 +1,6 @@
package main;
import java.awt.Point;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -17,6 +16,7 @@ import effet.EffetChoisirEffet;
import effet.EffetSelf;
import effet.action.ActionAltererStatistiquesJoueur;
import effet.action.ActionVoler;
import ihm.controller.PlateauController;
import personnage.Allie;
import personnage.CartePersonnage;
import personnage.Franklin;
@ -197,15 +197,12 @@ public class Plateau {
while(true) {
Joueur currentJoueur = this.joueurs.get(nbJoueurs % i);
System.out.println("\n\n\n\n\n");
System.out.println("Au tour de "+currentJoueur.getNom());
System.out.println("Lancement des dés.");
deplacer(currentJoueur);
System.out.println("Vous êtes désormais sur le lieu "+currentJoueur.getCarteLieu().getNom());
System.out.println("Voulez vous activer l'effet du lieu ?");
if(currentJoueur.choisir()) {
System.out.println("Vous activez l'effet du lieu.");
@ -247,7 +244,7 @@ public class Plateau {
boolean attributed = false;
while(!attributed) {
int roll = sumRolls();
int roll = sumRolls(currentJoueur);
for(CarteLieu cl : lieux) {
if(cl.coordinatesContains(roll) && currentJoueur.getCarteLieu() != cl){
@ -262,7 +259,7 @@ public class Plateau {
public void attaquer(Joueur joueur1, Joueur joueur2) {
int attaque = diffRolls();
int attaque = diffRolls(joueur1);
if(attaque != 0) {
System.out.println(joueur1.getNom()+" attaque "+joueur2.getNom());
@ -277,21 +274,39 @@ public class Plateau {
return new Joueur("0");
}
public int diffRolls() {
return Math.abs(roll6()-roll4());
public int diffRolls(Joueur j) {
int roll4 =rollRandom(4);
int roll6 = rollRandom(6);
gj.rollDice(j, PlateauController.DICE_BOTH, roll4,roll6);
return Math.abs(roll4-roll6);
}
public int roll4() {
return (int) Math.floor(Math.random() * 3)+1;
public int roll4(Joueur j) {
int roll = this.rollRandom(4);
gj.rollDice(j, PlateauController.DICE_QUATRE, roll);
return roll;
}
public int roll6() {
return (int) Math.floor(Math.random() * 5)+1;
public int roll6(Joueur j) {
int roll = this.rollRandom(6);
gj.rollDice(j, PlateauController.DICE_QUATRE, roll);
return roll;
}
public int sumRolls()
private int rollRandom(int nb) {
int roll = (int) Math.floor(Math.random() * (nb-1))+1;
return roll;
}
public int sumRolls(Joueur j)
{
return roll6() + roll4();
return roll6(j) + roll4(j);
}
public List<Joueur> getJoueurs() {

View File

@ -30,7 +30,7 @@ public class Franklin extends Unique{
if(!this.isCapaciteUsed() && joueur.getRevele()) {
Plateau p = joueur.getPlateau();
int roll = p.roll6();
int roll = p.roll6(this.getJoueur());
Joueur joueur2 = joueur.choisiParmisTous();
super.attaquer(joueur2, roll);

View File

@ -17,7 +17,7 @@ public class Georges extends Unique{
if(!this.isCapaciteUsed() && joueur.getRevele()) {
Plateau p = joueur.getPlateau();
int roll = p.roll4();
int roll = p.roll4(this.getJoueur());
Joueur joueur2 = joueur.choisiParmisTous();
super.attaquer(joueur2, roll);