PlateauController et JoueurIHM

This commit is contained in:
Paul Gross
2020-04-30 13:57:53 +02:00
parent fa90f4b6d9
commit 12bf8f788e
3 changed files with 57 additions and 6 deletions

View File

@@ -1,5 +1,9 @@
package ihm.controller;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import main.Joueur;
@@ -10,11 +14,57 @@ public class JoueurIHM {
private Pane pane;
public JoueurIHM(int i, Joueur joueur, Pane pane) {
this.position = i;
this.joueur = joueur;
this.setPosition(i);
this.setJoueur(joueur);
this.pane = pane;
String name = joueur.getNom();
setLabelJoueur(name);
}
public Button getRevealButton() {
Pane p = (Pane) pane.getChildren().get(1);
return (Button) p.getChildren().get(1);
}
public ImageView getCartePersonnage() {
Pane p = (Pane) pane.getChildren().get(1);
return (ImageView) p.getChildren().get(0);
}
public AnchorPane getZoneJoueur() {
return (AnchorPane) pane.getChildren().get(0);
}
public Label getLabelJoueur() {
Pane p = (Pane) pane.getChildren().get(2);
return (Label) p.getChildren().get(0);
}
public void setLabelJoueur(String name) {
Label label = getLabelJoueur();
label.setText(name);
}
public Label getPaneEquipement() {
Pane p = (Pane) pane.getChildren().get(2);
return (Label) p.getChildren().get(1);
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public Joueur getJoueur() {
return joueur;
}
public void setJoueur(Joueur joueur) {
this.joueur = joueur;
}
}

View File

@@ -67,7 +67,7 @@ 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.joueursIHM = new ArrayList<JoueurIHM>();
@@ -81,6 +81,7 @@ public class PlateauController implements Initializable {
//System.out.println(this.joueursPane);
this.hboxJoueur.add(joueur1);
this.hboxJoueur.add(joueur2);
this.hboxJoueur.add(joueur3);
@@ -158,7 +159,7 @@ public class PlateauController implements Initializable {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private Pane getPaneJoueur(int i) {