push
This commit is contained in:
@@ -11,17 +11,14 @@ import ihm.PopUp;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import main.Joueur;
|
||||
|
||||
public class PlateauController implements Initializable {
|
||||
@FXML private BorderPane root;
|
||||
|
||||
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
||||
private List<VBox> vboxJoueur = new ArrayList<VBox>();
|
||||
private List<Button> btnRevelation = new ArrayList<Button>();
|
||||
@@ -44,9 +41,6 @@ public class PlateauController implements Initializable {
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// initialisation des joueurs
|
||||
attribuerPerso(listJoueur);
|
||||
|
||||
//initialisation des attributs des joueurs
|
||||
this.vboxJoueur.add(joueur1);
|
||||
this.vboxJoueur.add(joueur2);
|
||||
@@ -65,13 +59,20 @@ public class PlateauController implements Initializable {
|
||||
btnRevelation.add((Button) enfant.getChildren().get(1));
|
||||
}
|
||||
//initilaisation des boutons se reveler
|
||||
int i = 0;
|
||||
for (Button b : btnRevelation) {
|
||||
b.setOnAction(e -> {try {seReveler(null);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
int compteur = i;
|
||||
b.setOnAction(e -> {try {seReveler(compteur);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
i++;
|
||||
}
|
||||
//initialisation des bouton carte personnage
|
||||
int j = 0;
|
||||
for (Button b : btnCartePerso) {
|
||||
b.setOnAction(e -> {try {consulterSaCarte(null);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
int compteur = j;
|
||||
b.setOnAction(e -> {try {consulterSaCarte(compteur);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
j++;
|
||||
}
|
||||
|
||||
//initialisation nom personnage
|
||||
for (Label l : nomPerso) {
|
||||
l.setText("???");
|
||||
@@ -87,10 +88,15 @@ public class PlateauController implements Initializable {
|
||||
*
|
||||
* @param j : Le joueur sur lequel on a cliqu<71>
|
||||
*/
|
||||
public void seReveler(Joueur j) throws IOException {
|
||||
System.out.println("Le joueur ... se rev<EFBFBD>le");
|
||||
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/Reveler_son_identite.fxml"));
|
||||
PopUp popup = new PopUp(pane, "reveler son identit<69>");
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -99,23 +105,28 @@ public class PlateauController implements Initializable {
|
||||
*
|
||||
* @param j : Le joueur sur lequel on a cliqu<71>
|
||||
*/
|
||||
public void consulterSaCarte(Joueur j) throws IOException {
|
||||
System.out.println("Le joueur ... consulte sa carte");
|
||||
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/afficher_carte_perso.fxml"));
|
||||
pane.setUserData("blblblb");
|
||||
System.out.println(pane.getUserData());
|
||||
PopUp popup = new PopUp(pane, "Consulter sa carte");
|
||||
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(List<Joueur> j) {
|
||||
System.out.println("Ecriture des noms des joueurs");
|
||||
System.out.println("\tEcriture des noms des joueurs");
|
||||
for (int i=0; i<j.size(); i++) {
|
||||
nomJoueur.get(i).setText(j.get(i).getNom());
|
||||
if (j.get(i) != null)
|
||||
nomJoueur.get(i).setText(j.get(i).getNom());
|
||||
else {
|
||||
vboxJoueur.get(i).setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attribuerPerso(List<Joueur> lj) {
|
||||
|
||||
listJoueur = j;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user