diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index dfeea0e..0472894 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -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); diff --git a/src/main/java/latice/model/window/PlayerFX.java b/src/main/java/latice/model/window/PlayerFX.java index c536280..3c790bc 100644 --- a/src/main/java/latice/model/window/PlayerFX.java +++ b/src/main/java/latice/model/window/PlayerFX.java @@ -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()); + } + }