From 8e348d5a3e2dbb144a2184fa8d34ef911dfab33d Mon Sep 17 00:00:00 2001 From: Chiara Date: Tue, 5 May 2020 13:13:25 +0200 Subject: [PATCH] =?UTF-8?q?liasons=20interface=20jou=C3=A9=20tour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ihm/Main.java | 4 +- .../controller/JouerSonTour1Controller.java | 80 ++++++------------- src/ihm/controller/PauseController.java | 14 +++- .../ressources/Jouer_tour(1)lancer_des.fxml | 38 ++++++--- .../ressources/Jouer_tour(2)carte_lieux.fxml | 9 ++- src/ihm/ressources/Jouer_tour(3)attaquer.fxml | 79 ++++++++++++++++-- src/ihm/ressources/style/popUp.css | 4 + 7 files changed, 149 insertions(+), 79 deletions(-) diff --git a/src/ihm/Main.java b/src/ihm/Main.java index 5c04127..df97279 100644 --- a/src/ihm/Main.java +++ b/src/ihm/Main.java @@ -17,7 +17,7 @@ public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { - final URL fxmlURL = getClass().getResource("ressources/parametre.fxml"); // "ressources/Jouer_tour(1)lancer_des.fxml" + final URL fxmlURL = getClass().getResource("ressources/Jouer_tour(1)lancer_des.fxml"); // "ressources/Jouer_tour(1)lancer_des.fxml" final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE); final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); Pane root = fxmlLoader.load(); @@ -31,7 +31,7 @@ public class Main extends Application { System.exit(0); } }); - primaryStage.setMaximized(true); + //primaryStage.setMaximized(true); primaryStage.show(); } diff --git a/src/ihm/controller/JouerSonTour1Controller.java b/src/ihm/controller/JouerSonTour1Controller.java index daaf062..1609768 100644 --- a/src/ihm/controller/JouerSonTour1Controller.java +++ b/src/ihm/controller/JouerSonTour1Controller.java @@ -16,6 +16,7 @@ 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; @@ -26,71 +27,42 @@ import javafx.util.Duration; import main.Joueur; public class JouerSonTour1Controller implements Initializable{ - private Joueur joueur; - @FXML private Pane rootPane; - @FXML private Label nomJoueur; - @FXML private AnchorPane d6; - @FXML private AnchorPane d4; + @FXML private Label d6; + @FXML private Label d4; + @FXML private Button btnStop; + @FXML private Button btnLancer; @Override public void initialize(URL arg0, ResourceBundle arg1) { - System.out.println("\tLancements des dès"); - - //nomJoueur.setText(joueur.getNom()); - - int OFFSET_X = 0; - int OFFSET_Y = 0; - int WIDTH = 80; - int HEIGHT = 80; - int COUNT = 6; - int COLUMNS = 6; - - //anchorPane1.getChildren().setAll(imageView); - - - ImageView imageView; - try { - imageView = FXMLLoader.load(getClass().getResource("/ihm/ressources/img/des.fxml")); - imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT)); - - imageView.fitWidthProperty().bind(d6.widthProperty()); - final SpriteAnimation animation = new SpriteAnimation( - imageView, - Duration.millis(250), - COUNT, COLUMNS, - OFFSET_X, OFFSET_Y, - 557, 557 - ); - animation.setCycleCount(Animation.INDEFINITE); - animation.play(); - d6.getChildren().addAll(new Group(imageView)); - d6.setOnMousePressed(new EventHandler( - - ) { - - @Override - public void handle(Event arg0) { - animation.stop(); - - } - }); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + btnStop.setVisible(false); } @FXML - public void lancerDes(MouseEvent mouseEvent) throws IOException, InterruptedException{ + 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); } - - public void deplacerPion(CarteLieu lieux) { - - } } \ No newline at end of file diff --git a/src/ihm/controller/PauseController.java b/src/ihm/controller/PauseController.java index 30aabbb..d2b2278 100644 --- a/src/ihm/controller/PauseController.java +++ b/src/ihm/controller/PauseController.java @@ -3,17 +3,23 @@ package ihm.controller; import java.io.IOException; import java.io.InputStream; import java.net.URL; +import java.util.Locale; +import java.util.Map; import java.util.ResourceBundle; import ihm.EffetSonore; import ihm.Musique; import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; +import javafx.scene.Scene; import javafx.scene.control.CheckBox; import javafx.scene.input.MouseEvent; +import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import main.GestionnaireJeu; +import main.Joueur; public class PauseController implements Initializable { @FXML @@ -95,6 +101,12 @@ public class PauseController implements Initializable { System.err.println("Fin de partie"); Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow(); appStage.close(); - + + final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml"); + final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH); + final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); + AnchorPane root = fxmlLoader.load(); + + } } diff --git a/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml b/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml index e49d482..0b58c99 100644 --- a/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml +++ b/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml @@ -1,28 +1,44 @@ + - + + - - - diff --git a/src/ihm/ressources/Jouer_tour(2)carte_lieux.fxml b/src/ihm/ressources/Jouer_tour(2)carte_lieux.fxml index 8192f58..1d41dee 100644 --- a/src/ihm/ressources/Jouer_tour(2)carte_lieux.fxml +++ b/src/ihm/ressources/Jouer_tour(2)carte_lieux.fxml @@ -1,5 +1,6 @@ + @@ -7,18 +8,20 @@ - - + + + + + + + + + + + + + + diff --git a/src/ihm/ressources/style/popUp.css b/src/ihm/ressources/style/popUp.css index 4ccd568..d6b3133 100644 --- a/src/ihm/ressources/style/popUp.css +++ b/src/ihm/ressources/style/popUp.css @@ -17,4 +17,8 @@ Button { -fx-background-color: #1d1d1d; -fx-text-fill: #d8d8d8; -fx-background-insets: 0 0 0 0, 0, 1, 2; +} + +.anchorDes{ + -fx-border-color: #e2e2e2; } \ No newline at end of file