diff --git a/src/main/java/latice/application/LaticeApplicationConsole.java b/src/main/java/latice/application/LaticeApplicationConsole.java index c9b3832..73086e0 100644 --- a/src/main/java/latice/application/LaticeApplicationConsole.java +++ b/src/main/java/latice/application/LaticeApplicationConsole.java @@ -43,8 +43,8 @@ public class LaticeApplicationConsole { Score scorePlayer1 = new Score(); Score scorePlayer2 = new Score(); - Player player1 = new Player("player1", scorePlayer1, deck1, rack1); - Player player2 = new Player("player2", scorePlayer2, deck2, rack2); + Player player1 = new Player("player1", deck1); + Player player2 = new Player("player2", deck2); System.out.println("-----------------"); GameBoard board = new GameBoard(); diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index 41ce255..a7efd71 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -152,7 +152,7 @@ public class LaticeApplicationWindow extends Application { stage.setScene(menu); parentStackPane.getChildren().remove(root); - parentStackPane.getChildren().add(root); + //parentStackPane.getChildren().add(root); parentStackPane.getChildren().remove(menuBorderPane); }else { @@ -243,9 +243,7 @@ public class LaticeApplicationWindow extends Application { //----------- group all players in a HBox to display -----------// HBox infoPlayers = new HBox(); - if (isRestart) { - infoPlayers.getChildren().removeAll(infoPlayer1, infoPlayer2); - } + infoPlayers.getChildren().addAll(infoPlayer1, infoPlayer2); HBox.setMargin(infoPlayer1, new Insets(50,0,0,55)); @@ -473,14 +471,8 @@ public class LaticeApplicationWindow extends Application { - //------if it's à restart game then remove old childrens------------------------------------------------------------ - - if (root.getChildren().contains(infoPlayers)) { - root.getChildren().remove(infoPlayers); - } - if (root.getChildren().contains(borderPane)) { - root.getChildren().remove(borderPane); - } + //------if there is already childrens, remove them all to start or restart game------------------------------------------------------------ + root.getChildren().clear(); //adding new childrens root.getChildren().addAll(infoPlayers, borderPane); diff --git a/src/main/java/latice/controller/GameFinishedScreenController.java b/src/main/java/latice/controller/GameFinishedScreenController.java index 849db86..ca5c87d 100644 --- a/src/main/java/latice/controller/GameFinishedScreenController.java +++ b/src/main/java/latice/controller/GameFinishedScreenController.java @@ -47,4 +47,4 @@ public class GameFinishedScreenController implements Initializable{ } -} +} \ No newline at end of file diff --git a/src/main/java/latice/controller/MainScreenController.java b/src/main/java/latice/controller/MainScreenController.java index fc4846f..985a530 100644 --- a/src/main/java/latice/controller/MainScreenController.java +++ b/src/main/java/latice/controller/MainScreenController.java @@ -185,9 +185,9 @@ public class MainScreenController extends LaticeApplicationWindow{ Deck deck = new Deck(listOfTile); Deck deck2 = new Deck(listOfTile); - Player player = new Player(namePlayer, new Score(), deck, new Rack(deck)); + Player player = new Player(namePlayer, deck); return player; } -} +} \ No newline at end of file diff --git a/src/main/java/latice/controller/PlayerNameInputController.java b/src/main/java/latice/controller/PlayerNameInputController.java index ae8c852..40eabf6 100644 --- a/src/main/java/latice/controller/PlayerNameInputController.java +++ b/src/main/java/latice/controller/PlayerNameInputController.java @@ -102,4 +102,4 @@ public class PlayerNameInputController { } -} +} \ No newline at end of file diff --git a/src/main/java/latice/model/Constant.java b/src/main/java/latice/model/Constant.java index ffb2095..564b1c0 100644 --- a/src/main/java/latice/model/Constant.java +++ b/src/main/java/latice/model/Constant.java @@ -33,4 +33,4 @@ public class Constant { //Dimension width and height of the Latice plateau public static final int DIMENSION = 9; -} +} \ No newline at end of file diff --git a/src/main/java/latice/model/Player.java b/src/main/java/latice/model/Player.java index 18f62b4..8f42dbd 100644 --- a/src/main/java/latice/model/Player.java +++ b/src/main/java/latice/model/Player.java @@ -20,6 +20,10 @@ public class Player { this.rack = rack; } + public Player(String name, Deck deck) { + this(name, new Score(), deck, new Rack(deck)); + } + /*public Player(Score score, Deck deck, Rack rack) { this(namePlayer,score,deck,rack); //Demande le nom du joueur