Fix bug tours, choix fonctionnels

This commit is contained in:
Paul Gross 2020-05-03 17:08:45 +02:00
parent 03499c7191
commit afaef5411b
7 changed files with 40 additions and 26 deletions

View File

@ -6,8 +6,6 @@ import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import main.GestionnaireJeu;
public class ChoisirBoolean implements Initializable {

View File

@ -69,10 +69,15 @@ public class JoueurIHM {
public void setZoneJoueur(Pane p) {
AnchorPane ap = (AnchorPane) zoneJoueur.getChildren().get(1);
ap.getChildren().setAll(p);
AnchorPane.getBottomAnchor(p);
AnchorPane.getLeftAnchor(p);
AnchorPane.getRightAnchor(p);
AnchorPane.getTopAnchor(p);
//ap.prefWidthProperty().bind(ap.widthProperty());
//ap.prefHeightProperty().bind(ap.heightProperty());
AnchorPane.setBottomAnchor(p,0.0);
AnchorPane.setLeftAnchor(p,0.0);
AnchorPane.setRightAnchor(p,0.0);
AnchorPane.setTopAnchor(p,0.0);
}

View File

@ -36,6 +36,7 @@ public class PlateauController implements Initializable {
@FXML private GridPane gridPaneVie;
//@FXML static public GridPane gridPaneLieux;
private ChoisirBoolean cb;
public static int DICE_SIX = 2;
public static int DICE_QUATRE = 1;
@ -268,14 +269,16 @@ public class PlateauController implements Initializable {
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = (Pane)fxmlLoader.load();
this.cb = fxmlLoader.getController();
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(root);
}
public boolean getChoix(Joueur joueur) {
JoueurIHM jihm = getJoueurIHM(joueur);
boolean result = this.cb.getResult();
this.cb = null;
jihm.getZoneJoueur().getChildren().setAll();
return true;
return result;
}
}

View File

@ -24,7 +24,7 @@
<children>
<Group>
<children>
<GridPane hgap="50.0" prefHeight="161.0" prefWidth="885.0" rotate="90.0">
<GridPane hgap="50.0" prefWidth="885.0" rotate="90.0">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" />
<ColumnConstraints hgrow="ALWAYS" />
@ -110,6 +110,9 @@
</children>
</GridPane>
</children>
<padding>
<Insets top="25.0" />
</padding>
</GridPane>
</children>
<HBox.margin>
@ -204,6 +207,9 @@
</children>
</GridPane>
</children>
<padding>
<Insets bottom="25.0" />
</padding>
</GridPane>
<HBox alignment="CENTER" maxHeight="600.0" maxWidth="1200.0" spacing="50.0" VBox.vgrow="ALWAYS">
<children>
@ -665,12 +671,15 @@
</children>
</GridPane>
</children>
<padding>
<Insets bottom="25.0" />
</padding>
</GridPane>
</children>
</VBox>
<Group>
<children>
<GridPane hgap="50.0" rotate="-90.0">
<GridPane hgap="50.0" prefWidth="885.0" rotate="-90.0">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" />
<ColumnConstraints hgrow="ALWAYS" />
@ -747,7 +756,7 @@
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/plateau.css" text="%se.reveler" GridPane.rowIndex="1" />
</children>
</GridPane>
<FlowPane prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<FlowPane prefHeight="144.0" prefWidth="144.0" styleClass="tour" GridPane.columnIndex="2" GridPane.rowIndex="1">
<children>
<ImageView pickOnBounds="true" preserveRatio="true" />
</children>
@ -756,6 +765,9 @@
</children>
</GridPane>
</children>
<padding>
<Insets bottom="25.0" />
</padding>
</GridPane>
</children>
</Group>

View File

@ -5,19 +5,14 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="root" minHeight="0.0" minWidth="0.0" prefHeight="334.0" prefWidth="449.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ChoisirBoolean">
<AnchorPane fx:id="root" minHeight="0.0" minWidth="0.0" prefHeight="129.0" prefWidth="201.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ChoisirBoolean">
<children>
<Label layoutX="8.0" layoutY="32.0" text="Voulez vous faire cette action ?" AnchorPane.bottomAnchor="215.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="32.0">
<Label layoutX="8.0" layoutY="-11.0" prefHeight="26.0" prefWidth="128.0" text="Voulez vous faire cette action ?" AnchorPane.bottomAnchor="77.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="-11.0">
<font>
<Font size="36.0" />
<Font size="13.0" />
</font>
</Label>
<Button fx:id="ouiButton" layoutX="68.0" layoutY="147.0" mnemonicParsing="false" text="Oui" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="68.0" AnchorPane.rightAnchor="268.0" AnchorPane.topAnchor="147.0" />
<Label layoutX="377.0" layoutY="245.0" AnchorPane.bottomAnchor="187.0" AnchorPane.leftAnchor="181.0" AnchorPane.rightAnchor="312.0" AnchorPane.topAnchor="60.0">
<font>
<Font size="36.0" />
</font>
</Label>
<Button fx:id="nonButton" layoutX="286.0" layoutY="147.0" mnemonicParsing="false" text="Non" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="286.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="147.0" />
<Button fx:id="ouiButton" layoutX="34.0" layoutY="85.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="45.0" text="Oui" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="34.0" AnchorPane.rightAnchor="122.0" AnchorPane.topAnchor="85.0" />
<Button fx:id="nonButton" layoutX="126.0" layoutY="85.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="45.0" text="Non" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="126.0" AnchorPane.rightAnchor="30.0" AnchorPane.topAnchor="85.0" />
</children>
</AnchorPane>

View File

@ -191,12 +191,13 @@ public class Plateau extends Thread{
public void run() {
int nbJoueurs = this.joueurs.size()-1;
int i = 1;
int nbJoueurs = this.joueurs.size();
int i = 0;
System.out.println(nbJoueurs);
while(true) {
Joueur currentJoueur = this.joueurs.get(nbJoueurs % i);
Joueur currentJoueur = this.joueurs.get(i % nbJoueurs);
System.out.println("\n\n\n\n\n");
System.out.println("Au tour de "+currentJoueur.getNom());
System.out.println("Lancement des dés.");