|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package ihm.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Dimension;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
@ -54,9 +53,12 @@ public class PlateauController implements Initializable {
|
|
|
|
|
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
|
|
|
|
private List<JoueurIHM> joueursIHM;
|
|
|
|
|
|
|
|
|
|
@FXML private AnchorPane rootPane;
|
|
|
|
|
@FXML private GridPane gridPaneVie;
|
|
|
|
|
@FXML public GridPane gridPaneLieux;
|
|
|
|
|
@FXML
|
|
|
|
|
private AnchorPane rootPane;
|
|
|
|
|
@FXML
|
|
|
|
|
private GridPane gridPaneVie;
|
|
|
|
|
@FXML
|
|
|
|
|
public GridPane gridPaneLieux;
|
|
|
|
|
|
|
|
|
|
private ChoisirBoolean cb;
|
|
|
|
|
private ChoisirEquipement ce;
|
|
|
|
@ -64,14 +66,14 @@ public class PlateauController implements Initializable {
|
|
|
|
|
private PiocherCarte pc;
|
|
|
|
|
private LancerDes ld;
|
|
|
|
|
|
|
|
|
|
private static Map<Carte,BufferedImage> mapRessourcesCartes;
|
|
|
|
|
private static Map<String,BufferedImage> mapRessourcesDosCartes;
|
|
|
|
|
private static Map<Carte, BufferedImage> mapRessourcesCartes;
|
|
|
|
|
private static Map<String, BufferedImage> mapRessourcesDosCartes;
|
|
|
|
|
|
|
|
|
|
public static int DICE_SIX = 1;
|
|
|
|
|
public static int DICE_QUATRE = 0;
|
|
|
|
|
public static int DICE_BOTH = 2;
|
|
|
|
|
|
|
|
|
|
private final double RES = 200./2250.;
|
|
|
|
|
private final double RES = 200. / 2250.;
|
|
|
|
|
private ResourceBundle resourceBundle;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -79,57 +81,56 @@ public class PlateauController implements Initializable {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
|
|
|
|
//System.out.println("Création du plateau ...");
|
|
|
|
|
// System.out.println("Création du plateau ...");
|
|
|
|
|
|
|
|
|
|
this.resourceBundle = arg1;
|
|
|
|
|
this.joueursIHM = new ArrayList<JoueurIHM>();
|
|
|
|
|
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
|
|
|
|
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
|
|
|
|
RessourceLoader rl = gj.getRessourceLoader();
|
|
|
|
|
|
|
|
|
|
Map<Integer, Joueur> map = gj.getMapJoueurs();
|
|
|
|
|
|
|
|
|
|
for(int i = 0 ; i < gridPaneVie.getChildren().size();i++) {
|
|
|
|
|
for (int i = 0; i < gridPaneVie.getChildren().size(); i++) {
|
|
|
|
|
|
|
|
|
|
Pane p = (Pane) gridPaneVie.getChildren().get(i);
|
|
|
|
|
Label l = (Label) p.getChildren().get(1);
|
|
|
|
|
l.setText(i+"");
|
|
|
|
|
l.setText(i + "");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int i : map.keySet()) {
|
|
|
|
|
for (int i : map.keySet()) {
|
|
|
|
|
System.out.println(i);
|
|
|
|
|
joueursIHM.add(new JoueurIHM(i,map.get(i),getPaneJoueur(i),new Color(Math.random(), Math.random(), Math.random(),1),gridPaneVie, gridPaneLieux,this));
|
|
|
|
|
joueursIHM.add(new JoueurIHM(i, map.get(i), getPaneJoueur(i),
|
|
|
|
|
new Color(Math.random(), Math.random(), Math.random(), 1), gridPaneVie, gridPaneLieux, this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i<joueursIHM.size(); i++) {
|
|
|
|
|
for (int i = 0; i < joueursIHM.size(); i++) {
|
|
|
|
|
joueursIHM.get(i).deplacerPionVie(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mapRessourcesCartes = rl.getRessourceCartes();
|
|
|
|
|
setMapRessourcesDosCartes(rl.getRessourceDosCartes());
|
|
|
|
|
setMapRessourcesDosCartes(rl.getRessourceDosCartes());
|
|
|
|
|
|
|
|
|
|
List<CarteLieu> cl = gj.getCartesLieux();
|
|
|
|
|
List<ImageView> ivs = this.getLieux();
|
|
|
|
|
|
|
|
|
|
applyImages(cl,ivs);
|
|
|
|
|
applyImages(cl, ivs);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void applyImages(List<CarteLieu> cls, List<ImageView> ivs) {
|
|
|
|
|
|
|
|
|
|
int size = cls.size();
|
|
|
|
|
if(cls.size() == ivs.size()) {
|
|
|
|
|
if (cls.size() == ivs.size()) {
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < size; i++) {
|
|
|
|
|
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);
|
|
|
|
|
applyImageLieu(iv, image);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -138,56 +139,55 @@ public class PlateauController implements Initializable {
|
|
|
|
|
|
|
|
|
|
iv.setImage(im);
|
|
|
|
|
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
|
|
|
|
iv.setFitWidth(RES*screenSize.width);
|
|
|
|
|
//iv.fitHeightProperty().bind(sp.heightProperty());
|
|
|
|
|
//iv.fitWidthProperty().bind(sp.widthProperty());
|
|
|
|
|
iv.setFitWidth(RES * screenSize.width);
|
|
|
|
|
// iv.fitHeightProperty().bind(sp.heightProperty());
|
|
|
|
|
// iv.fitWidthProperty().bind(sp.widthProperty());
|
|
|
|
|
|
|
|
|
|
iv.setPreserveRatio(true);
|
|
|
|
|
//iv.fitWidthProperty().bind(sp.widthProperty());
|
|
|
|
|
// iv.fitWidthProperty().bind(sp.widthProperty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Pane getPaneJoueur(int i) {
|
|
|
|
|
|
|
|
|
|
System.out.println("i "+i);
|
|
|
|
|
int position = i%8;
|
|
|
|
|
System.out.println("i " + i);
|
|
|
|
|
int position = i % 8;
|
|
|
|
|
HBox hb = (HBox) rootPane.getChildren().get(0);
|
|
|
|
|
GridPane gp = null;
|
|
|
|
|
|
|
|
|
|
// BAS
|
|
|
|
|
if(position < 2) {
|
|
|
|
|
if (position < 2) {
|
|
|
|
|
VBox group = (VBox) hb.getChildren().get(1);
|
|
|
|
|
gp = (GridPane) group.getChildren().get(2);
|
|
|
|
|
|
|
|
|
|
//DROITE
|
|
|
|
|
}else if(position < 4) {
|
|
|
|
|
System.out.println("Oui");
|
|
|
|
|
Group group = (Group) hb.getChildren().get(2);
|
|
|
|
|
gp = (GridPane) group.getChildren().get(0);
|
|
|
|
|
// DROITE
|
|
|
|
|
} else if (position < 4) {
|
|
|
|
|
System.out.println("Oui");
|
|
|
|
|
Group group = (Group) hb.getChildren().get(2);
|
|
|
|
|
gp = (GridPane) group.getChildren().get(0);
|
|
|
|
|
|
|
|
|
|
//HAUT
|
|
|
|
|
}else if(position < 6) {
|
|
|
|
|
// HAUT
|
|
|
|
|
} else if (position < 6) {
|
|
|
|
|
|
|
|
|
|
VBox group = (VBox) hb.getChildren().get(1);
|
|
|
|
|
gp = (GridPane) group.getChildren().get(0);
|
|
|
|
|
|
|
|
|
|
//GAUCHE
|
|
|
|
|
}else if(position < 8) {
|
|
|
|
|
// GAUCHE
|
|
|
|
|
} else if (position < 8) {
|
|
|
|
|
Group group = (Group) hb.getChildren().get(0);
|
|
|
|
|
gp = (GridPane) group.getChildren().get(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (Pane) gp.getChildren().get(i%2);
|
|
|
|
|
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++) {
|
|
|
|
|
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++) {
|
|
|
|
|
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);
|
|
|
|
@ -208,24 +208,22 @@ public class PlateauController implements Initializable {
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Parent root = fxmlLoader.load();
|
|
|
|
|
|
|
|
|
|
RevelationController rc = fxmlLoader.getController();
|
|
|
|
|
rc.showInformation(listJoueur.get(numJoueur));
|
|
|
|
|
RevelationController rc = fxmlLoader.getController();
|
|
|
|
|
rc.showInformation(listJoueur.get(numJoueur));
|
|
|
|
|
|
|
|
|
|
PopUp popup = new PopUp(root, "Consulter sa carte");
|
|
|
|
|
popup.display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JoueurIHM getJoueurIHM(Joueur j) {
|
|
|
|
|
|
|
|
|
|
for(JoueurIHM joueurIHM : joueursIHM) {
|
|
|
|
|
if(joueurIHM.getJoueur().equals(j)) return joueurIHM;
|
|
|
|
|
for (JoueurIHM joueurIHM : joueursIHM) {
|
|
|
|
|
if (joueurIHM.getJoueur().equals(j))
|
|
|
|
|
return joueurIHM;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Permet de consulter sa carte perssonage en cas d'oublie
|
|
|
|
|
*
|
|
|
|
@ -238,9 +236,8 @@ public class PlateauController implements Initializable {
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Parent root = fxmlLoader.load();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AfficherCarteController acc = fxmlLoader.getController();
|
|
|
|
|
acc.showInformation(listJoueur.get(numJoueur));
|
|
|
|
|
AfficherCarteController acc = fxmlLoader.getController();
|
|
|
|
|
acc.showInformation(listJoueur.get(numJoueur));
|
|
|
|
|
|
|
|
|
|
PopUp popup = new PopUp(root, "Consulter sa carte");
|
|
|
|
|
popup.display();
|
|
|
|
@ -254,8 +251,8 @@ public class PlateauController implements Initializable {
|
|
|
|
|
public void placerJoueurs(Map<Integer, Joueur> j) {
|
|
|
|
|
Set<Integer> set = j.keySet();
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < 8; i++) {
|
|
|
|
|
if(!set.contains(i)) {
|
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
|
if (!set.contains(i)) {
|
|
|
|
|
getPaneJoueur(i).getChildren().setAll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -263,7 +260,7 @@ public class PlateauController implements Initializable {
|
|
|
|
|
|
|
|
|
|
public void rollDice(Joueur joueur, int typeDice, int[] rolls, Contexte c) {
|
|
|
|
|
|
|
|
|
|
this.ld=new LancerDes(typeDice,rolls,c);
|
|
|
|
|
this.ld = new LancerDes(typeDice, rolls, c);
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(joueur);
|
|
|
|
|
jihm.setZoneJoueur(ld.initLancer(joueur));
|
|
|
|
|
}
|
|
|
|
@ -272,19 +269,20 @@ public class PlateauController implements Initializable {
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/choisirBoolean.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
this.cb = fxmlLoader.getController();
|
|
|
|
|
cb.setTitre(contexte);
|
|
|
|
|
if(j instanceof JoueurVirtuel) {
|
|
|
|
|
switch(contexte) {
|
|
|
|
|
case ACTIVER_EFFET_LIEU :
|
|
|
|
|
if (j instanceof JoueurVirtuel) {
|
|
|
|
|
switch (contexte) {
|
|
|
|
|
case ACTIVER_EFFET_LIEU:
|
|
|
|
|
cb.fireBtnIAEffetLieu();
|
|
|
|
|
break;
|
|
|
|
|
case ATTAQUER :
|
|
|
|
|
cb.fireBtnIAattaquer((JoueurVirtuel)j, j.getJoueursRange());
|
|
|
|
|
case ATTAQUER:
|
|
|
|
|
cb.fireBtnIAattaquer((JoueurVirtuel) j, j.getJoueursRange());
|
|
|
|
|
break;
|
|
|
|
|
case CHOISIR_VISION :
|
|
|
|
|
cb.fireBtnIAVision();;
|
|
|
|
|
case CHOISIR_VISION:
|
|
|
|
|
cb.fireBtnIAVision();
|
|
|
|
|
;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -292,15 +290,16 @@ public class PlateauController implements Initializable {
|
|
|
|
|
jihm.setZoneJoueur(root);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void afficherChoisirEquipementVole(Joueur j, List<CarteEquipement> lce) throws IOException {
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/Jouer_tour(2a)voler_equipement.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
this.ce = fxmlLoader.getController();
|
|
|
|
|
this.ce.setListCarteEquipements(lce);
|
|
|
|
|
this.ce.initChoisirEquipement();
|
|
|
|
|
if (j instanceof JoueurVirtuel)
|
|
|
|
|
this.ce.fireBtnIA((JoueurVirtuel) j, Contexte.VOLER_EQUIP);
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
jihm.setZoneJoueur(root);
|
|
|
|
|
}
|
|
|
|
@ -310,29 +309,26 @@ public class PlateauController implements Initializable {
|
|
|
|
|
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();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
AlterationVieZJ avzj = fxmlLoader.getController();
|
|
|
|
|
avzj.changeLabel(valeur);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
Pane p = (Pane) jihm.getZoneJoueur();
|
|
|
|
|
Pane pane = new Pane();
|
|
|
|
|
|
|
|
|
|
if(p.getChildren() != null && p.getChildren().size() > 0) {
|
|
|
|
|
if (p.getChildren() != null && p.getChildren().size() > 0) {
|
|
|
|
|
|
|
|
|
|
pane = (Pane) p.getChildren().get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jihm.setZoneJoueur(root);
|
|
|
|
|
Pane pp = pane;
|
|
|
|
|
Timeline timeline = new Timeline(new KeyFrame(
|
|
|
|
|
Duration.millis(1000),
|
|
|
|
|
ae -> {
|
|
|
|
|
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(1000), ae -> {
|
|
|
|
|
|
|
|
|
|
jihm.resetZoneJoueur();
|
|
|
|
|
jihm.setZoneJoueur(pp);
|
|
|
|
|
GestionnaireJeu.notifyPlateau();
|
|
|
|
|
jihm.resetZoneJoueur();
|
|
|
|
|
jihm.setZoneJoueur(pp);
|
|
|
|
|
GestionnaireJeu.notifyPlateau();
|
|
|
|
|
}));
|
|
|
|
|
timeline.play();
|
|
|
|
|
}
|
|
|
|
@ -342,17 +338,18 @@ public class PlateauController implements Initializable {
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/LieuZJ.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
LieuZJ lzj = fxmlLoader.getController();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
LieuZJ lzj = fxmlLoader.getController();
|
|
|
|
|
lzj.setImageView(this.getImageCarte(j.getCarteLieu()));
|
|
|
|
|
if(j instanceof JoueurVirtuel) lzj.fireBtnIA();
|
|
|
|
|
if (j instanceof JoueurVirtuel)
|
|
|
|
|
lzj.fireBtnIA();
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
if(jihm.getPosition()==4 || jihm.getPosition()==5) {
|
|
|
|
|
SplitPane s=(SplitPane)root.getChildren().get(0);
|
|
|
|
|
AnchorPane a=(AnchorPane)s.getItems().get(0);
|
|
|
|
|
VBox v= (VBox)a.getChildren().get(0);
|
|
|
|
|
AnchorPane b=(AnchorPane)s.getItems().get(1);
|
|
|
|
|
ImageView i= (ImageView)b.getChildren().get(0);
|
|
|
|
|
if (jihm.getPosition() == 4 || jihm.getPosition() == 5) {
|
|
|
|
|
SplitPane s = (SplitPane) root.getChildren().get(0);
|
|
|
|
|
AnchorPane a = (AnchorPane) s.getItems().get(0);
|
|
|
|
|
VBox v = (VBox) a.getChildren().get(0);
|
|
|
|
|
AnchorPane b = (AnchorPane) s.getItems().get(1);
|
|
|
|
|
ImageView i = (ImageView) b.getChildren().get(0);
|
|
|
|
|
|
|
|
|
|
v.setRotate(180);
|
|
|
|
|
i.setRotate(180);
|
|
|
|
@ -361,11 +358,12 @@ public class PlateauController implements Initializable {
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
|
|
|
|
|
List<JoueurIHM> joueursIHM = toJoueursIHM(joueurs);
|
|
|
|
|
|
|
|
|
@ -373,42 +371,43 @@ public class PlateauController implements Initializable {
|
|
|
|
|
cj.setTitre(contexte);
|
|
|
|
|
this.cj.setListJoueursIHM(joueursIHM);
|
|
|
|
|
this.cj.initButtons();
|
|
|
|
|
if(j instanceof JoueurVirtuel)
|
|
|
|
|
cj.fireBtnIA((JoueurVirtuel)j, contexte);
|
|
|
|
|
if (j instanceof JoueurVirtuel)
|
|
|
|
|
cj.fireBtnIA((JoueurVirtuel) j, contexte);
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
jihm.setZoneJoueur(root);
|
|
|
|
|
}
|
|
|
|
|
private List<JoueurIHM> toJoueursIHM(List<Joueur> joueurs) {
|
|
|
|
|
|
|
|
|
|
List<JoueurIHM> list = new ArrayList<JoueurIHM>();
|
|
|
|
|
private List<JoueurIHM> toJoueursIHM(List<Joueur> joueurs) {
|
|
|
|
|
|
|
|
|
|
for(Joueur j : joueurs) {
|
|
|
|
|
list.add(getJoueurIHM(j));
|
|
|
|
|
List<JoueurIHM> list = new ArrayList<JoueurIHM>();
|
|
|
|
|
|
|
|
|
|
for (Joueur j : joueurs) {
|
|
|
|
|
list.add(getJoueurIHM(j));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void afficherPiocher(Joueur j) throws IOException {
|
|
|
|
|
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/Jouer_tour(2b)piocher_carte.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
//CartePiochable lzj = fxmlLoader.getController();
|
|
|
|
|
//lzj.setImageView(this.getImageCarte(j.getCarteLieu()));
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
// CartePiochable lzj = fxmlLoader.getController();
|
|
|
|
|
// lzj.setImageView(this.getImageCarte(j.getCarteLieu()));
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
jihm.setZoneJoueur(root);
|
|
|
|
|
}
|
|
|
|
|
public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
|
|
|
|
|
public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/Jouer_tour(2b)piocher_carte.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
//CartePiochable lzj = fxmlLoader.getController();
|
|
|
|
|
//lzj.setImageView(this.getImageCarte(j.getCarteLieu()));
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
// CartePiochable lzj = fxmlLoader.getController();
|
|
|
|
|
// lzj.setImageView(this.getImageCarte(j.getCarteLieu()));
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
jihm.setZoneJoueur(root);
|
|
|
|
|
}
|
|
|
|
@ -428,14 +427,16 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
jihm.getZoneJoueur().getChildren().setAll();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Joueur getChoixJoueur(Joueur joueur) {
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(joueur);
|
|
|
|
|
JoueurIHM result = this.cj.getJoueurSelected();
|
|
|
|
|
this.cj = null;
|
|
|
|
|
jihm.getZoneJoueur().getChildren().setAll();
|
|
|
|
|
return result.getJoueur();
|
|
|
|
|
JoueurIHM result = this.cj.getJoueurSelected();
|
|
|
|
|
this.cj = null;
|
|
|
|
|
jihm.getZoneJoueur().getChildren().setAll();
|
|
|
|
|
return result.getJoueur();
|
|
|
|
|
}
|
|
|
|
|
public Type getChoixCarte(Joueur joueur) {
|
|
|
|
|
|
|
|
|
|
public Type getChoixCarte(Joueur joueur) {
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(joueur);
|
|
|
|
|
Type result = this.pc.getCarte();
|
|
|
|
|
this.pc = null;
|
|
|
|
@ -451,27 +452,25 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
|
|
|
|
|
public void updateVieJoueur(Joueur joueur, int damage) {
|
|
|
|
|
JoueurIHM jIHM = getJoueurIHM(joueur);
|
|
|
|
|
jIHM.getZoneJoueur().getChildren().setAll();
|
|
|
|
|
jIHM.deplacerPionVie(damage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
public void mettreEnPause(MouseEvent me) throws IOException {
|
|
|
|
|
|
|
|
|
|
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
|
|
|
|
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
|
|
|
|
EffetSonore.playSoundEffect(fileSound1);
|
|
|
|
|
|
|
|
|
|
System.out.println("Jeu en pause ...");
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/Pause.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
|
|
|
|
|
PopUp pu = new PopUp(root, "Pause");
|
|
|
|
|
pu.display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Image getImageCarte(Carte carte) {
|
|
|
|
|
BufferedImage bi = mapRessourcesCartes.get(carte);
|
|
|
|
|
return RessourceLoader.toJavaFX(bi);
|
|
|
|
@ -482,13 +481,11 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
return RessourceLoader.toJavaFX(bi);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
@ -499,7 +496,7 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane pane = fxmlLoader.load();
|
|
|
|
|
rootPane.getChildren().setAll(pane);
|
|
|
|
|
rootPane.getChildren().setAll(pane);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void afficherLT(Joueur j, CartePiochable cartePiochable) throws IOException {
|
|
|
|
@ -507,14 +504,14 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
Image i = getImageCarte(cartePiochable);
|
|
|
|
|
ImageView iv = new ImageView(i);
|
|
|
|
|
Pane p = new Pane(iv);
|
|
|
|
|
PopUp pu = new PopUp(p,"Image");
|
|
|
|
|
pu.getStage().focusedProperty().addListener((obs,wasFocused,isNowFocused) -> {
|
|
|
|
|
if(!isNowFocused) {
|
|
|
|
|
PopUp pu = new PopUp(p, "Image");
|
|
|
|
|
pu.getStage().focusedProperty().addListener((obs, wasFocused, isNowFocused) -> {
|
|
|
|
|
if (!isNowFocused) {
|
|
|
|
|
GestionnaireJeu.notifyPlateau();
|
|
|
|
|
pu.getStage().hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if(j instanceof JoueurVirtuel) {
|
|
|
|
|
if (j instanceof JoueurVirtuel) {
|
|
|
|
|
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(3000), ae -> {
|
|
|
|
|
pu.getStage().hide();
|
|
|
|
|
}));
|
|
|
|
@ -529,19 +526,20 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
final URL fxmlURL = getClass().getResource("/ihm/ressources/RecevoirCarte.fxml");
|
|
|
|
|
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
|
|
|
|
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
|
|
|
Pane root = (Pane)fxmlLoader.load();
|
|
|
|
|
RecevoirCarte lzj = fxmlLoader.getController();
|
|
|
|
|
Pane root = (Pane) fxmlLoader.load();
|
|
|
|
|
RecevoirCarte lzj = fxmlLoader.getController();
|
|
|
|
|
Image im = getImageCarte(cartePiochable);
|
|
|
|
|
lzj.setImageView(im);
|
|
|
|
|
lzj.setText("Cachez la carte vision");
|
|
|
|
|
if(j instanceof JoueurVirtuel) lzj.fireBtnIA();
|
|
|
|
|
if (j instanceof JoueurVirtuel)
|
|
|
|
|
lzj.fireBtnIA();
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(j);
|
|
|
|
|
if(jihm.getPosition()==4 || jihm.getPosition()==5) {
|
|
|
|
|
SplitPane s=(SplitPane)root.getChildren().get(0);
|
|
|
|
|
AnchorPane a=(AnchorPane)s.getItems().get(0);
|
|
|
|
|
VBox v= (VBox)a.getChildren().get(0);
|
|
|
|
|
AnchorPane b=(AnchorPane)s.getItems().get(1);
|
|
|
|
|
ImageView i= (ImageView)b.getChildren().get(0);
|
|
|
|
|
if (jihm.getPosition() == 4 || jihm.getPosition() == 5) {
|
|
|
|
|
SplitPane s = (SplitPane) root.getChildren().get(0);
|
|
|
|
|
AnchorPane a = (AnchorPane) s.getItems().get(0);
|
|
|
|
|
VBox v = (VBox) a.getChildren().get(0);
|
|
|
|
|
AnchorPane b = (AnchorPane) s.getItems().get(1);
|
|
|
|
|
ImageView i = (ImageView) b.getChildren().get(0);
|
|
|
|
|
|
|
|
|
|
v.setRotate(180);
|
|
|
|
|
i.setRotate(180);
|
|
|
|
@ -552,12 +550,11 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String,BufferedImage> getMapRessourcesDosCartes() {
|
|
|
|
|
public Map<String, BufferedImage> getMapRessourcesDosCartes() {
|
|
|
|
|
return mapRessourcesDosCartes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setMapRessourcesDosCartes(Map<String,BufferedImage> mapRessourcesDosCartes) {
|
|
|
|
|
public void setMapRessourcesDosCartes(Map<String, BufferedImage> mapRessourcesDosCartes) {
|
|
|
|
|
this.mapRessourcesDosCartes = mapRessourcesDosCartes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -565,16 +562,15 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
|
|
|
|
|
public void afficherChoisirAction(Joueur joueur, List<Action> list) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Button> buttons = new ArrayList<Button>();
|
|
|
|
|
|
|
|
|
|
for(Action a : list) {
|
|
|
|
|
for (Action a : list) {
|
|
|
|
|
Button button = interpret(a);
|
|
|
|
|
buttons.add(button);
|
|
|
|
|
button.setOnAction(x -> {
|
|
|
|
|
this.choixAction = a;
|
|
|
|
|
GestionnaireJeu.notifyPlateau();
|
|
|
|
|
});
|
|
|
|
|
this.choixAction = a;
|
|
|
|
|
GestionnaireJeu.notifyPlateau();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VBox v = new VBox();
|
|
|
|
@ -583,18 +579,28 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
v.setSpacing(20.0);
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(joueur);
|
|
|
|
|
jihm.setZoneJoueur(v);
|
|
|
|
|
|
|
|
|
|
if (joueur instanceof JoueurVirtuel) {
|
|
|
|
|
for (Button b : buttons)
|
|
|
|
|
b.setDisable(true);
|
|
|
|
|
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(2000), ae -> {
|
|
|
|
|
Button bchoisi = ((JoueurVirtuel)joueur).choisirEffet(buttons);
|
|
|
|
|
bchoisi.setDisable(false);
|
|
|
|
|
bchoisi.fire();
|
|
|
|
|
}));
|
|
|
|
|
timeline.play();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Action getChoixAction(Joueur joueur) {
|
|
|
|
|
return this.choixAction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Button interpret(Action a) {
|
|
|
|
|
|
|
|
|
|
String styles = "-fx-border-color: #e2e2e2;"+"-fx-border-width: 2;"+
|
|
|
|
|
"-fx-background-radius: 0;"+"-fx-background-color: #1d1d1d;"+
|
|
|
|
|
"-fx-text-fill: #d8d8d8;"+"-fx-background-insets: 0 0 0 0, 0, 1, 2;";
|
|
|
|
|
String styles = "-fx-border-color: #e2e2e2;" + "-fx-border-width: 2;" + "-fx-background-radius: 0;"
|
|
|
|
|
+ "-fx-background-color: #1d1d1d;" + "-fx-text-fill: #d8d8d8;"
|
|
|
|
|
+ "-fx-background-insets: 0 0 0 0, 0, 1, 2;";
|
|
|
|
|
|
|
|
|
|
String s = a.toString();
|
|
|
|
|
Button b = new Button(s);
|
|
|
|
@ -602,7 +608,6 @@ public void afficherEffet(Joueur j) throws IOException {
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void revealJoueur(Joueur joueur) {
|
|
|
|
|
JoueurIHM jihm = getJoueurIHM(joueur);
|
|
|
|
|
jihm.reveler();
|
|
|
|
|