ADD display of score to increase it | UPDATE PlayerFX,

LaticeApplicationWindow
master
Mathis 2022-06-03 21:51:53 +02:00
parent 2658755153
commit 9ad0fd5b4e
2 changed files with 24 additions and 12 deletions

View File

@ -559,11 +559,13 @@ public class LaticeApplicationWindow extends Application {
}else {
if (nbr == 2) {
System.out.println("Vous avez gagné 1 point");
playerFX.setAddScore(player, 1);
}else if (nbr == 3) {
System.out.println("Vous avez gagné 2 points");
playerFX.setAddScore(player, 2);
}else if (nbr == 4) {
System.out.println("Vous avez gagné 4 points");
playerFX.setAddScore(player, 4);
}
//assocRectangleTile.put(rect[a][b], listRackTile.get(getIndexTileClicked()));
board.setGridBoardTile(player.getRack().getListRackTile().get(getIndexTileClicked()), a, b);

View File

@ -27,33 +27,43 @@ public class PlayerFX {
//allPlayers.add(player2);
//for (Player namePlayer : allPlayers ) {
infoPlayer = new VBox();
this.infoPlayer = new VBox();
name = new Text();
name.setFont(Font.font(player.getName(), FontWeight.BOLD, 20));
name.setText(player.getName());
this.name = new Text();
this.name.setFont(Font.font(player.getName(), FontWeight.BOLD, 20));
this.name.setText(player.getName());
score = new Text();
score.setText("Score : " + player.getScore());
this.score = new Text();
this.score.setText("Score : " + player.getScore());
nbrOfTiles = new Text();
nbrOfTiles.setText("Tuiles restantes : " + player.getNumberOfTilesRemaining());
this.nbrOfTiles = new Text();
this.nbrOfTiles.setText("Tuiles restantes : " + player.getNumberOfTilesRemaining());
infoPlayer.getChildren().addAll(name, score, nbrOfTiles);
infoPlayer.setSpacing(5);
this.infoPlayer.getChildren().addAll(name, score, nbrOfTiles);
this.infoPlayer.setSpacing(5);
//players.getChildren().add(infoPlayer);
//players.setMargin(infoPlayer, new Insets(50,0,0,55));
//}
//players.setSpacing(850);
return infoPlayer;
return this.infoPlayer;
}
public void setFillName(javafx.scene.paint.Color color) {
name.setFill(color);
}
public void setAddScore(Player player, Integer score) {
player.addScore(score);
this.score.setText("Score : " + player.getScore());
}
public void setDiffScore(Player player, Integer score) {
player.diffScore(score);
this.score.setText("Score : " + player.getScore());
}
}