diff --git a/src/main/java/latice/application/LaticeApplicationConsole.java b/src/main/java/latice/application/LaticeApplicationConsole.java index d9042ac..75406eb 100644 --- a/src/main/java/latice/application/LaticeApplicationConsole.java +++ b/src/main/java/latice/application/LaticeApplicationConsole.java @@ -134,7 +134,7 @@ public class LaticeApplicationConsole { while (round) { System.out.println("c'est à votre tour de jouer " + player.getName() +"!"); - System.out.println("Vous avez " + player.getScore() +", donc que voulez-vous faire ?\n" + System.out.println("Vous avez " + player.getScore() +" points, que voulez-vous faire ?\n" + " 1. Jouer une Tuile (à partir de la deuxième tuile jouée, cela coûtera 2 points)\n" + " 2. Acheter une action supplémentaire\n" + " 3. Changer le Rack et passer(coûte 3 points)\n" diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index 2bde023..c7cd707 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -74,8 +74,8 @@ public class LaticeApplicationWindow extends Application { ArrayList listOfTile = new ArrayList(); Map assocRectangleTile = new HashMap(); static StackPane rootLayout; - private Label namePlayer1 = new Label(); - private Label namePlayer2 = new Label(); + private Label namePlayer1 = new Label("Anonym"); + private Label namePlayer2 = new Label("Anonym"); public static int indexTileClicked; @@ -85,8 +85,9 @@ public class LaticeApplicationWindow extends Application { //StackPane for background image + BorderPane root onto it StackPane stackPane = new StackPane(); static Stage primaryStageCopy; + StackPane parentStackPane = new StackPane(); - + int validateBtnClickedCount; @@ -102,7 +103,6 @@ public class LaticeApplicationWindow extends Application { Parent loader = FXMLLoader.load(getClass().getResource("../view/MainScreen.fxml")); Scene menu = new Scene(loader, 1280, 720); MainScreenController MSC = new MainScreenController(); - //Title @@ -181,7 +181,9 @@ public class LaticeApplicationWindow extends Application { @Override public void handle(MouseEvent arg0) { - // TODO on mouse clicked on confirm + + validateBtnClickedCount++; + System.out.println("confirmed placement"); } @@ -221,6 +223,15 @@ public class LaticeApplicationWindow extends Application { } }); + + rackImage.getChildren().get(a).setOnDragDone(new EventHandler() { + + @Override + public void handle(DragEvent arg0) { + + } + + }); } System.out.println((indexTileClicked)); @@ -275,15 +286,29 @@ public class LaticeApplicationWindow extends Application { arg0.setDropCompleted(true); assocRectangleTile.put(r[a][b], listRackTile.get(getIndexTileClicked())); System.out.println(assocRectangleTile.toString()); + if (validateBtnClickedCount == 0){ + if (r[a][b] == r[4][4]) { + System.out.println("MOON valid placement"); + }else { + System.out.println("Please place first Tile on MOON"); + } + } + arg0.consume(); } }); + + } } + //rules / referee implementaion + + root.setLeft(namePlayer1); + parentStackPane = MSC.getParentStackPane(); //-------------------------------------------------------------------------------------- setPrimaryStage(primaryStage); @@ -329,13 +354,15 @@ public class LaticeApplicationWindow extends Application { } public void playerNamesEntered() { - System.out.println("entered playNamesEntered()" + namePlayer1 + " VS " + namePlayer2); + System.out.println("entered playNamesEntered()" + namePlayer1.getText() + " VS " + namePlayer2.getText()); HBox scoreHbox = new HBox(); scoreHbox.getChildren().add(namePlayer1); scoreHbox.getChildren().add(namePlayer2); Text working = new Text("Working"); root.setLeft(working); - primaryStageCopy.show(); + MainScreenController MSC = new MainScreenController(); + MSC.setParentStackPane(parentStackPane); + primaryStageCopy.setTitle("working"); } } diff --git a/src/main/java/latice/controller/MainScreenController.java b/src/main/java/latice/controller/MainScreenController.java index 2ebb3b7..887ba28 100644 --- a/src/main/java/latice/controller/MainScreenController.java +++ b/src/main/java/latice/controller/MainScreenController.java @@ -132,4 +132,13 @@ public class MainScreenController extends LaticeApplicationWindow{ }); timeline.play(); } + + public StackPane getParentStackPane() { + return parentStackPane; + } + + public void setParentStackPane(StackPane parentStackPane) { + this.parentStackPane = parentStackPane; + } + } diff --git a/src/main/java/latice/model/Rules.java b/src/main/java/latice/model/Rules.java index ad1343b..76edeb6 100644 --- a/src/main/java/latice/model/Rules.java +++ b/src/main/java/latice/model/Rules.java @@ -20,6 +20,7 @@ public class Rules { } } + public Integer neighborRule(GameBoard board, Tile tile) { Integer nbrNeighbor = 0; diff --git a/src/main/java/latice/view/GameFinishedScreen.fxml b/src/main/java/latice/view/GameFinishedScreen.fxml new file mode 100644 index 0000000..95bf597 --- /dev/null +++ b/src/main/java/latice/view/GameFinishedScreen.fxml @@ -0,0 +1,8 @@ + + + + + + + +