Prise en compte des zones joueurs
This commit is contained in:
@@ -1,43 +1,42 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ihm.PopUpBoolean;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
import main.GestionnaireJeu;
|
||||
|
||||
public class ChoisirBoolean implements Initializable {
|
||||
|
||||
public class ChoisirBoolean implements Initializable{
|
||||
@FXML private Pane rootPane;
|
||||
|
||||
@FXML private Button ouiButton;
|
||||
@FXML private Button nonButton;
|
||||
|
||||
|
||||
private boolean result;
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void choixOui(MouseEvent mouseEvent) throws IOException{
|
||||
PopUpBoolean.result = true;
|
||||
final Node source = (Node) mouseEvent.getSource();
|
||||
final Stage stage = (Stage) source.getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void choixNon(MouseEvent mouseEvent) throws IOException{
|
||||
|
||||
PopUpBoolean.result = false;
|
||||
final Node source = (Node) mouseEvent.getSource();
|
||||
final Stage stage = (Stage) source.getScene().getWindow();
|
||||
stage.close();
|
||||
ouiButton.setOnAction(x -> {
|
||||
|
||||
this.result = true;
|
||||
GestionnaireJeu.notifyPlateau();
|
||||
|
||||
});
|
||||
|
||||
nonButton.setOnAction(x -> {
|
||||
|
||||
this.result = false;
|
||||
GestionnaireJeu.notifyPlateau();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public boolean getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -18,19 +18,19 @@ public class JoueurIHM {
|
||||
|
||||
private int position;
|
||||
private Joueur joueur;
|
||||
private Pane pane;
|
||||
private Pane zoneJoueur;
|
||||
private GestionnaireDePions gestionnaireDePions;
|
||||
private Color color;
|
||||
|
||||
public JoueurIHM(int i, Joueur joueur, Pane pane, Color color, GridPane gridPaneVie) {
|
||||
public JoueurIHM(int i, Joueur joueur, Pane zoneJoueur, Color color, GridPane gridPaneVie) {
|
||||
|
||||
this.setPosition(i);
|
||||
this.setJoueur(joueur);
|
||||
this.pane = pane;
|
||||
this.zoneJoueur = zoneJoueur;
|
||||
this.color = color;
|
||||
this.gestionnaireDePions = new GestionnaireDePions(this.color,gridPaneVie);
|
||||
|
||||
pane.setBorder(new Border(new BorderStroke(color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(5))));
|
||||
zoneJoueur.setBorder(new Border(new BorderStroke(color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(5))));
|
||||
|
||||
String name = joueur.getNom();
|
||||
setLabelJoueur(name);
|
||||
@@ -53,21 +53,32 @@ public class JoueurIHM {
|
||||
}
|
||||
|
||||
public Button getRevealButton() {
|
||||
Pane p = (Pane) pane.getChildren().get(1);
|
||||
Pane p = (Pane) zoneJoueur.getChildren().get(1);
|
||||
return (Button) p.getChildren().get(1);
|
||||
}
|
||||
|
||||
public ImageView getCartePersonnage() {
|
||||
Pane p = (Pane) pane.getChildren().get(1);
|
||||
Pane p = (Pane) zoneJoueur.getChildren().get(1);
|
||||
return (ImageView) p.getChildren().get(0);
|
||||
}
|
||||
|
||||
public AnchorPane getZoneJoueur() {
|
||||
return (AnchorPane) pane.getChildren().get(0);
|
||||
return (AnchorPane) zoneJoueur.getChildren().get(0);
|
||||
}
|
||||
|
||||
public void setZoneJoueur(Pane p) {
|
||||
AnchorPane ap = (AnchorPane) zoneJoueur.getChildren().get(0);
|
||||
ap.getChildren().setAll(p);
|
||||
AnchorPane.getBottomAnchor(p);
|
||||
AnchorPane.getLeftAnchor(p);
|
||||
AnchorPane.getRightAnchor(p);
|
||||
AnchorPane.getTopAnchor(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Label getLabelJoueur() {
|
||||
Pane p = (Pane) pane.getChildren().get(2);
|
||||
Pane p = (Pane) zoneJoueur.getChildren().get(2);
|
||||
return (Label) p.getChildren().get(0);
|
||||
}
|
||||
|
||||
@@ -77,7 +88,7 @@ public class JoueurIHM {
|
||||
}
|
||||
|
||||
public Label getPaneEquipement() {
|
||||
Pane p = (Pane) pane.getChildren().get(2);
|
||||
Pane p = (Pane) zoneJoueur.getChildren().get(2);
|
||||
return (Label) p.getChildren().get(1);
|
||||
}
|
||||
|
||||
@@ -101,4 +112,9 @@ public class JoueurIHM {
|
||||
this.gestionnaireDePions.deplacerPionVie(damage);
|
||||
}
|
||||
|
||||
public void choisir() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,10 +11,10 @@ import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
|
||||
import ihm.PopUp;
|
||||
import ihm.PopUpBoolean;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
@@ -209,15 +209,18 @@ public class PlateauController implements Initializable {
|
||||
popup.display();
|
||||
}
|
||||
|
||||
public boolean choisir(Joueur j) throws IOException {
|
||||
|
||||
|
||||
public JoueurIHM getJoueurIHM(Joueur j) {
|
||||
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/choisirBoolean.fxml"));
|
||||
Parent root = loader.load();
|
||||
|
||||
PopUpBoolean popup = new PopUpBoolean(root, "Consulter sa carte");
|
||||
return popup.display();
|
||||
for(JoueurIHM joueurIHM : joueursIHM) {
|
||||
if(joueurIHM.getJoueur().equals(j)) return joueurIHM;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Permet de consulter sa carte perssonage en cas d'oublie
|
||||
*
|
||||
@@ -260,4 +263,19 @@ public class PlateauController implements Initializable {
|
||||
|
||||
}
|
||||
|
||||
public void afficherChoisir(Joueur j) throws IOException {
|
||||
final URL fxmlURL = getClass().getResource("../ressources/choisirBoolean.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
Pane root = (Pane)fxmlLoader.load();
|
||||
JoueurIHM jihm = getJoueurIHM(j);
|
||||
jihm.setZoneJoueur(root);
|
||||
|
||||
}
|
||||
|
||||
public boolean getChoix(Joueur joueur) {
|
||||
JoueurIHM jihm = getJoueurIHM(joueur);
|
||||
jihm.getZoneJoueur().getChildren().setAll();
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -138,7 +138,7 @@ public class PlayersController implements Initializable{
|
||||
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
|
||||
appStage.setScene(scene);
|
||||
appStage.show();
|
||||
//GestionnaireJeu.lancerPartie();
|
||||
gj.lancerPartie();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user