push
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Pane;
|
||||
import main.Joueur;
|
||||
|
||||
public class AfficherCarteController implements Initializable{
|
||||
|
||||
@@ -16,13 +15,13 @@ public class AfficherCarteController implements Initializable{
|
||||
@FXML private Label competence;
|
||||
@FXML private Pane root;
|
||||
|
||||
private PlateauController plateau;
|
||||
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
System.out.println(root.getUserData());
|
||||
//nom.setText((String) root.getUserData());
|
||||
competence.setText("dfghjk");
|
||||
}
|
||||
|
||||
|
||||
public void showInformation(Joueur j) {
|
||||
//nom.setText(j.getCartePersonnage().getNom());
|
||||
//competence.setText(j.getCartePersonnage().getDescription());
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -20,8 +22,14 @@ public class MenuController implements Initializable{
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
//Image image = new Image("../ressources/img/logo.png");
|
||||
//titre.setImage(image);
|
||||
FileInputStream input;
|
||||
try {
|
||||
input = new FileInputStream("src\\ihm\\ressources\\img\\logo.png");
|
||||
Image image = new Image(input);
|
||||
titre.setImage(image);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
@@ -11,17 +11,14 @@ import ihm.PopUp;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import main.Joueur;
|
||||
|
||||
public class PlateauController implements Initializable {
|
||||
@FXML private BorderPane root;
|
||||
|
||||
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
||||
private List<VBox> vboxJoueur = new ArrayList<VBox>();
|
||||
private List<Button> btnRevelation = new ArrayList<Button>();
|
||||
@@ -44,9 +41,6 @@ public class PlateauController implements Initializable {
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// initialisation des joueurs
|
||||
attribuerPerso(listJoueur);
|
||||
|
||||
//initialisation des attributs des joueurs
|
||||
this.vboxJoueur.add(joueur1);
|
||||
this.vboxJoueur.add(joueur2);
|
||||
@@ -65,13 +59,20 @@ public class PlateauController implements Initializable {
|
||||
btnRevelation.add((Button) enfant.getChildren().get(1));
|
||||
}
|
||||
//initilaisation des boutons se reveler
|
||||
int i = 0;
|
||||
for (Button b : btnRevelation) {
|
||||
b.setOnAction(e -> {try {seReveler(null);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
int compteur = i;
|
||||
b.setOnAction(e -> {try {seReveler(compteur);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
i++;
|
||||
}
|
||||
//initialisation des bouton carte personnage
|
||||
int j = 0;
|
||||
for (Button b : btnCartePerso) {
|
||||
b.setOnAction(e -> {try {consulterSaCarte(null);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
int compteur = j;
|
||||
b.setOnAction(e -> {try {consulterSaCarte(compteur);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
j++;
|
||||
}
|
||||
|
||||
//initialisation nom personnage
|
||||
for (Label l : nomPerso) {
|
||||
l.setText("???");
|
||||
@@ -87,10 +88,15 @@ public class PlateauController implements Initializable {
|
||||
*
|
||||
* @param j : Le joueur sur lequel on a cliqu<71>
|
||||
*/
|
||||
public void seReveler(Joueur j) throws IOException {
|
||||
System.out.println("Le joueur ... se rev<EFBFBD>le");
|
||||
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/Reveler_son_identite.fxml"));
|
||||
PopUp popup = new PopUp(pane, "reveler son identit<69>");
|
||||
public void seReveler(int numJoueur) throws IOException {
|
||||
System.out.println(listJoueur.get(numJoueur).getNom() + " se revele");
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/Reveler_son_identite.fxml"));
|
||||
Parent root = loader.load();
|
||||
|
||||
RevelationController rc = loader.getController();
|
||||
rc.showInformation(listJoueur.get(numJoueur));
|
||||
|
||||
PopUp popup = new PopUp(root, "Consulter sa carte");
|
||||
popup.display();
|
||||
}
|
||||
|
||||
@@ -99,23 +105,28 @@ public class PlateauController implements Initializable {
|
||||
*
|
||||
* @param j : Le joueur sur lequel on a cliqu<71>
|
||||
*/
|
||||
public void consulterSaCarte(Joueur j) throws IOException {
|
||||
System.out.println("Le joueur ... consulte sa carte");
|
||||
Pane pane = FXMLLoader.load(getClass().getResource("../ressources/afficher_carte_perso.fxml"));
|
||||
pane.setUserData("blblblb");
|
||||
System.out.println(pane.getUserData());
|
||||
PopUp popup = new PopUp(pane, "Consulter sa carte");
|
||||
public void consulterSaCarte(int numJoueur) throws IOException {
|
||||
System.out.println(listJoueur.get(numJoueur).getNom() + " consulte sa carte");
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/afficher_carte_perso.fxml"));
|
||||
Parent root = loader.load();
|
||||
|
||||
AfficherCarteController acc = loader.getController();
|
||||
acc.showInformation(listJoueur.get(numJoueur));
|
||||
|
||||
PopUp popup = new PopUp(root, "Consulter sa carte");
|
||||
popup.display();
|
||||
}
|
||||
|
||||
public void showInformation(List<Joueur> j) {
|
||||
System.out.println("Ecriture des noms des joueurs");
|
||||
System.out.println("\tEcriture des noms des joueurs");
|
||||
for (int i=0; i<j.size(); i++) {
|
||||
nomJoueur.get(i).setText(j.get(i).getNom());
|
||||
if (j.get(i) != null)
|
||||
nomJoueur.get(i).setText(j.get(i).getNom());
|
||||
else {
|
||||
vboxJoueur.get(i).setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attribuerPerso(List<Joueur> lj) {
|
||||
|
||||
listJoueur = j;
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@ import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
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;
|
||||
@@ -19,7 +18,6 @@ import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.Stage;
|
||||
import main.Joueur;
|
||||
import main.JoueurVirtuel;
|
||||
|
||||
@@ -80,6 +78,7 @@ public class PlayersController implements Initializable{
|
||||
@FXML
|
||||
public void commencerJeux(MouseEvent mouseEvent) throws IOException{
|
||||
//ajout des joueurs finalement selectionner
|
||||
int nbJoueur = 0;
|
||||
for (HBox hb : ligne) {
|
||||
TextField tf = (TextField) hb.getChildren().get(0);
|
||||
CheckBox cb = (CheckBox) hb.getChildren().get(2);
|
||||
@@ -89,13 +88,13 @@ public class PlayersController implements Initializable{
|
||||
j = new JoueurVirtuel(tf.getText());
|
||||
else
|
||||
j = new Joueur(tf.getText());
|
||||
|
||||
joueur.add(j);
|
||||
}
|
||||
nbJoueur++;
|
||||
}else j = null;
|
||||
joueur.add(j);
|
||||
}
|
||||
|
||||
if (joueur.size() <4) {
|
||||
Alert alert = new Alert(AlertType.WARNING, "Vous avez moins de 4 joueurs !");
|
||||
if (nbJoueur <4) {
|
||||
Alert alert = new Alert(AlertType.WARNING, "Il faut au moins de 4 joueurs !");
|
||||
alert.showAndWait();
|
||||
}else {
|
||||
System.out.println("Lancement du jeu...");
|
||||
@@ -123,7 +122,7 @@ public class PlayersController implements Initializable{
|
||||
}
|
||||
|
||||
/**
|
||||
* Retire le joueur pr<70>cedemnt ajouter
|
||||
* Retire le joueur pr<70>cedement ajouter
|
||||
*
|
||||
* @param indice : pour savoir quel bouton a <20>t<EFBFBD> cliqu<71>
|
||||
*/
|
||||
|
27
src/ihm/controller/RevelationController.java
Normal file
27
src/ihm/controller/RevelationController.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Label;
|
||||
import main.Joueur;
|
||||
|
||||
public class RevelationController implements Initializable{
|
||||
|
||||
@FXML private Label nomJoueur;
|
||||
@FXML private Label nomPerso;
|
||||
@FXML private Label factionPerso;
|
||||
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
}
|
||||
|
||||
|
||||
public void showInformation(Joueur j) {
|
||||
nomJoueur.setText(j.getNom());
|
||||
//nomPerso.setText(j.getCartePersonnage().getNom());
|
||||
//factionPerso.setText(j.getCartePersonnage().getDescription());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user