From b7da0b39d798498d3560b184058d06127062bc4d Mon Sep 17 00:00:00 2001 From: Mathis Date: Sun, 5 Jun 2022 19:30:33 +0200 Subject: [PATCH] ADD modifying display of the tiles remaining for each player | ADD sun rule in game when a tile is placed on a sun --- .../java/latice/application/LaticeApplicationWindow.java | 8 ++++++++ src/main/java/latice/model/window/PlayerFX.java | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index e334ba5..81fa70d 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -637,6 +637,13 @@ public class LaticeApplicationWindow extends Application { tileDropped = true; freeOrPayableTile = false; System.out.println("tuile posé!"); + + + if (referee.sunRule(board, player.getRack().getListRackTile().get(indexTileClicked))) { + System.out.println("Vous avez gagné 2 points en mettant votre tuile sur un soleil"); + playerFX.setAddScore(player, 2); + + } } } } @@ -701,6 +708,7 @@ public class LaticeApplicationWindow extends Application { //setDragnDropOnRectangles(rect, board, referee, player); borderPane.setBottom(rackImage); tileDropped = false; + playerFX.setTilesRemaining(player); } } diff --git a/src/main/java/latice/model/window/PlayerFX.java b/src/main/java/latice/model/window/PlayerFX.java index 3c790bc..1a5799c 100644 --- a/src/main/java/latice/model/window/PlayerFX.java +++ b/src/main/java/latice/model/window/PlayerFX.java @@ -64,6 +64,10 @@ public class PlayerFX { this.score.setText("Score : " + player.getScore()); } + public void setTilesRemaining(Player player) { + this.nbrOfTiles.setText("Tuiles restantes : " + player.getNumberOfTilesRemaining()); + } + }