PlateauTest2 déplacement des pions
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package ihm.controller;
|
||||
|
||||
import carte.CarteLieu;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import main.Joueur;
|
||||
|
||||
public class GestionnaireDePions {
|
||||
|
||||
@@ -11,10 +14,12 @@ public class GestionnaireDePions {
|
||||
private Pion pionLieu;
|
||||
|
||||
private GridPane gridPaneVie;
|
||||
private GridPane gridPaneLieux;
|
||||
|
||||
public GestionnaireDePions(Color color,GridPane gridPaneVie) {
|
||||
public GestionnaireDePions(Color color,GridPane gridPaneVie,GridPane gridPaneLieux) {
|
||||
|
||||
this.gridPaneVie = gridPaneVie;
|
||||
this.gridPaneLieux = gridPaneLieux;
|
||||
this.pionVie = new Pion(color);
|
||||
this.pionLieu = new Pion(color);
|
||||
}
|
||||
@@ -33,7 +38,28 @@ public class GestionnaireDePions {
|
||||
fpNew.getChildren().add(pionVie);
|
||||
}
|
||||
|
||||
public void deplacerPionLieux() {
|
||||
public void deplacerPionLieux(Joueur j) {
|
||||
|
||||
CarteLieu cl = j.getCarteLieu();
|
||||
int indexCL = j.getPlateau().getLieux().indexOf(cl);
|
||||
HBox hbox;
|
||||
System.out.println("GridPaneLieux "+this.gridPaneLieux);
|
||||
if(indexCL < 2) {
|
||||
hbox = (HBox) this.gridPaneLieux.getChildren().get(0);
|
||||
|
||||
}else if(indexCL < 4) {
|
||||
hbox = (HBox) this.gridPaneLieux.getChildren().get(1);
|
||||
|
||||
}else {
|
||||
hbox = (HBox) this.gridPaneLieux.getChildren().get(2);
|
||||
|
||||
}
|
||||
|
||||
StackPane sp = (StackPane) hbox.getChildren().get(indexCL%2);
|
||||
FlowPane fp = (FlowPane) sp.getChildren().get(0);
|
||||
fp.getChildren().add(this.pionLieu);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user