Merge branch 'master' of http://git.unilim.fr/odabasioglu1/latice.git
commit
9310eb6bc7
|
@ -98,6 +98,9 @@ public class LaticeApplicationWindow extends Application {
|
||||||
|
|
||||||
Paint tileOnRect;
|
Paint tileOnRect;
|
||||||
|
|
||||||
|
//tile is free when it the first tile put but tile is payable after
|
||||||
|
Boolean freeOrPayableTile = true;
|
||||||
|
|
||||||
//borderPane layout
|
//borderPane layout
|
||||||
public static BorderPane borderPane = new BorderPane();
|
public static BorderPane borderPane = new BorderPane();
|
||||||
|
|
||||||
|
@ -214,6 +217,8 @@ public class LaticeApplicationWindow extends Application {
|
||||||
//Referee
|
//Referee
|
||||||
referee = new Rules();
|
referee = new Rules();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
//display name, score and deck of each player
|
//display name, score and deck of each player
|
||||||
|
@ -328,6 +333,8 @@ public class LaticeApplicationWindow extends Application {
|
||||||
playerFX.setFillName(Constant.realColor.RED);
|
playerFX.setFillName(Constant.realColor.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freeOrPayableTile = true;
|
||||||
|
|
||||||
rackImage = player.getRack().createTileImage();
|
rackImage = player.getRack().createTileImage();
|
||||||
setDragnDropOnRack(rackImage, player);
|
setDragnDropOnRack(rackImage, player);
|
||||||
setDragnDropOnRectangles(rect, board, referee, player);
|
setDragnDropOnRectangles(rect, board, referee, player);
|
||||||
|
@ -389,7 +396,7 @@ public class LaticeApplicationWindow extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
////// for the next player //////
|
////// for the next player //////
|
||||||
|
freeOrPayableTile = true;
|
||||||
rackImage = player.getRack().createTileImage();
|
rackImage = player.getRack().createTileImage();
|
||||||
|
|
||||||
//Setting drag n drop on tiles
|
//Setting drag n drop on tiles
|
||||||
|
@ -521,19 +528,26 @@ public class LaticeApplicationWindow extends Application {
|
||||||
System.out.println("OK2");
|
System.out.println("OK2");
|
||||||
|
|
||||||
|
|
||||||
rect[a][b].setFill(new ImagePattern(player.getRack().getRackTileImage().get(getIndexTileClicked())));
|
rect[a][b].setFill(new ImagePattern(player.getRack().getRackTileImage().get(indexTileClicked)));
|
||||||
|
|
||||||
|
|
||||||
arg0.setDropCompleted(true);
|
arg0.setDropCompleted(true);
|
||||||
System.out.println("OK");
|
System.out.println("OK");
|
||||||
ErrorLabel.setText("");
|
ErrorLabel.setText("");
|
||||||
|
|
||||||
|
if (referee.checkScoreToPlay(player, freeOrPayableTile) == false) {
|
||||||
|
ErrorLabel.setText("Error ! You haven't enough points to play another tile");
|
||||||
|
rect[a][b].setFill(tileOnRect);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
if (Constant.START) {
|
if (Constant.START) {
|
||||||
if (rect[a][b] == rect[4][4]) {
|
if (rect[a][b] == rect[4][4]) {
|
||||||
System.out.println("MOON valid placement");
|
System.out.println("MOON valid placement");
|
||||||
|
|
||||||
board.setGridBoardTile(player.getRack().getListRackTile().get(indexTileClicked), a, b);
|
board.setGridBoardTile(player.getRack().getListRackTile().get(indexTileClicked), a, b);
|
||||||
tileDropped = true;
|
tileDropped = true;
|
||||||
|
freeOrPayableTile = false;
|
||||||
Constant.START = false;
|
Constant.START = false;
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
@ -550,6 +564,9 @@ public class LaticeApplicationWindow extends Application {
|
||||||
System.out.println("Règle effectué");
|
System.out.println("Règle effectué");
|
||||||
player.getRack().getListRackTile().get(indexTileClicked).setPosition(new Position(a,b));
|
player.getRack().getListRackTile().get(indexTileClicked).setPosition(new Position(a,b));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( referee.checkPositionRule(board, player.getRack().getListRackTile().get(indexTileClicked)) == false ) {
|
if ( referee.checkPositionRule(board, player.getRack().getListRackTile().get(indexTileClicked)) == false ) {
|
||||||
ErrorLabel.setText("Error ! The tile can't be placed here because there is already a tile placed");
|
ErrorLabel.setText("Error ! The tile can't be placed here because there is already a tile placed");
|
||||||
rect[a][b].setFill(tileOnRect);
|
rect[a][b].setFill(tileOnRect);
|
||||||
|
@ -562,6 +579,11 @@ public class LaticeApplicationWindow extends Application {
|
||||||
rect[a][b].setFill(Constant.realColor.TRANSPARENT);
|
rect[a][b].setFill(Constant.realColor.TRANSPARENT);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
|
if (freeOrPayableTile == false) {
|
||||||
|
playerFX.setDiffScore(player, 2);
|
||||||
|
}
|
||||||
|
|
||||||
if (nbr == 2) {
|
if (nbr == 2) {
|
||||||
System.out.println("Vous avez gagné 1 point");
|
System.out.println("Vous avez gagné 1 point");
|
||||||
playerFX.setAddScore(player, 1);
|
playerFX.setAddScore(player, 1);
|
||||||
|
@ -577,10 +599,11 @@ public class LaticeApplicationWindow extends Application {
|
||||||
|
|
||||||
board.setGridBoardTile(player.getRack().getListRackTile().get(getIndexTileClicked()), a, b);
|
board.setGridBoardTile(player.getRack().getListRackTile().get(getIndexTileClicked()), a, b);
|
||||||
tileDropped = true;
|
tileDropped = true;
|
||||||
|
freeOrPayableTile = false;
|
||||||
System.out.println("tuile posé!");
|
System.out.println("tuile posé!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue