Merge branch 'bugfix_players_when_replay' into 'master'
UPDATE Player, LaticeApplicationWindow and LaticeApplicationConsole See merge request odabasioglu1/latice!11master
commit
2a73cfb775
|
@ -43,8 +43,8 @@ public class LaticeApplicationConsole {
|
||||||
|
|
||||||
Score scorePlayer1 = new Score();
|
Score scorePlayer1 = new Score();
|
||||||
Score scorePlayer2 = new Score();
|
Score scorePlayer2 = new Score();
|
||||||
Player player1 = new Player("player1", scorePlayer1, deck1, rack1);
|
Player player1 = new Player("player1", deck1);
|
||||||
Player player2 = new Player("player2", scorePlayer2, deck2, rack2);
|
Player player2 = new Player("player2", deck2);
|
||||||
|
|
||||||
System.out.println("-----------------");
|
System.out.println("-----------------");
|
||||||
GameBoard board = new GameBoard();
|
GameBoard board = new GameBoard();
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
stage.setScene(menu);
|
stage.setScene(menu);
|
||||||
|
|
||||||
parentStackPane.getChildren().remove(root);
|
parentStackPane.getChildren().remove(root);
|
||||||
parentStackPane.getChildren().add(root);
|
//parentStackPane.getChildren().add(root);
|
||||||
parentStackPane.getChildren().remove(menuBorderPane);
|
parentStackPane.getChildren().remove(menuBorderPane);
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
|
@ -243,9 +243,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
|
|
||||||
//----------- group all players in a HBox to display -----------//
|
//----------- group all players in a HBox to display -----------//
|
||||||
HBox infoPlayers = new HBox();
|
HBox infoPlayers = new HBox();
|
||||||
if (isRestart) {
|
|
||||||
infoPlayers.getChildren().removeAll(infoPlayer1, infoPlayer2);
|
|
||||||
}
|
|
||||||
infoPlayers.getChildren().addAll(infoPlayer1, infoPlayer2);
|
infoPlayers.getChildren().addAll(infoPlayer1, infoPlayer2);
|
||||||
|
|
||||||
HBox.setMargin(infoPlayer1, new Insets(50,0,0,55));
|
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 there is already childrens, remove them all to start or restart game------------------------------------------------------------
|
||||||
|
root.getChildren().clear();
|
||||||
if (root.getChildren().contains(infoPlayers)) {
|
|
||||||
root.getChildren().remove(infoPlayers);
|
|
||||||
}
|
|
||||||
if (root.getChildren().contains(borderPane)) {
|
|
||||||
root.getChildren().remove(borderPane);
|
|
||||||
}
|
|
||||||
//adding new childrens
|
//adding new childrens
|
||||||
root.getChildren().addAll(infoPlayers, borderPane);
|
root.getChildren().addAll(infoPlayers, borderPane);
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class MainScreenController extends LaticeApplicationWindow{
|
||||||
Deck deck = new Deck(listOfTile);
|
Deck deck = new Deck(listOfTile);
|
||||||
Deck deck2 = 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;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@ public class Player {
|
||||||
this.rack = rack;
|
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) {
|
/*public Player(Score score, Deck deck, Rack rack) {
|
||||||
this(namePlayer,score,deck,rack);
|
this(namePlayer,score,deck,rack);
|
||||||
//Demande le nom du joueur
|
//Demande le nom du joueur
|
||||||
|
|
Loading…
Reference in New Issue