Merge branch 'development' of https://github.com/PTE-SH/ShadowHunterGame into development

This commit is contained in:
nawfe
2020-04-30 14:13:29 +02:00
11 changed files with 1430 additions and 756 deletions

View File

@@ -0,0 +1,70 @@
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;
public class JoueurIHM {
private int position;
private Joueur joueur;
private Pane pane;
public JoueurIHM(int i, Joueur joueur, Pane pane) {
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

@@ -49,6 +49,9 @@ public class PlateauController implements Initializable {
private List<Label> nomJoueur = new ArrayList<Label>();
private List<AnchorPane> tour = new ArrayList<AnchorPane>();
private List<JoueurIHM> joueursIHM;
@FXML private HBox lieux;
@FXML private HBox vie;
@@ -64,19 +67,22 @@ 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>();
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
this.joueursPane = new HashMap<Joueur, Pane>();
Map<Integer, Joueur> map = gj.getMapJoueurs();
for(int i : map.keySet()) {
this.joueursPane.put(map.get(i), getPaneJoueur(i));
joueursIHM.add(new JoueurIHM(i,map.get(i),getPaneJoueur(i)));
}
System.out.println(joueursPane);
//System.out.println(this.joueursPane);
this.hboxJoueur.add(joueur1);
this.hboxJoueur.add(joueur2);
@@ -155,7 +161,7 @@ public class PlateauController implements Initializable {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private Pane getPaneJoueur(int i) {