Merge branch 'development' of https://github.com/PTE-SH/ShadowHunterGame into development
This commit is contained in:
@ -66,20 +66,27 @@ public class JoueurIHM {
|
||||
private void initRevealButton() {
|
||||
Button btn = getRevealButton();
|
||||
btn.setOnAction(x -> {
|
||||
|
||||
this.joueur.reveal();
|
||||
ImageView iv = this.getCartePersonnage();
|
||||
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());
|
||||
initButtonEffect(btn);
|
||||
//btn.setDisable(true);
|
||||
btn.setText("Utiliser Effet");
|
||||
estRevele = true;
|
||||
this.joueur.setRevele(true);;
|
||||
actionReveler(btn);
|
||||
});
|
||||
}
|
||||
|
||||
public void reveler() {
|
||||
Button btn = getRevealButton();
|
||||
actionReveler(btn);
|
||||
}
|
||||
|
||||
private void actionReveler(Button btn) {
|
||||
ImageView iv = this.getCartePersonnage();
|
||||
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());
|
||||
initButtonEffect(btn);
|
||||
btn.setText("Utiliser Effet");
|
||||
estRevele = true;
|
||||
}
|
||||
|
||||
public Button getRevealButton() {
|
||||
Pane p = (Pane) zoneJoueur.getChildren().get(2);
|
||||
@ -258,4 +265,8 @@ public class JoueurIHM {
|
||||
return this.joueur.getNom();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import carte.CarteLieu;
|
||||
import carte.CartePiochable;
|
||||
import carte.CartePiochable.Type;
|
||||
import database.RessourceLoader;
|
||||
import effet.action.Action;
|
||||
import ihm.EffetSonore;
|
||||
import ihm.PopUp;
|
||||
import javafx.animation.KeyFrame;
|
||||
@ -28,6 +29,7 @@ import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.image.Image;
|
||||
@ -69,6 +71,7 @@ public class PlateauController implements Initializable {
|
||||
public static int DICE_BOTH = 2;
|
||||
|
||||
private final double RES = 200./2250.;
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* initialise les données du plateau
|
||||
@ -77,6 +80,7 @@ public class PlateauController implements Initializable {
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
//System.out.println("Création du plateau ...");
|
||||
|
||||
this.resourceBundle = arg1;
|
||||
this.joueursIHM = new ArrayList<JoueurIHM>();
|
||||
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
||||
RessourceLoader rl = gj.getRessourceLoader();
|
||||
@ -130,8 +134,7 @@ public class PlateauController implements Initializable {
|
||||
}
|
||||
|
||||
private void applyImageLieu(ImageView iv, Image im) {
|
||||
|
||||
StackPane sp = (StackPane) iv.getParent();
|
||||
|
||||
iv.setImage(im);
|
||||
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
iv.setFitWidth(RES*screenSize.width);
|
||||
@ -558,4 +561,49 @@ public void afficherEffet(Joueur j) throws IOException {
|
||||
public void setMapRessourcesDosCartes(Map<String,BufferedImage> mapRessourcesDosCartes) {
|
||||
this.mapRessourcesDosCartes = mapRessourcesDosCartes;
|
||||
}
|
||||
|
||||
|
||||
private Action choixAction;
|
||||
|
||||
public void afficherChoisirAction(Joueur joueur, List<Action> list) {
|
||||
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/ChoisirAction.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
|
||||
List<Button> buttons = new ArrayList<Button>();
|
||||
|
||||
for(Action a : list) {
|
||||
Button button = interpret(a);
|
||||
buttons.add(button);
|
||||
button.setOnAction(x -> {
|
||||
this.choixAction = a;
|
||||
GestionnaireJeu.notifyPlateau();
|
||||
});
|
||||
}
|
||||
|
||||
VBox v = new VBox();
|
||||
v.getChildren().addAll(buttons);
|
||||
|
||||
JoueurIHM jihm = getJoueurIHM(joueur);
|
||||
jihm.setZoneJoueur(v);
|
||||
}
|
||||
|
||||
public Action getChoixAction(Joueur joueur) {
|
||||
return this.choixAction;
|
||||
}
|
||||
|
||||
|
||||
private Button interpret(Action a) {
|
||||
String s = a.toString();
|
||||
Button b = new Button(s);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
public void revealJoueur(Joueur joueur) {
|
||||
JoueurIHM jihm = getJoueurIHM(joueur);
|
||||
jihm.reveler();
|
||||
}
|
||||
|
||||
}
|
11
src/ihm/ressources/ChoisirAction.fxml
Normal file
11
src/ihm/ressources/ChoisirAction.fxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.ressources.ChoisirAction">
|
||||
<children>
|
||||
<VBox alignment="CENTER" layoutX="-126.0" layoutY="92.0" prefHeight="200.0" prefWidth="226.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
Reference in New Issue
Block a user