prise en compte des pions

This commit is contained in:
Chiara
2020-04-30 11:40:25 +02:00
parent 8042514def
commit b293b3ed01
6 changed files with 69 additions and 37 deletions

View File

@@ -2,6 +2,7 @@ package ihm.controller;
import java.io.IOException;
import java.net.URL;
import java.util.Locale;
import java.util.Random;
import java.util.ResourceBundle;
@@ -34,6 +35,8 @@ public class JouerSonTour1Controller implements Initializable{
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
System.out.println("\tLancements des dès");
//nomJoueur.setText(joueur.getNom());
int OFFSET_X = 0;
@@ -80,12 +83,11 @@ public class JouerSonTour1Controller implements Initializable{
@FXML
public void lancerDes(MouseEvent mouseEvent) throws IOException, InterruptedException{
Thread.sleep(1000);
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/Jouer_tour(2)carte_lieux.fxml"));
rootPane.getChildren().setAll(pane);
final URL fxmlURL = getClass().getResource("../ressources/Jouer_tour(2)carte_lieux.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.ENGLISH);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = fxmlLoader.load();
rootPane.getChildren().setAll(root);
}
public void deplacerPion(CarteLieu lieux) {

View File

@@ -21,6 +21,7 @@ public class JouerSonTour2Controller implements Initializable{
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
System.out.println("\tDescrption du lieux");
//descriptionLieu.setText(lieu.getDescription());
}

View File

@@ -22,17 +22,12 @@ import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Circle;
import main.Joueur;
import main.View;
public class PlateauController implements Initializable {
private List<Joueur> listJoueur = new ArrayList<Joueur>();
private List<VBox> vboxJoueur = new ArrayList<VBox>();
private List<HBox> hboxJoueur = new ArrayList<HBox>();
private List<Button> btnRevelation = new ArrayList<Button>();
private List<ImageView> cartePerso = new ArrayList<ImageView>();
private List<Label> nomJoueur = new ArrayList<Label>();
private List<AnchorPane> tour = new ArrayList<AnchorPane>();
@FXML private HBox joueur1;
@FXML private HBox joueur2;
@@ -43,6 +38,19 @@ public class PlateauController implements Initializable {
@FXML private VBox joueur7;
@FXML private VBox joueur8;
private List<VBox> vboxJoueur = new ArrayList<VBox>();
private List<HBox> hboxJoueur = new ArrayList<HBox>();
private List<Button> btnRevelation = new ArrayList<Button>();
private List<ImageView> cartePerso = new ArrayList<ImageView>();
private List<Label> nomJoueur = new ArrayList<Label>();
private List<AnchorPane> tour = new ArrayList<AnchorPane>();
@FXML private HBox lieux;
@FXML private HBox vie;
private List<Circle> pionLieux = new ArrayList<Circle>();
private List<Circle> pionVie = new ArrayList<Circle>();
public static int DICE_SIX = 2;
public static int DICE_QUATRE = 1;
public static int DICE_BOTH = 0;
@@ -53,8 +61,8 @@ public class PlateauController implements Initializable {
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
System.out.println("Création du plateau ...");
//initialisation des attributs des joueurs
//initialisation des attributs des joueurs
this.hboxJoueur.add(joueur1);
this.hboxJoueur.add(joueur2);
this.hboxJoueur.add(joueur3);
@@ -100,18 +108,39 @@ public class PlateauController implements Initializable {
}
//initialisation des pions
VBox pionLieux14 = (VBox) lieux.getChildren().get(0);
VBox pionLieux58 = (VBox) lieux.getChildren().get(4);
for (int k=0; k<4; k++) {
pionLieux.add((Circle) pionLieux14.getChildren().get(k));
}
for (int k=0; k<4; k++) {
pionLieux.add((Circle) pionLieux58.getChildren().get(k));
}
VBox pionVie14 = (VBox) lieux.getChildren().get(0);
VBox pionVie58 = (VBox) lieux.getChildren().get(4);
for (int k=0; k<4; k++) {
pionVie.add((Circle) pionVie14.getChildren().get(k));
}
for (int k=0; k<4; k++) {
pionVie.add((Circle) pionVie58.getChildren().get(k));
}
System.out.println("Tour du joueur 1");
try {
final URL fxmlURL = getClass().getResource("../ressources/Jouer_tour(1)lancer_des.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.ENGLISH);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = fxmlLoader.load();
root.setPrefSize(255, 180);
tour.get(0).getChildren().setAll(root);
tour.get(2).getChildren().setAll(root);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
listJoueur = View.getJoueurs();
}
@@ -169,7 +198,7 @@ public class PlateauController implements Initializable {
* @param j : map donnant le joueur et son numero
*/
public void showInformation(Map<Integer, Joueur> j) {
System.out.println("\tplacement des joueurs");
System.out.println("\tPlacement des joueurs");
int taille = this.vboxJoueur.size() + this.hboxJoueur.size();
for (int i=0; i<taille; i++) {