Merge branch 'development' of https://github.com/PTE-SH/ShadowHunterGame into development
This commit is contained in:
commit
e38fe54ad7
@ -11,15 +11,16 @@ import ihm.PopUp;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import main.Joueur;
|
import main.Joueur;
|
||||||
|
|
||||||
public class PlateauController implements Initializable {
|
public class PlateauController implements Initializable {
|
||||||
|
@FXML private BorderPane root;
|
||||||
|
|
||||||
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
||||||
private List<VBox> vboxJoueur = new ArrayList<VBox>();
|
private List<VBox> vboxJoueur = new ArrayList<VBox>();
|
||||||
@ -27,6 +28,7 @@ public class PlateauController implements Initializable {
|
|||||||
private List<Button> btnCartePerso = new ArrayList<Button>();
|
private List<Button> btnCartePerso = new ArrayList<Button>();
|
||||||
private List<Label> nomPerso = new ArrayList<Label>();
|
private List<Label> nomPerso = new ArrayList<Label>();
|
||||||
private List<Label> factionPerso = new ArrayList<Label>();
|
private List<Label> factionPerso = new ArrayList<Label>();
|
||||||
|
private List<Label> nomJoueur = new ArrayList<Label>();
|
||||||
|
|
||||||
@FXML private VBox joueur1;
|
@FXML private VBox joueur1;
|
||||||
@FXML private VBox joueur2;
|
@FXML private VBox joueur2;
|
||||||
@ -37,7 +39,6 @@ public class PlateauController implements Initializable {
|
|||||||
@FXML private VBox joueur7;
|
@FXML private VBox joueur7;
|
||||||
@FXML private VBox joueur8;
|
@FXML private VBox joueur8;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialise les données du plateau
|
* initialise les données du plateau
|
||||||
*/
|
*/
|
||||||
@ -58,6 +59,7 @@ public class PlateauController implements Initializable {
|
|||||||
for (VBox vbox : vboxJoueur) {
|
for (VBox vbox : vboxJoueur) {
|
||||||
nomPerso.add((Label) vbox.getChildren().get(1));
|
nomPerso.add((Label) vbox.getChildren().get(1));
|
||||||
factionPerso.add((Label) vbox.getChildren().get(0));
|
factionPerso.add((Label) vbox.getChildren().get(0));
|
||||||
|
nomJoueur.add((Label) vbox.getChildren().get(2));
|
||||||
HBox enfant = (HBox) vbox.getChildren().get(3);
|
HBox enfant = (HBox) vbox.getChildren().get(3);
|
||||||
btnCartePerso.add((Button) enfant.getChildren().get(0));
|
btnCartePerso.add((Button) enfant.getChildren().get(0));
|
||||||
btnRevelation.add((Button) enfant.getChildren().get(1));
|
btnRevelation.add((Button) enfant.getChildren().get(1));
|
||||||
@ -106,6 +108,13 @@ public class PlateauController implements Initializable {
|
|||||||
popup.display();
|
popup.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showInformation(List<Joueur> j) {
|
||||||
|
System.out.println("Ecriture des noms des joueurs");
|
||||||
|
for (int i=0; i<j.size(); i++) {
|
||||||
|
nomJoueur.get(i).setText(j.get(i).getNom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void attribuerPerso(List<Joueur> lj) {
|
public void attribuerPerso(List<Joueur> lj) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,83 +1,138 @@
|
|||||||
package ihm.controller;
|
package ihm.controller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
|
import javafx.scene.control.Alert.AlertType;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.TextInputControl;
|
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.stage.Stage;
|
||||||
import javafx.scene.layout.VBox;
|
import main.Joueur;
|
||||||
|
import main.JoueurVirtuel;
|
||||||
|
|
||||||
public class PlayersController implements Initializable{
|
public class PlayersController implements Initializable{
|
||||||
|
|
||||||
@FXML private BorderPane rootPane;
|
@FXML private BorderPane rootPane;
|
||||||
@FXML private TextField tf;
|
|
||||||
@FXML private VBox vb1;
|
@FXML private HBox hb1;
|
||||||
@FXML private VBox vb2;
|
@FXML private HBox hb2;
|
||||||
private HBox hb10;
|
@FXML private HBox hb3;
|
||||||
private HBox hb11;
|
@FXML private HBox hb4;
|
||||||
private HBox hb12;
|
@FXML private HBox hb5;
|
||||||
private HBox hb13;
|
@FXML private HBox hb6;
|
||||||
private TextField tf0;
|
@FXML private HBox hb7;
|
||||||
private Button btn;
|
@FXML private HBox hb8;
|
||||||
|
|
||||||
|
private List<HBox> ligne = new ArrayList<HBox>();
|
||||||
|
private List<Button> plus = new ArrayList<Button>();
|
||||||
|
private List<TextField> txt = new ArrayList<TextField>();
|
||||||
|
private List<CheckBox> ia = new ArrayList<CheckBox>();
|
||||||
|
|
||||||
|
private List<Joueur> joueur = new ArrayList<Joueur>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* recupère chaque bouton textField et Checkebox a partir des hbox
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
for(int i=0;i<4;i++) {
|
ligne.add(hb1);
|
||||||
hb10=(HBox) vb1.getChildren().get(i);
|
ligne.add(hb2);
|
||||||
tf0=(TextField) hb10.getChildren().get(0);
|
ligne.add(hb3);
|
||||||
|
ligne.add(hb4);
|
||||||
tf0.setEditable(false);
|
ligne.add(hb5);
|
||||||
|
ligne.add(hb6);
|
||||||
}
|
ligne.add(hb7);
|
||||||
for(int i=0;i<4;i++) {
|
ligne.add(hb8);
|
||||||
hb10=(HBox) vb1.getChildren().get(i);
|
for (HBox hb : ligne) {
|
||||||
tf0=(TextField) hb10.getChildren().get(0);
|
txt.add((TextField) hb.getChildren().get(0));
|
||||||
btn=(Button) hb10.getChildren().get(1);
|
plus.add((Button) hb.getChildren().get(1));
|
||||||
btn.setOnAction((e) -> {
|
ia.add((CheckBox) hb.getChildren().get(2));
|
||||||
tf0.setEditable(true);});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
for (Button btn : plus) {
|
||||||
|
int compteur = i;
|
||||||
|
btn.setOnAction(e -> {ajoutJoueur(compteur);});
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TextField tf : txt) {
|
||||||
|
tf.setEditable(false);
|
||||||
|
tf.setStyle("-fx-background-color: silver;");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//liaison.put( (Button)vb11.getChildren().get(i), maListe);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Partie2 pas prendre en compte pour le moment
|
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
||||||
System.out.println("Lancement du jeu...");
|
//ajout des joueurs finalement selectionner
|
||||||
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Plateau.fxml"));
|
for (HBox hb : ligne) {
|
||||||
rootPane.getChildren().setAll(pane);
|
TextField tf = (TextField) hb.getChildren().get(0);
|
||||||
}
|
CheckBox cb = (CheckBox) hb.getChildren().get(2);
|
||||||
@FXML
|
Joueur j;
|
||||||
public void ajoutJoueur(MouseEvent mouseEvent) throws IOException{
|
if (tf.isEditable()) {
|
||||||
tf.setEditable(true);
|
if(cb.isSelected())
|
||||||
|
j = new JoueurVirtuel(tf.getText());
|
||||||
|
else
|
||||||
|
j = new Joueur(tf.getText());
|
||||||
|
|
||||||
|
joueur.add(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (joueur.size() <4) {
|
||||||
|
Alert alert = new Alert(AlertType.WARNING, "Vous avez moins de 4 joueurs !");
|
||||||
|
alert.showAndWait();
|
||||||
|
}else {
|
||||||
|
System.out.println("Lancement du jeu...");
|
||||||
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/Plateau.fxml"));
|
||||||
|
Parent root = loader.load();
|
||||||
|
|
||||||
|
PlateauController pc = loader.getController();
|
||||||
|
pc.showInformation(joueur);
|
||||||
|
|
||||||
|
rootPane.getChildren().setAll(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Autorise a écrire dans le text filed le nom du joueur ajouter
|
||||||
|
*
|
||||||
|
* @param indice : pour savoir quel bouton a été cliqué
|
||||||
|
*/
|
||||||
|
public void ajoutJoueur(int indice){
|
||||||
|
System.out.println("Ajout du joueur " + (indice+1));
|
||||||
|
plus.get(indice).setText("- ");
|
||||||
|
txt.get(indice).setEditable(true);
|
||||||
|
txt.get(indice).setStyle("-fx-background-color: white;");
|
||||||
|
plus.get(indice).setOnAction(e -> {enleverJoueur(indice);});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retire le joueur précedemnt ajouter
|
||||||
|
*
|
||||||
|
* @param indice : pour savoir quel bouton a été cliqué
|
||||||
|
*/
|
||||||
|
public void enleverJoueur(int indice) {
|
||||||
|
System.out.println("Desistement du joueur " + (indice+1));
|
||||||
|
plus.get(indice).setText("+");
|
||||||
|
txt.get(indice).setEditable(false);
|
||||||
|
txt.get(indice).setText("");
|
||||||
|
txt.get(indice).setStyle("-fx-background-color: silver;");
|
||||||
|
plus.get(indice).setOnAction(e -> {ajoutJoueur(indice);});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,31 +41,9 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</top>
|
</top>
|
||||||
<left>
|
<left>
|
||||||
<VBox fx:id="vb1" alignment="CENTER" prefHeight="559.0" prefWidth="642.0" BorderPane.alignment="CENTER">
|
<VBox alignment="CENTER" prefHeight="559.0" prefWidth="642.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb1" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
|
||||||
<TextField fx:id="tf">
|
|
||||||
<font>
|
|
||||||
<Font size="24.0" />
|
|
||||||
</font>
|
|
||||||
</TextField>
|
|
||||||
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
|
|
||||||
<font>
|
|
||||||
<Font size="24.0" />
|
|
||||||
</font>
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets left="10.0" right="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
<CheckBox mnemonicParsing="false">
|
|
||||||
<font>
|
|
||||||
<Font size="24.0" />
|
|
||||||
</font>
|
|
||||||
</CheckBox>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
@ -87,7 +65,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb2" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
@ -109,7 +87,29 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb3" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<TextField>
|
||||||
|
<font>
|
||||||
|
<Font size="24.0" />
|
||||||
|
</font>
|
||||||
|
</TextField>
|
||||||
|
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
|
||||||
|
<font>
|
||||||
|
<Font size="24.0" />
|
||||||
|
</font>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="10.0" right="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<CheckBox mnemonicParsing="false">
|
||||||
|
<font>
|
||||||
|
<Font size="24.0" />
|
||||||
|
</font>
|
||||||
|
</CheckBox>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<HBox fx:id="hb4" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
@ -135,9 +135,9 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</left>
|
</left>
|
||||||
<right>
|
<right>
|
||||||
<VBox fx:id="vb2" alignment="CENTER" prefHeight="559.0" prefWidth="694.0" BorderPane.alignment="CENTER">
|
<VBox alignment="CENTER" prefHeight="559.0" prefWidth="694.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb5" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
@ -159,7 +159,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb6" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
@ -181,7 +181,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb7" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
@ -203,7 +203,7 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox fx:id="hb8" alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField>
|
<TextField>
|
||||||
<font>
|
<font>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.shape.Circle?>
|
<?import javafx.scene.shape.Circle?>
|
||||||
|
|
||||||
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlateauController">
|
<BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlateauController">
|
||||||
<top>
|
<top>
|
||||||
<HBox alignment="CENTER" prefHeight="149.0" prefWidth="1280.0" BorderPane.alignment="CENTER">
|
<HBox alignment="CENTER" prefHeight="149.0" prefWidth="1280.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
|
@ -194,6 +194,10 @@ public class Joueur {
|
|||||||
return this.carteLieu;
|
return this.carteLieu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNom() {
|
||||||
|
return this.nom;
|
||||||
|
}
|
||||||
|
|
||||||
public void reveal() {
|
public void reveal() {
|
||||||
this.revele = true;
|
this.revele = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user