travail sur le plateau
This commit is contained in:
parent
df54f21dfd
commit
84b8617e31
@ -58,5 +58,9 @@ public class ChoisirEquipement implements Initializable{
|
||||
public void setGrilleEquipement(GridPane grilleEquipement) {
|
||||
this.grilleEquipement = grilleEquipement;
|
||||
}
|
||||
|
||||
public CarteEquipement getResult() {
|
||||
return equipementSelected;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
|
||||
import carte.Carte;
|
||||
import carte.CarteEquipement;
|
||||
import carte.CarteLieu;
|
||||
import database.RessourceLoader;
|
||||
import ihm.EffetSonore;
|
||||
@ -54,6 +55,7 @@ public class PlateauController implements Initializable {
|
||||
|
||||
|
||||
private ChoisirBoolean cb;
|
||||
private ChoisirEquipement ce;
|
||||
|
||||
|
||||
private Map<Carte,BufferedImage> mapRessourcesCartes;
|
||||
@ -342,7 +344,25 @@ public class PlateauController implements Initializable {
|
||||
JoueurIHM jihm = getJoueurIHM(j);
|
||||
jihm.setZoneJoueur(root);
|
||||
}
|
||||
|
||||
public void afficherChoisirEquipementVole(Joueur j) throws IOException {
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Jouer_tour(2a)voler_equipement.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
Pane root = (Pane)fxmlLoader.load();
|
||||
this.ce = fxmlLoader.getController();
|
||||
JoueurIHM jihm = getJoueurIHM(j);
|
||||
jihm.setZoneJoueur(root);
|
||||
}
|
||||
|
||||
public CarteEquipement getChoixEquipementVole(Joueur joueur) {
|
||||
JoueurIHM jihm = getJoueurIHM(joueur);
|
||||
CarteEquipement result = this.ce.getResult();
|
||||
this.ce = null;
|
||||
jihm.getZoneJoueur().getChildren().setAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean getChoix(Joueur joueur) {
|
||||
JoueurIHM jihm = getJoueurIHM(joueur);
|
||||
boolean result = this.cb.getResult();
|
||||
|
@ -4,48 +4,21 @@
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="180.0" prefWidth="255.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ChoisirEquipement">
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="210.0" prefWidth="260.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.ChoisirEquipement">
|
||||
<children>
|
||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="180.0" prefWidth="255.0" stylesheets="@style/popUp.css">
|
||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" stylesheets="@style/popUp.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label layoutX="58.0" layoutY="14.0" text="%voler.equipement.joueur" />
|
||||
<ScrollPane layoutX="28.0" layoutY="38.0" prefHeight="128.0" prefWidth="200.0">
|
||||
<ScrollPane layoutX="28.0" layoutY="38.0">
|
||||
<content>
|
||||
<GridPane fx:id="grilleEquipement">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<HBox>
|
||||
<children>
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="1" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3" GridPane.rowIndex="1" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="2" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||
<ImageView fitHeight="60.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3" GridPane.rowIndex="2" />
|
||||
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
|
||||
</children>
|
||||
</GridPane>
|
||||
</HBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
|
@ -69,7 +69,7 @@
|
||||
<Slider fx:id="sliderEffetsPause" blockIncrement="1.0" majorTickUnit="1.0" max="0.0" min="-20.0" minorTickCount="10" onMouseClicked="#slideVolumeEffets" prefHeight="14.0" prefWidth="194.0" />
|
||||
</children>
|
||||
</HBox>
|
||||
<Button fx:id="règlesPause" mnemonicParsing="false" onMouseClicked="#afficherReglePause" text="Règles">
|
||||
<Button fx:id="reglesPause" mnemonicParsing="false" onMouseClicked="#afficherReglePause" text="Règles">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
|
@ -8,6 +8,7 @@ import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import carte.CarteEquipement;
|
||||
import carte.CarteLieu;
|
||||
import database.RessourceLoader;
|
||||
import effet.Effet;
|
||||
@ -100,6 +101,36 @@ public class GestionnaireJeu {
|
||||
return false;
|
||||
}
|
||||
|
||||
public CarteEquipement choisirEquipementVole(Joueur joueur) {
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
pc.afficherChoisirEquipementVole(joueur);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
this.waitPlateau();
|
||||
|
||||
final FutureTask<CarteEquipement> query = new FutureTask<CarteEquipement>(new Callable<CarteEquipement>() {
|
||||
@Override
|
||||
public CarteEquipement call() throws Exception {
|
||||
return pc.getChoixEquipementVole(joueur);
|
||||
}
|
||||
});
|
||||
|
||||
Platform.runLater(query);
|
||||
|
||||
try {
|
||||
return query.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void waitPlateau() {
|
||||
|
||||
synchronized(plateau) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user