Révélation des cartes personnage fonctionnel
This commit is contained in:
@ -2,6 +2,7 @@ package ihm.controller;
|
||||
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Border;
|
||||
@ -21,14 +22,16 @@ public class JoueurIHM {
|
||||
private Pane zoneJoueur;
|
||||
private GestionnaireDePions gestionnaireDePions;
|
||||
private Color color;
|
||||
private PlateauController pc;
|
||||
|
||||
public JoueurIHM(int i, Joueur joueur, Pane zoneJoueur, Color color, GridPane gridPaneVie, GridPane gridPaneLieux) {
|
||||
public JoueurIHM(int i, Joueur joueur, Pane zoneJoueur, Color color, GridPane gridPaneVie, GridPane gridPaneLieux, PlateauController pc) {
|
||||
|
||||
this.setPosition(i);
|
||||
this.setJoueur(joueur);
|
||||
this.zoneJoueur = zoneJoueur;
|
||||
this.color = color;
|
||||
this.gestionnaireDePions = new GestionnaireDePions(this.color,gridPaneVie, gridPaneLieux);
|
||||
this.pc = pc;
|
||||
|
||||
zoneJoueur.setBorder(new Border(new BorderStroke(color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(5))));
|
||||
|
||||
@ -43,10 +46,11 @@ public class JoueurIHM {
|
||||
|
||||
this.joueur.reveal();
|
||||
ImageView iv = this.getCartePersonnage();
|
||||
// TODO
|
||||
//this.joueur.getCartePersonnage().getId();
|
||||
//iv.setImage(arg0);
|
||||
System.out.println(joueur.getRevele());
|
||||
System.out.println(this.joueur.getCartePersonnage());
|
||||
Image im = this.pc.getImageCarte(this.joueur.getCartePersonnage());
|
||||
GridPane gp = (GridPane) iv.getParent();
|
||||
iv.setImage(im);
|
||||
iv.fitHeightProperty().bind(gp.heightProperty());
|
||||
btn.setDisable(true);
|
||||
});
|
||||
|
||||
@ -77,7 +81,6 @@ public class JoueurIHM {
|
||||
AnchorPane.setLeftAnchor(p,0.0);
|
||||
AnchorPane.setRightAnchor(p,0.0);
|
||||
AnchorPane.setTopAnchor(p,0.0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,6 +41,7 @@ import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import main.GestionnaireJeu;
|
||||
import main.Joueur;
|
||||
import personnage.CartePersonnage;
|
||||
|
||||
public class PlateauController implements Initializable {
|
||||
|
||||
@ -83,7 +84,7 @@ public class PlateauController implements Initializable {
|
||||
|
||||
for(int i : map.keySet()) {
|
||||
System.out.println(i);
|
||||
joueursIHM.add(new JoueurIHM(i,map.get(i),getPaneJoueur(i),new Color(Math.random(), Math.random(), Math.random(),1),gridPaneVie, gridPaneLieux));
|
||||
joueursIHM.add(new JoueurIHM(i,map.get(i),getPaneJoueur(i),new Color(Math.random(), Math.random(), Math.random(),1),gridPaneVie, gridPaneLieux,this));
|
||||
}
|
||||
|
||||
for(int i = 0; i<joueursIHM.size(); i++) {
|
||||
@ -200,6 +201,8 @@ public class PlateauController implements Initializable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void applyImageLieu(ImageView iv, Image im) {
|
||||
|
||||
StackPane sp = (StackPane) iv.getParent();
|
||||
@ -375,4 +378,10 @@ public class PlateauController implements Initializable {
|
||||
PopUp pu = new PopUp(root, "Pause");
|
||||
pu.display();
|
||||
}
|
||||
|
||||
|
||||
public Image getImageCarte(Carte carte) {
|
||||
BufferedImage bi = this.mapRessourcesCartes.get(carte);
|
||||
return RessourceLoader.toJavaFX(bi);
|
||||
}
|
||||
}
|
@ -127,13 +127,13 @@
|
||||
</Group>
|
||||
<VBox alignment="CENTER" spacing="100.0">
|
||||
<children>
|
||||
<GridPane hgap="50.0" rotate="180.0">
|
||||
<GridPane hgap="50.0" rotate="180.0" VBox.vgrow="ALWAYS">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane nodeOrientation="LEFT_TO_RIGHT">
|
||||
@ -611,13 +611,13 @@
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
<GridPane hgap="50.0">
|
||||
<GridPane hgap="50.0" VBox.vgrow="ALWAYS">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane nodeOrientation="LEFT_TO_RIGHT">
|
||||
|
Reference in New Issue
Block a user