generalisation lancer des, choisir joueur, choisir equipement
This commit is contained in:
parent
2ab9df30ed
commit
17f5d37c5e
24
src/ihm/controller/ChoisirEquipement.java
Normal file
24
src/ihm/controller/ChoisirEquipement.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package ihm.controller;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import carte.Equipement;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import main.Joueur;
|
||||||
|
|
||||||
|
public class ChoisirEquipement implements Initializable{
|
||||||
|
@FXML private GridPane equipement;
|
||||||
|
|
||||||
|
private Joueur joueurVole;
|
||||||
|
private Equipement equipementVole;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,68 +0,0 @@
|
|||||||
package ihm.controller;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import carte.CarteLieu;
|
|
||||||
import ihm.SpriteAnimation;
|
|
||||||
import javafx.animation.Animation;
|
|
||||||
import javafx.event.Event;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.fxml.Initializable;
|
|
||||||
import javafx.geometry.Rectangle2D;
|
|
||||||
import javafx.scene.Group;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.input.MouseEvent;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
import javafx.util.Duration;
|
|
||||||
import main.Joueur;
|
|
||||||
|
|
||||||
public class JouerSonTour1Controller implements Initializable{
|
|
||||||
@FXML private Pane rootPane;
|
|
||||||
@FXML private Label d6;
|
|
||||||
@FXML private Label d4;
|
|
||||||
@FXML private Button btnStop;
|
|
||||||
@FXML private Button btnLancer;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
|
||||||
btnStop.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void lancerDes(MouseEvent mouseEvent)throws InterruptedException{
|
|
||||||
System.out.println("\tLancements des dès");
|
|
||||||
|
|
||||||
btnLancer.setVisible(false);
|
|
||||||
btnStop.setVisible(true);
|
|
||||||
|
|
||||||
/*for (int i=1; i<7; i++) {
|
|
||||||
Thread.sleep(500);
|
|
||||||
d6.setText(Integer.toString(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=1; i<5; i++) {
|
|
||||||
Thread.sleep(500);
|
|
||||||
d4.setText(Integer.toString(i));
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void stop(MouseEvent mouseEvent) throws IOException, InterruptedException {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Jouer_tour(2)carte_lieux.fxml");
|
|
||||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.ENGLISH);
|
|
||||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
|
||||||
Pane root = fxmlLoader.load();
|
|
||||||
rootPane.getChildren().setAll(root);
|
|
||||||
}
|
|
||||||
}
|
|
20
src/ihm/controller/JouerSonTour4Controller.java
Normal file
20
src/ihm/controller/JouerSonTour4Controller.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package ihm.controller;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import main.Joueur;
|
||||||
|
|
||||||
|
public class JouerSonTour4Controller extends LancerDes{
|
||||||
|
@FXML private Label defenseur;
|
||||||
|
|
||||||
|
private Joueur j;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
|
super.initialize(arg0, arg1);
|
||||||
|
defenseur.setText(j.getNom());
|
||||||
|
}
|
||||||
|
}
|
49
src/ihm/controller/LancerDes.java
Normal file
49
src/ihm/controller/LancerDes.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package ihm.controller;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
|
||||||
|
public class LancerDes implements Initializable{
|
||||||
|
@FXML private Label d6;
|
||||||
|
@FXML private Label d4;
|
||||||
|
@FXML private Button btnStop;
|
||||||
|
@FXML private Button btnLancer;
|
||||||
|
|
||||||
|
private int resultatD6;
|
||||||
|
private int resultatD4;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
btnStop.setVisible(false);
|
||||||
|
|
||||||
|
btnLancer.setOnAction(e -> {
|
||||||
|
lancement();
|
||||||
|
btnLancer.setVisible(false);
|
||||||
|
btnStop.setVisible(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
btnStop.setOnAction(e -> {
|
||||||
|
//à remplir avec les valeurs donné par le gestionnaire de jeux
|
||||||
|
d6.setText(Integer.toString(resultatD6));
|
||||||
|
d4.setText(Integer.toString(resultatD4));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lancement() {
|
||||||
|
/*for (int i=1; i<7; i++) {
|
||||||
|
Thread.sleep(500);
|
||||||
|
d6.setText(Integer.toString(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=1; i<5; i++) {
|
||||||
|
Thread.sleep(500);
|
||||||
|
d4.setText(Integer.toString(i));
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
@ -8,9 +8,9 @@
|
|||||||
<?import javafx.scene.shape.Rectangle?>
|
<?import javafx.scene.shape.Rectangle?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<Pane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="180.0" prefWidth="255.0" stylesheets="@style/popUp.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.JouerSonTour1Controller">
|
<Pane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="180.0" prefWidth="255.0" stylesheets="@style/popUp.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.LancerDes">
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="btnLancer" layoutX="70.0" layoutY="140.0" mnemonicParsing="false" onMouseClicked="#lancerDes" text="%lancer.de.des">
|
<Button fx:id="btnLancer" layoutX="70.0" layoutY="140.0" mnemonicParsing="false" text="%lancer.de.des">
|
||||||
<font>
|
<font>
|
||||||
<Font size="14.0" />
|
<Font size="14.0" />
|
||||||
</font></Button>
|
</font></Button>
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<Font size="48.0" />
|
<Font size="48.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<Button fx:id="btnStop" layoutX="101.0" layoutY="140.0" mnemonicParsing="false" onMouseClicked="#stop" text="Stop">
|
<Button fx:id="btnStop" layoutX="101.0" layoutY="140.0" mnemonicParsing="false" text="Stop">
|
||||||
<font>
|
<font>
|
||||||
<Font size="14.0" />
|
<Font size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -1,16 +1,43 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
<?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="180.0" prefWidth="255.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
|
||||||
<children>
|
<children>
|
||||||
<Pane fx:id="rootPane" 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" prefHeight="180.0" prefWidth="255.0" stylesheets="@style/popUp.css">
|
||||||
<children>
|
<children>
|
||||||
<Label layoutX="58.0" layoutY="62.0" text="%voler.equipement.joueur" />
|
<Label layoutX="58.0" layoutY="14.0" text="%voler.equipement.joueur" />
|
||||||
<Label layoutX="53.0" layoutY="90.0" text="%choisir.equipement.a.voler" />
|
<ScrollPane layoutX="28.0" layoutY="40.0" prefHeight="128.0" prefWidth="200.0">
|
||||||
|
<content>
|
||||||
|
<GridPane fx:id="equipement">
|
||||||
|
<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>
|
||||||
|
<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" />
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
|
</content>
|
||||||
|
</ScrollPane>
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
</children>
|
</children>
|
||||||
|
@ -4,18 +4,30 @@
|
|||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.shape.Polygon?>
|
||||||
|
<?import javafx.scene.shape.Rectangle?>
|
||||||
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
|
<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.JouerSonTour4Controller">
|
||||||
<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">
|
|
||||||
<children>
|
<children>
|
||||||
<Pane fx:id="rootPane" 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" prefHeight="180.0" prefWidth="255.0" stylesheets="@style/popUp.css">
|
||||||
<children>
|
<children>
|
||||||
<Label layoutX="107.0" layoutY="23.0" text="attaque" />
|
<Label layoutX="32.0" layoutY="6.0" text="Vous attaquez" />
|
||||||
<Button layoutX="78.0" layoutY="144.0" mnemonicParsing="false" text="%lancer.de.des" />
|
<Button fx:id="btnLancer" layoutX="78.0" layoutY="144.0" mnemonicParsing="false" text="%lancer.de.des" />
|
||||||
<Label layoutX="161.0" layoutY="23.0" text="%joueur2" />
|
<Label fx:id="defenseur" layoutX="151.0" layoutY="6.0" text="%joueur2" />
|
||||||
<Label layoutX="46.0" layoutY="23.0" text="%joueur3" />
|
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="WHITE" height="87.0" layoutX="26.0" layoutY="45.0" stroke="BLACK" strokeType="INSIDE" width="86.0" />
|
||||||
<Pane layoutX="40.0" layoutY="49.0" prefHeight="85.0" prefWidth="85.0" stylesheets="@style/plateau.css" />
|
<Polygon fill="WHITE" layoutX="177.0" layoutY="92.0" points="-50.0, 40.0, 50.0, 40.0, 0.0, -60.0" stroke="BLACK" strokeType="INSIDE" />
|
||||||
<Pane layoutX="144.0" layoutY="49.0" prefHeight="85.0" prefWidth="85.0" />
|
<Label fx:id="d6" layoutX="56.0" layoutY="55.0" styleClass="des" text="6">
|
||||||
|
<font>
|
||||||
|
<Font size="48.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Label fx:id="d4" layoutX="163.0" layoutY="55.0" styleClass="des" text="4">
|
||||||
|
<font>
|
||||||
|
<Font size="48.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Button fx:id="btnStop" layoutX="105.0" layoutY="144.0" mnemonicParsing="false" text="Stop" />
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
</children>
|
</children>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user