parent
383cfb5963
commit
e0a82abdb6
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="18" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="18" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
@ -1,14 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
|
||||
<BorderPane fx:id="myBorderPane" style="-fx-background-color: #ecf0f1;" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.Fenetre">
|
||||
<center>
|
||||
<VBox fx:id="buttonContainer" BorderPane.alignment="CENTER">
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<BorderPane fx:id="myBorderPane" style="-fx-background-color: #ecf0f1;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.Fenetre">
|
||||
<bottom>
|
||||
<Button fx:id="rollDice" alignment="CENTER" mnemonicParsing="false" onAction="#onButtonRollClicked" style="-fx-background-color: #2ecc71;" text="RollDice" />
|
||||
</bottom>
|
||||
<right>
|
||||
<VBox fx:id="labelContainer" BorderPane.alignment="CENTER">
|
||||
<!-- Les boutons seront ajoutés ici dynamiquement -->
|
||||
<Button fx:id="rollDice" mnemonicParsing="false" onAction="#onButtonRollClicked" style="-fx-background-color: #2ecc71;" text="RollDice" alignment="CENTER" />
|
||||
</VBox>
|
||||
</center>
|
||||
</right>
|
||||
<left>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<center>
|
||||
<ListView fx:id="joueursContainer" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
<bottom>
|
||||
<TextField fx:id="joueur"></TextField>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
</left>
|
||||
</BorderPane>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,14 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
|
||||
<BorderPane fx:id="myBorderPane" style="-fx-background-color: #ecf0f1;" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.Fenetre">
|
||||
<center>
|
||||
<VBox fx:id="buttonContainer" BorderPane.alignment="CENTER">
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<BorderPane fx:id="myBorderPane" style="-fx-background-color: #ecf0f1;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.Fenetre">
|
||||
<bottom>
|
||||
<Button fx:id="rollDice" alignment="CENTER" mnemonicParsing="false" onAction="#onButtonRollClicked" style="-fx-background-color: #2ecc71;" text="RollDice" />
|
||||
</bottom>
|
||||
<right>
|
||||
<VBox fx:id="labelContainer" BorderPane.alignment="CENTER">
|
||||
<!-- Les boutons seront ajoutés ici dynamiquement -->
|
||||
<Button fx:id="rollDice" mnemonicParsing="false" onAction="#onButtonRollClicked" style="-fx-background-color: #2ecc71;" text="RollDice" alignment="CENTER" />
|
||||
</VBox>
|
||||
</center>
|
||||
</right>
|
||||
<left>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<center>
|
||||
<ListView fx:id="joueursContainer" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
<bottom>
|
||||
<TextField fx:id="joueur"></TextField>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
</left>
|
||||
</BorderPane>
|
||||
|
@ -1,27 +1,55 @@
|
||||
package managers;
|
||||
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import models.Joueur;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GestionnaireJoueur {
|
||||
private int currentIdJoueur = 0;
|
||||
private List<Joueur> lesJoueurs = new ArrayList<>();
|
||||
private ObservableList<Joueur> myList = FXCollections.observableArrayList();
|
||||
private ListProperty<Joueur> lesJoueurs = new SimpleListProperty(myList);
|
||||
public ObservableList<Joueur> getLesJoueurs() {
|
||||
return lesJoueurs.get();
|
||||
}
|
||||
public ListProperty<Joueur> lesJoueursProperty() {
|
||||
return lesJoueurs;
|
||||
}
|
||||
private ObjectProperty<Joueur> currentJoueur = new SimpleObjectProperty();
|
||||
public Joueur getCurrentJoueur() {
|
||||
return currentJoueur.get();
|
||||
}
|
||||
public ObjectProperty<Joueur> currentJoueurProperty() {
|
||||
return currentJoueur;
|
||||
}
|
||||
public void setCurrentJoueur(Joueur joueur) {
|
||||
currentJoueur.set(joueur);
|
||||
}
|
||||
// private List<Joueur> lesJoueurs = new ArrayList<>();
|
||||
// private StringProperty name = new SimpleStringProperty();
|
||||
// public String getName() { return name.get(); }
|
||||
// public StringProperty nameProperty() { return name; }
|
||||
// private void setName(String name) { this.name.set(name); }
|
||||
|
||||
public List<Joueur> getLesJoueurs() {
|
||||
return this.lesJoueurs;
|
||||
}
|
||||
public Joueur getCurrentJoueur() {
|
||||
return this.lesJoueurs.get(currentIdJoueur%lesJoueurs.size());
|
||||
}
|
||||
// public List<Joueur> getLesJoueurs() {
|
||||
// return this.lesJoueurs;
|
||||
// }
|
||||
// public Joueur getCurrentJoueur() {
|
||||
// return currentJoueur;
|
||||
// }
|
||||
public Joueur getJoueurSuivant() {
|
||||
return this.lesJoueurs.get((currentIdJoueur+1) % lesJoueurs.size());
|
||||
return this.myList.get((currentJoueur.get().getIdJoueur() + 1) % lesJoueurs.size());
|
||||
}
|
||||
public void ajouterJoueur(Joueur joueur) {
|
||||
lesJoueurs.add(joueur);
|
||||
myList.add(joueur);
|
||||
if(myList.size() == 1) {
|
||||
currentJoueur.set(myList.get(0));
|
||||
}
|
||||
}
|
||||
public Joueur nextPlayer() {
|
||||
return lesJoueurs.get((++currentIdJoueur) % lesJoueurs.size());
|
||||
return myList.get((currentJoueur.get().getIdJoueur() + 1) % lesJoueurs.size());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue