adjustments

master
Cemal Odabasioglu 2022-05-31 15:12:10 +02:00
parent 73366ec789
commit a95f04440e
5 changed files with 53 additions and 8 deletions

View File

@ -134,7 +134,7 @@ public class LaticeApplicationConsole {
while (round) { while (round) {
System.out.println("c'est à votre tour de jouer " + player.getName() +"!"); 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" + " 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" + " 2. Acheter une action supplémentaire\n"
+ " 3. Changer le Rack et passer(coûte 3 points)\n" + " 3. Changer le Rack et passer(coûte 3 points)\n"

View File

@ -74,8 +74,8 @@ public class LaticeApplicationWindow extends Application {
ArrayList<Tile> listOfTile = new ArrayList<Tile>(); ArrayList<Tile> listOfTile = new ArrayList<Tile>();
Map<Rectangle, Tile> assocRectangleTile = new HashMap<Rectangle, Tile>(); Map<Rectangle, Tile> assocRectangleTile = new HashMap<Rectangle, Tile>();
static StackPane rootLayout; static StackPane rootLayout;
private Label namePlayer1 = new Label(); private Label namePlayer1 = new Label("Anonym");
private Label namePlayer2 = new Label(); private Label namePlayer2 = new Label("Anonym");
public static int indexTileClicked; public static int indexTileClicked;
@ -85,8 +85,9 @@ public class LaticeApplicationWindow extends Application {
//StackPane for background image + BorderPane root onto it //StackPane for background image + BorderPane root onto it
StackPane stackPane = new StackPane(); StackPane stackPane = new StackPane();
static Stage primaryStageCopy; static Stage primaryStageCopy;
StackPane parentStackPane = new StackPane();
int validateBtnClickedCount;
@ -104,7 +105,6 @@ public class LaticeApplicationWindow extends Application {
MainScreenController MSC = new MainScreenController(); MainScreenController MSC = new MainScreenController();
//Title //Title
Text title = new Text("Latice"); Text title = new Text("Latice");
title.setFont(new Font(30)); title.setFont(new Font(30));
@ -181,7 +181,9 @@ public class LaticeApplicationWindow extends Application {
@Override @Override
public void handle(MouseEvent arg0) { 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<DragEvent>() {
@Override
public void handle(DragEvent arg0) {
}
});
} }
System.out.println((indexTileClicked)); System.out.println((indexTileClicked));
@ -275,15 +286,29 @@ public class LaticeApplicationWindow extends Application {
arg0.setDropCompleted(true); arg0.setDropCompleted(true);
assocRectangleTile.put(r[a][b], listRackTile.get(getIndexTileClicked())); assocRectangleTile.put(r[a][b], listRackTile.get(getIndexTileClicked()));
System.out.println(assocRectangleTile.toString()); 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(); arg0.consume();
} }
}); });
} }
} }
//rules / referee implementaion
root.setLeft(namePlayer1); root.setLeft(namePlayer1);
parentStackPane = MSC.getParentStackPane();
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
setPrimaryStage(primaryStage); setPrimaryStage(primaryStage);
@ -329,13 +354,15 @@ public class LaticeApplicationWindow extends Application {
} }
public void playerNamesEntered() { 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(); HBox scoreHbox = new HBox();
scoreHbox.getChildren().add(namePlayer1); scoreHbox.getChildren().add(namePlayer1);
scoreHbox.getChildren().add(namePlayer2); scoreHbox.getChildren().add(namePlayer2);
Text working = new Text("Working"); Text working = new Text("Working");
root.setLeft(working); root.setLeft(working);
primaryStageCopy.show(); MainScreenController MSC = new MainScreenController();
MSC.setParentStackPane(parentStackPane);
primaryStageCopy.setTitle("working");
} }
} }

View File

@ -132,4 +132,13 @@ public class MainScreenController extends LaticeApplicationWindow{
}); });
timeline.play(); timeline.play();
} }
public StackPane getParentStackPane() {
return parentStackPane;
}
public void setParentStackPane(StackPane parentStackPane) {
this.parentStackPane = parentStackPane;
}
} }

View File

@ -20,6 +20,7 @@ public class Rules {
} }
} }
public Integer neighborRule(GameBoard board, Tile tile) { public Integer neighborRule(GameBoard board, Tile tile) {
Integer nbrNeighbor = 0; Integer nbrNeighbor = 0;

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane xmlns:fx="http://javafx.com/fxml/1">
<!-- TODO Add Nodes -->
</BorderPane>