Ajout constructeur de Plateau en s'appuyant de RessourceLoader

This commit is contained in:
Paul Gross
2020-05-07 16:58:31 +02:00
parent 9fca28f7bb
commit 144ffd5434
17 changed files with 309 additions and 118 deletions

View File

@ -20,7 +20,7 @@ public class Main extends Application {
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = fxmlLoader.load();
primaryStage.setTitle("Shadow Hunters");
primaryStage.setScene(new Scene(root));
primaryStage.centerOnScreen();
@ -35,8 +35,13 @@ public class Main extends Application {
}
public static void main(String[] args) {
//System.err.close();
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
/*
RessourceLoader rl = new RessourceLoader();
rl.loadRessources();
gj.setRessourceLoader(rl);
*/
launch(args);
}
}

View File

@ -1,22 +0,0 @@
package ihm;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
public class ZoneJoueurThread extends Thread {
private boolean finished;
public ZoneJoueurThread(AnchorPane anchorPane, Pane pane) {
this.finished = false;
}
public void run() {
while(!finished) {
}
}
}

View File

@ -1,11 +1,13 @@
package ihm.controller;
import carte.CarteLieu;
import javafx.animation.TranslateTransition;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.util.Duration;
import main.Joueur;
public class GestionnaireDePions {
@ -33,9 +35,18 @@ public class GestionnaireDePions {
FlowPane fpAncient = (FlowPane) nAncient.getChildren().get(0);
fpAncient.getChildren().remove(pionVie);
System.out.println(damage);
if(damage < 0) {
damage = 0;
}else if(damage > gp.getChildren().size()-1) {
damage = gp.getChildren().size()-1;
}
StackPane nNew = (StackPane) gp.getChildren().get(damage);
FlowPane fpNew = (FlowPane) nNew.getChildren().get(0);
fpNew.getChildren().add(pionVie);
}
public void deplacerPionLieux(Joueur j) {
@ -56,9 +67,21 @@ public class GestionnaireDePions {
StackPane sp = (StackPane) hbox.getChildren().get(indexCL%2);
FlowPane fp = (FlowPane) sp.getChildren().get(0);
fp.getChildren().add(this.pionLieu);
fp.getChildren().add(this.pionLieu);
}
public void animationDeplacer(double x, double y, Pion p) {
TranslateTransition translate = new TranslateTransition();
translate.setByX(x);
translate.setByY(y);
translate.setDuration(Duration.millis(2000));
translate.setNode(p);
translate.play();
}
}

View File

@ -291,8 +291,8 @@ public class PlateauController implements Initializable {
}
public void updateVieJoueur(Joueur joueur, int damage) {
/*JoueurIHM jIHM = getJoueurIHM(joueur);
jIHM.deplacerPionVie(damage);*/
JoueurIHM jIHM = getJoueurIHM(joueur);
jIHM.deplacerPionVie(damage);
}

View File

@ -9,44 +9,32 @@
<AnchorPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.MenuController">
<children>
<VBox alignment="CENTER" layoutX="-3.0" layoutY="-7.0" prefHeight="802.0" prefWidth="1290.0">
<VBox alignment="CENTER" layoutX="-3.0" layoutY="-7.0" spacing="30.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true">
<VBox.margin>
<Insets top="-200.0" />
<Insets bottom="50.0" />
</VBox.margin>
</ImageView>
<Button mnemonicParsing="false" onMouseClicked="#commencerPartie" prefHeight="51.0" prefWidth="102.0" styleClass="bouton" text="%jouer">
<Button mnemonicParsing="false" onMouseClicked="#commencerPartie" styleClass="bouton" text="%jouer">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="100.0" />
</VBox.margin>
</Button>
<Button layoutX="602.0" layoutY="480.0" mnemonicParsing="false" onMouseClicked="#ouvrirParametres" prefHeight="59.0" prefWidth="164.0" styleClass="bouton" text="Paramètres">
<Button mnemonicParsing="false" onMouseClicked="#ouvrirParametres" styleClass="bouton" text="Paramètres">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="50.0" />
</VBox.margin>
</Button>
<Button mnemonicParsing="false" onMouseClicked="#afficherRegle" prefHeight="59.0" prefWidth="106.0" styleClass="bouton" text="%regles">
<Button mnemonicParsing="false" onMouseClicked="#afficherRegle" styleClass="bouton" text="%regles">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="50.0" />
</VBox.margin>
</Button>
<Button mnemonicParsing="false" onMouseClicked="#quitterLappli" prefHeight="48.0" prefWidth="108.0" styleClass="bouton" text="quitter">
<Button mnemonicParsing="false" onMouseClicked="#quitterLappli" styleClass="bouton" text="Quitter">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="50.0" />
</VBox.margin>
</Button>
</children>
</VBox>