affichage des scores

main
ZIRTR0X 3 years ago
parent 50f209ef03
commit e2a78a84e7

@ -42,10 +42,16 @@ public class GamePlayController implements Initializable {
@FXML public ImageView playerImagePerso; @FXML public ImageView playerImagePerso;
boolean finJeu = false; private boolean finJeu = false;
GameTime gameTime; private GameTime gameTime;
GameLoop loop; private GameLoop loop;
Text textEnd; private Text textEnd;
private Text resultat1;
private Text resultat2;
private Text resultat3;
private Text resultat4;
private Text resultat5;
private int nbTour = 0;
public int difficulty; public int difficulty;
public int perso; public int perso;
@ -85,8 +91,38 @@ public class GamePlayController implements Initializable {
textEnd.setY(500); textEnd.setY(500);
textEnd.setFill(Color.WHITE); textEnd.setFill(Color.WHITE);
textEnd.setStyle("-fx-font: 100 arial; "); textEnd.setStyle("-fx-font: 100 arial; ");
resultat1 = new Text();
resultat1.setText("");
resultat1.setX(1045);
resultat1.setY(350);
resultat1.setFill(Color.WHITE);
resultat1.setStyle("-fx-font: 20 arial; ");
resultat2 = new Text();
resultat2.setText("");
resultat2.setX(1045);
resultat2.setY(400);
resultat2.setFill(Color.WHITE);
resultat2.setStyle("-fx-font: 20 arial; ");
resultat3 = new Text();
resultat3.setText("");
resultat3.setX(1045);
resultat3.setY(450);
resultat3.setFill(Color.WHITE);
resultat3.setStyle("-fx-font: 20 arial; ");
resultat4 = new Text();
resultat4.setText("");
resultat4.setX(1045);
resultat4.setY(500);
resultat4.setFill(Color.WHITE);
resultat4.setStyle("-fx-font: 20 arial; ");
resultat5 = new Text();
resultat5.setText("");
resultat5.setX(1045);
resultat5.setY(550);
resultat5.setFill(Color.WHITE);
resultat5.setStyle("-fx-font: 20 arial; ");
button = new JFXButton(""); button = new JFXButton("");
levelRoot.getChildren().addAll(text,textTimer,textEnd,button); levelRoot.getChildren().addAll(text,textTimer,textEnd,button, resultat1, resultat2, resultat3, resultat4, resultat5);
gameTime = new GameTime(textTimer); gameTime = new GameTime(textTimer);
gameTime.start(); gameTime.start();
PersoMouv = false; PersoMouv = false;
@ -321,6 +357,7 @@ public class GamePlayController implements Initializable {
//Case actual = persoController.getActualCase(); //Case actual = persoController.getActualCase();
if(PersoMouv == false) { if(PersoMouv == false) {
animationDe(); animationDe();
nbTour++;
} }
//verification(actual); //verification(actual);
@ -355,6 +392,13 @@ public class GamePlayController implements Initializable {
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(50 * i), event -> de.setImage(new Image(path)))); timeline.getKeyFrames().add(new KeyFrame(Duration.millis(50 * i), event -> de.setImage(new Image(path))));
} }
timeline.play(); timeline.play();
try {
personnage.sleep(700);
System.out.println("Lancement affichage resulsta");
affichageResultat();
} catch (InterruptedException e) {
e.printStackTrace();
}
for (i = 0; i < diceNumber; i++) { for (i = 0; i < diceNumber; i++) {
try { try {
PersoMouv = true; PersoMouv = true;
@ -369,4 +413,59 @@ public class GamePlayController implements Initializable {
}; };
personnage.start(); personnage.start();
} }
public void affichageResultat(){
System.out.println("affichageResultat()");
String ancienResultat1;
String ancienResultat2;
String ancienResultat3;
String ancienResultat4;
String ancienResultat5;
if(nbTour == 1){
resultat1.setText("Vous avez fait un " + diceNumber + ".");
}else{
if(nbTour == 2){
ancienResultat1 = resultat1.getText();
resultat1.setText("Vous avez fait un " + diceNumber + ".");
resultat2.setText(ancienResultat1);
System.out.println("ancienResultat2 : " + ancienResultat1);
}else{
if(nbTour == 3) {
ancienResultat1 = resultat1.getText();
ancienResultat2 = resultat2.getText();
resultat1.setText("Vous avez fait un " + diceNumber + ".");
resultat2.setText(ancienResultat1);
resultat3.setText(ancienResultat2);
}else{
if(nbTour == 4){
ancienResultat1 = resultat1.getText();
ancienResultat2 = resultat2.getText();
ancienResultat3 = resultat3.getText();
resultat1.setText("Vous avez fait un " + diceNumber + ".");
resultat2.setText(ancienResultat1);
resultat3.setText(ancienResultat2);
resultat4.setText(ancienResultat3);
}else{
ancienResultat1 = resultat1.getText();
ancienResultat2 = resultat2.getText();
ancienResultat3 = resultat3.getText();
ancienResultat4 = resultat4.getText();
resultat1.setText("Vous avez fait un " + diceNumber + ".");
resultat2.setText(ancienResultat1);
resultat3.setText(ancienResultat2);
resultat4.setText(ancienResultat3);
resultat5.setText(ancienResultat4);
}
}
}
}
/*resultat1.setText("Vous avez fait un " + diceNumber + ".");
resultat2.setText("Vous avez fait un " + diceNumber + ".");
resultat3.setText("Vous avez fait un " + diceNumber + ".");
resultat4.setText("Vous avez fait un " + diceNumber + ".");
resultat5.setText("Vous avez fait un " + diceNumber + ".");*/
}
} }

Loading…
Cancel
Save