Ajout des cartes lieux en provenance de la bdd
This commit is contained in:
parent
78f251d5f1
commit
d6fe0f0d80
@ -25,6 +25,8 @@ public class CarteLieuMultiple extends CarteLieu{
|
||||
*/
|
||||
public void utiliser(Joueur j) {
|
||||
Pioche p = (Pioche) j.choisir(pioches);
|
||||
System.out.println(pioches+ " "+p);
|
||||
System.out.println(p.getStack());
|
||||
Carte c = p.piocher();
|
||||
c.utiliser(j);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public class CarteLieuType extends CarteLieu{
|
||||
* @param j Appel la méthode utiliser de effet sur le joueur j
|
||||
*/
|
||||
public void utiliser(Joueur j) {
|
||||
System.out.println(pioche);
|
||||
CartePiochable carte = pioche.piocher();
|
||||
carte.utiliser(j);
|
||||
}
|
||||
|
@ -20,10 +20,12 @@ public class CartePiochable extends CarteCondition implements Serializable{
|
||||
|
||||
public CartePiochable(Type t, String nom, String description) {
|
||||
super(nom, description);
|
||||
this.type = t;
|
||||
}
|
||||
|
||||
public CartePiochable(Type t, Effet e, Condition c) {
|
||||
super();
|
||||
this.type = t;
|
||||
this.setEffet(e);
|
||||
this.setCondition(c);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class CreatingCardsTest {
|
||||
|
||||
//Ange gardien
|
||||
try {
|
||||
/*
|
||||
|
||||
DatabaseManager.queryInsertObject(2,new CartePiochable(CartePiochable.Type.LUMIERE,
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_IMMUNITY, 1, true))));
|
||||
|
||||
@ -240,7 +240,7 @@ public class CreatingCardsTest {
|
||||
DatabaseManager.queryInsertObject(56,new Metamorphe());
|
||||
DatabaseManager.queryInsertObject(57,new Vampire());
|
||||
|
||||
*/
|
||||
|
||||
//62
|
||||
|
||||
|
||||
|
@ -54,6 +54,8 @@ public class QueryGenerator {
|
||||
table = getTable("CartesPersonnage");
|
||||
} else if(id <= 61) {
|
||||
table = getTable("CartesDos");
|
||||
}else if(id <= 67) {
|
||||
table = getTable("CartesLieu");
|
||||
}
|
||||
return "SELECT * FROM " + table + " WHERE id = " + id;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package database;
|
||||
|
||||
import java.awt.Image;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -15,6 +16,8 @@ import javax.imageio.ImageIO;
|
||||
import carte.Carte;
|
||||
import carte.CarteLieu;
|
||||
import carte.CartePiochable;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javafx.scene.image.Image;
|
||||
import personnage.CartePersonnage;
|
||||
|
||||
public class RessourceLoader {
|
||||
@ -35,28 +38,30 @@ public class RessourceLoader {
|
||||
private final int ID_DOS_TENEBRE= 59;
|
||||
private final int ID_DOS_VISION= 61;
|
||||
|
||||
private Map<Carte, Image> ressourcesCartes;
|
||||
private Map<String, Image> ressourcesDosCartes;
|
||||
private Map<Carte, BufferedImage> ressourcesCartes;
|
||||
private Map<String, BufferedImage> ressourcesDosCartes;
|
||||
|
||||
|
||||
public RessourceLoader() {
|
||||
this.ressourcesCartes = new HashMap<Carte,Image>();
|
||||
this.ressourcesDosCartes = new HashMap<String, Image>();
|
||||
this.ressourcesCartes = new HashMap<Carte,BufferedImage>();
|
||||
this.ressourcesDosCartes = new HashMap<String, BufferedImage>();
|
||||
}
|
||||
|
||||
private Map<Integer, Carte> loadCards() throws ClassNotFoundException, IOException{
|
||||
|
||||
Table t = new Table();
|
||||
Map<Integer, Carte> cartes = new HashMap<Integer,Carte>();
|
||||
for(int i = 0; i < 61; i++) {
|
||||
for(int i = 0; i < 67; i++) {
|
||||
|
||||
String query = QueryGenerator.selectId(i+1);
|
||||
t.remplirTableQuery(query);
|
||||
|
||||
byte[] obj = t.getList().get(i).getObjet();
|
||||
Record r = t.getList().get(i);
|
||||
byte[] obj = r.getObjet();
|
||||
if(obj != null) {
|
||||
Object o = deserialize(obj);
|
||||
Carte c = (Carte)o;
|
||||
c.setNom(r.getNom());
|
||||
cartes.put(i+1, c);
|
||||
}
|
||||
}
|
||||
@ -105,21 +110,21 @@ public class RessourceLoader {
|
||||
return is.readObject();
|
||||
}
|
||||
|
||||
private Image loadImage(int id) throws IOException {
|
||||
private BufferedImage loadImage(int id) throws IOException {
|
||||
String name = ""+id+".png";
|
||||
String url = "ressources/cartes/"+name;
|
||||
Image picture = ImageIO.read(new File(url));
|
||||
BufferedImage picture = ImageIO.read(new File(url));
|
||||
return picture;
|
||||
}
|
||||
|
||||
private Map<Carte, Image> getMapImageCarte(Map<Integer, Carte> cartes) throws IOException{
|
||||
private Map<Carte, BufferedImage> getMapImageCarte(Map<Integer, Carte> cartes) throws IOException{
|
||||
|
||||
Map<Carte, Image> mapCarteImage = new HashMap<Carte, Image>();
|
||||
Map<Carte, BufferedImage> mapCarteImage = new HashMap<Carte, BufferedImage>();
|
||||
|
||||
for(Integer i : cartes.keySet()) {
|
||||
|
||||
Carte c = cartes.get(i);
|
||||
Image img = loadImage(i);
|
||||
BufferedImage img = loadImage(i);
|
||||
mapCarteImage.put(c,img);
|
||||
}
|
||||
|
||||
@ -164,13 +169,12 @@ public class RessourceLoader {
|
||||
List<CartePiochable> cartesType = new ArrayList<CartePiochable>();
|
||||
|
||||
for(Carte c : cartes) {
|
||||
|
||||
|
||||
if(c instanceof CartePiochable) {
|
||||
|
||||
CartePiochable carte = (CartePiochable) c;
|
||||
|
||||
System.out.println(carte.getNom()+" "+carte.getType());
|
||||
CartePiochable.Type type = carte.getType();
|
||||
|
||||
if(t == type) {
|
||||
cartesType.add(carte);
|
||||
}
|
||||
@ -208,4 +212,16 @@ public class RessourceLoader {
|
||||
return cartesLieu;
|
||||
}
|
||||
|
||||
public Map<Carte,BufferedImage> getRessourceCartes(){
|
||||
return this.ressourcesCartes;
|
||||
}
|
||||
|
||||
public Map<String,BufferedImage> getRessourceDosCartes(){
|
||||
return this.ressourcesDosCartes;
|
||||
}
|
||||
|
||||
public static Image toJavaFX(BufferedImage img) {
|
||||
Image image = SwingFXUtils.toFXImage(img, null);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import database.RessourceLoader;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
@ -44,11 +45,11 @@ public class Main extends Application {
|
||||
public static void main(String[] args) {
|
||||
|
||||
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
||||
/*
|
||||
|
||||
RessourceLoader rl = new RessourceLoader();
|
||||
rl.loadRessources();
|
||||
gj.setRessourceLoader(rl);
|
||||
*/
|
||||
|
||||
launch(args);
|
||||
}
|
||||
}
|
@ -44,8 +44,7 @@ public class GestionnaireDePions {
|
||||
StackPane nNew = (StackPane) gp.getChildren().get(damage);
|
||||
FlowPane fpNew = (FlowPane) nNew.getChildren().get(0);
|
||||
|
||||
fpNew.getChildren().add(pionVie);
|
||||
|
||||
if(!fpNew.getChildren().contains(pionVie)) fpNew.getChildren().add(pionVie);
|
||||
|
||||
}
|
||||
|
||||
@ -66,9 +65,10 @@ public class GestionnaireDePions {
|
||||
}
|
||||
|
||||
StackPane sp = (StackPane) hbox.getChildren().get(indexCL%2);
|
||||
FlowPane fp = (FlowPane) sp.getChildren().get(0);
|
||||
FlowPane fp = (FlowPane) sp.getChildren().get(1);
|
||||
|
||||
fp.getChildren().add(this.pionLieu);
|
||||
if(!fp.getChildren().contains(this.pionLieu)) fp.getChildren().add(this.pionLieu);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ihm.controller;
|
||||
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
@ -11,20 +12,31 @@ import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
|
||||
import carte.Carte;
|
||||
import carte.CarteLieu;
|
||||
import database.RessourceLoader;
|
||||
import ihm.EffetSonore;
|
||||
import ihm.PopUp;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Label;
|
||||
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 main.GestionnaireJeu;
|
||||
@ -41,7 +53,9 @@ public class PlateauController implements Initializable {
|
||||
|
||||
|
||||
private ChoisirBoolean cb;
|
||||
|
||||
|
||||
|
||||
private Map<Carte,BufferedImage> mapRessourcesCartes;
|
||||
public static int DICE_SIX = 2;
|
||||
public static int DICE_QUATRE = 1;
|
||||
public static int DICE_BOTH = 0;
|
||||
@ -55,6 +69,8 @@ public class PlateauController implements Initializable {
|
||||
|
||||
this.joueursIHM = new ArrayList<JoueurIHM>();
|
||||
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
||||
RessourceLoader rl = gj.getRessourceLoader();
|
||||
|
||||
Map<Integer, Joueur> map = gj.getMapJoueurs();
|
||||
|
||||
for(int i = 0 ; i < gridPaneVie.getChildren().size();i++) {
|
||||
@ -75,7 +91,12 @@ public class PlateauController implements Initializable {
|
||||
}
|
||||
|
||||
|
||||
mapRessourcesCartes = rl.getRessourceCartes();
|
||||
|
||||
List<CarteLieu> cl = gj.getCartesLieux();
|
||||
List<ImageView> ivs = this.getLieux();
|
||||
|
||||
applyImages(cl,ivs);
|
||||
|
||||
// BUTTONS ETC
|
||||
//System.out.println(this.joueursPane);
|
||||
@ -162,6 +183,31 @@ public class PlateauController implements Initializable {
|
||||
}
|
||||
|
||||
|
||||
private void applyImages(List<CarteLieu> cls, List<ImageView> ivs) {
|
||||
|
||||
int size = cls.size();
|
||||
if(cls.size() == ivs.size()) {
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
|
||||
CarteLieu cl = cls.get(i);
|
||||
ImageView iv = ivs.get(i);
|
||||
|
||||
BufferedImage bi = mapRessourcesCartes.get(cl);
|
||||
Image image = RessourceLoader.toJavaFX(bi);
|
||||
applyImageLieu(iv,image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyImageLieu(ImageView iv, Image im) {
|
||||
|
||||
StackPane sp = (StackPane) iv.getParent();
|
||||
iv.setImage(im);
|
||||
iv.fitHeightProperty().bind(sp.heightProperty());
|
||||
}
|
||||
|
||||
|
||||
private Pane getPaneJoueur(int i) {
|
||||
|
||||
System.out.println("i "+i);
|
||||
@ -197,6 +243,21 @@ public class PlateauController implements Initializable {
|
||||
return (Pane) gp.getChildren().get(i%2);
|
||||
}
|
||||
|
||||
private List<ImageView> getLieux() {
|
||||
|
||||
List<ImageView> views = new ArrayList<ImageView>();
|
||||
for(int i = 0 ; i < gridPaneLieux.getChildren().size(); i++) {
|
||||
|
||||
HBox p = (HBox) gridPaneLieux.getChildren().get(i);
|
||||
for(int j = 0; j < p.getChildren().size(); j++) {
|
||||
StackPane sp = (StackPane) p.getChildren().get(j);
|
||||
ImageView iv = (ImageView) sp.getChildren().get(0);
|
||||
views.add(iv);
|
||||
}
|
||||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche aux yeux de tous la carte personnage du joueur
|
||||
*
|
||||
|
@ -18,7 +18,7 @@
|
||||
<?import javafx.scene.shape.Circle?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" 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 fx:id="rootPane" 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">
|
||||
<children>
|
||||
<HBox alignment="CENTER" layoutX="14.0" spacing="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
@ -70,6 +70,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
<GridPane nodeOrientation="RIGHT_TO_LEFT" GridPane.columnIndex="1">
|
||||
<columnConstraints>
|
||||
@ -108,6 +111,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</children>
|
||||
<padding>
|
||||
@ -167,6 +173,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
<GridPane nodeOrientation="RIGHT_TO_LEFT" GridPane.columnIndex="1">
|
||||
<columnConstraints>
|
||||
@ -205,17 +214,20 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="25.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
<HBox alignment="CENTER" maxHeight="600.0" maxWidth="1200.0" spacing="50.0" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="CENTER" prefHeight="366.0" prefWidth="810.0" spacing="50.0">
|
||||
<children>
|
||||
<VBox alignment="TOP_CENTER">
|
||||
<children>
|
||||
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="carteLumiere" stylesheets="@style/plateau.css">
|
||||
<HBox styleClass="carteLumiere" stylesheets="@style/plateau.css">
|
||||
<children>
|
||||
<ImageView fitHeight="97.8" fitWidth="70.05" pickOnBounds="true" preserveRatio="true" styleClass="background">
|
||||
<image>
|
||||
@ -249,19 +261,19 @@
|
||||
</VBox>
|
||||
<VBox alignment="CENTER" spacing="50.0">
|
||||
<children>
|
||||
<GridPane hgap="20.0" VBox.vgrow="ALWAYS">
|
||||
<GridPane alignment="CENTER" hgap="20.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
<ColumnConstraints />
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane>
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
<ColumnConstraints />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
@ -278,67 +290,79 @@
|
||||
</GridPane>
|
||||
<GridPane fx:id="gridPaneLieux" hgap="20.0" GridPane.columnIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints />
|
||||
<ColumnConstraints />
|
||||
<ColumnConstraints />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<HBox alignment="TOP_CENTER" styleClass="lieux" stylesheets="@style/plateau.css">
|
||||
<HBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" spacing="5.0" styleClass="lieux" stylesheets="@style/plateau.css">
|
||||
<children>
|
||||
<StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<FlowPane prefHeight="200.0" prefWidth="200.0" />
|
||||
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane styleClass="lieu" />
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane layoutX="39.0" layoutY="12.0">
|
||||
<StackPane layoutX="39.0" layoutY="12.0" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<FlowPane prefHeight="200.0" prefWidth="200.0" />
|
||||
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets />
|
||||
</GridPane.margin>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="BOTTOM_CENTER" styleClass="lieux" stylesheets="@style/plateau.css" GridPane.columnIndex="1">
|
||||
<HBox alignment="BOTTOM_CENTER" spacing="5.0" styleClass="lieux" stylesheets="@style/plateau.css" GridPane.columnIndex="1">
|
||||
<children>
|
||||
<StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<FlowPane prefHeight="200.0" prefWidth="200.0" />
|
||||
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<FlowPane prefHeight="200.0" prefWidth="200.0" />
|
||||
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="TOP_CENTER" styleClass="lieux" stylesheets="@style/plateau.css" GridPane.columnIndex="2">
|
||||
<HBox alignment="TOP_CENTER" spacing="5.0" styleClass="lieux" stylesheets="@style/plateau.css" GridPane.columnIndex="2">
|
||||
<children>
|
||||
<StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<FlowPane prefHeight="200.0" prefWidth="200.0" />
|
||||
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<FlowPane prefHeight="200.0" prefWidth="200.0" />
|
||||
<ImageView fitHeight="132.03" fitWidth="94.5675" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
</children>
|
||||
</GridPane>
|
||||
<GridPane GridPane.columnIndex="2">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
<ColumnConstraints />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
@ -633,6 +657,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
<GridPane nodeOrientation="RIGHT_TO_LEFT" GridPane.columnIndex="1">
|
||||
<columnConstraints>
|
||||
@ -671,6 +698,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</children>
|
||||
<padding>
|
||||
@ -727,6 +757,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
<GridPane nodeOrientation="RIGHT_TO_LEFT" GridPane.columnIndex="1">
|
||||
<columnConstraints>
|
||||
@ -765,6 +798,9 @@
|
||||
</FlowPane>
|
||||
<Label styleClass="text" stylesheets="@style/plateau.css" text="Equipements" GridPane.columnIndex="2" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</children>
|
||||
<padding>
|
||||
|
@ -77,4 +77,9 @@
|
||||
-fx-border-color: #e2e2e2;
|
||||
-fx-border-width: 2;
|
||||
-fx-background-radius: 0;
|
||||
}
|
||||
|
||||
.pane{
|
||||
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import carte.CarteLieu;
|
||||
import database.RessourceLoader;
|
||||
import effet.Effet;
|
||||
import ihm.controller.PlateauController;
|
||||
@ -70,12 +71,10 @@ public class GestionnaireJeu {
|
||||
}
|
||||
|
||||
public boolean choisir(Joueur joueur) {
|
||||
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
try {
|
||||
pc.afficherChoisir(joueur);
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
@ -133,8 +132,8 @@ public class GestionnaireJeu {
|
||||
for(Joueur j : mapJoueurs.values()) {
|
||||
joueurs.add(j);
|
||||
}
|
||||
plateau = new Plateau(joueurs);
|
||||
//plateau = new Plateau(joueurs,ressourceLoader.getCartes());
|
||||
//plateau = new Plateau(joueurs);
|
||||
plateau = new Plateau(joueurs,ressourceLoader.getCartes());
|
||||
|
||||
}
|
||||
|
||||
@ -160,6 +159,13 @@ public class GestionnaireJeu {
|
||||
this.ressourceLoader = rl;
|
||||
}
|
||||
|
||||
public List<CarteLieu> getCartesLieux() {
|
||||
return plateau.getLieux();
|
||||
}
|
||||
|
||||
public RessourceLoader getRessourceLoader() {
|
||||
return this.ressourceLoader;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -134,8 +134,8 @@ public class Joueur {
|
||||
j2.gestionnaireEquipements.retirer(equipement);
|
||||
this.gestionnaireEquipements.ajouter(equipement); }
|
||||
|
||||
public Object choisir(List<?> equipements) {
|
||||
return null;
|
||||
public Object choisir(List<?> list) {
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
public void attaquer(Joueur j2, int attaqueDice) {
|
||||
|
@ -27,4 +27,10 @@ public class Pioche {
|
||||
public CartePiochable piocher() {
|
||||
return cartesPiochables.pop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Stack<CartePiochable> getStack() {
|
||||
return cartesPiochables;
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,8 @@ public class Plateau extends Thread{
|
||||
List<CartePiochable> lumiere = RessourceLoader.getCartesType(CartePiochable.Type.LUMIERE, cartes);
|
||||
List<CartePiochable> tenebre = RessourceLoader.getCartesType(CartePiochable.Type.TENEBRE, cartes);
|
||||
List<CartePiochable> vision = RessourceLoader.getCartesType(CartePiochable.Type.VISION, cartes);
|
||||
|
||||
|
||||
System.out.println("VISION "+vision);
|
||||
Map<CartePiochable.Type, List<CartePiochable>> map = new HashMap<CartePiochable.Type, List<CartePiochable>>();
|
||||
map.put(CartePiochable.Type.LUMIERE,lumiere);
|
||||
map.put(CartePiochable.Type.TENEBRE,tenebre);
|
||||
@ -160,6 +161,8 @@ public class Plateau extends Thread{
|
||||
|
||||
if(x instanceof CarteLieuType) {
|
||||
CarteLieuType clt = (CarteLieuType)x;
|
||||
System.out.println(clt.getType());
|
||||
System.out.println("Oui "+ map.get(clt.getType()));
|
||||
clt.setPioche(new Pioche(map.get(clt.getType())));
|
||||
}
|
||||
|
||||
@ -173,7 +176,8 @@ public class Plateau extends Thread{
|
||||
clm.setPioches(lp);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
List<CartePersonnage> personnages = RessourceLoader.getCartesPersonnages(cartes);
|
||||
|
||||
@ -264,6 +268,7 @@ public class Plateau extends Thread{
|
||||
System.out.println("Au tour de "+currentJoueur.getNom());
|
||||
System.out.println("Lancement des dés.");
|
||||
deplacer(currentJoueur);
|
||||
System.out.println("OUI");
|
||||
if(isPartieTerminee()) break;
|
||||
System.out.println("Vous êtes désormais sur le lieu "+currentJoueur.getCarteLieu().getNom());
|
||||
System.out.println("Voulez vous activer l'effet du lieu ?");
|
||||
@ -318,14 +323,12 @@ public class Plateau extends Thread{
|
||||
for(CarteLieu cl : lieux) {
|
||||
|
||||
if(cl.coordinatesContains(roll) && currentJoueur.getCarteLieu() != cl){
|
||||
|
||||
currentJoueur.deplacer(cl);
|
||||
attributed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gj.deplacer(currentJoueur);
|
||||
}
|
||||
|
||||
@ -338,7 +341,6 @@ public class Plateau extends Thread{
|
||||
System.out.println(joueur2.getNom()+" a "+joueur2.getStat(Joueur.PLAYER_HP)+" pv");
|
||||
joueur1.attaquer(joueur2,attaque);
|
||||
System.out.println(joueur2.getNom()+" passe à "+joueur2.getStat(Joueur.PLAYER_HP)+" pv");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user