bugfix LaticeApplicationWindow | ADD Constant
parent
76a6581326
commit
de4460e92c
|
@ -274,12 +274,33 @@ public class LaticeApplicationWindow extends Application {
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//###################### creating all rectangles and DragnDrop ######################//
|
//###################### creating all rectangles and DragnDrop ######################//
|
||||||
RectangleFX rectFX = new RectangleFX();
|
//ectangleFX rectFX = new RectangleFX();
|
||||||
rectFX.createRectangle(root, pane);
|
//rectFX.createRectangle(root, pane);
|
||||||
rectFX.dragnDropOnAllRectangles(player1, indexTileClicked, validateBtnClickedCount);
|
//rectFX.dragnDropOnAllRectangles(player1, indexTileClicked, validateBtnClickedCount);
|
||||||
rectFX.dragnDropOnAllRectangles(player2, indexTileClicked, validateBtnClickedCount);
|
//rectFX.dragnDropOnAllRectangles(player2, indexTileClicked, validateBtnClickedCount);
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//Setting drag & drop on rectangles
|
||||||
|
for(int i=0; i<NUMBER_OF_BOX_ON_ONE_LINE; i++) {
|
||||||
|
for(int j=0; j<NUMBER_OF_BOX_ON_ONE_LINE; j++) {
|
||||||
|
int a = i;
|
||||||
|
int b = j;
|
||||||
|
|
||||||
|
r[a][b].setOnDragEntered(new EventHandler<DragEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(DragEvent arg0) {
|
||||||
|
if (arg0.getDragboard().hasString()){
|
||||||
|
Dragboard dragboard = arg0.getDragboard();
|
||||||
|
|
||||||
|
r[a][b].setFill(new ImagePattern(listTileImage.get(getIndexTileClicked())));
|
||||||
|
}
|
||||||
|
arg0.consume();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
r[a][b].setOnDragExited(new EventHandler<DragEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(DragEvent arg0) {
|
public void handle(DragEvent arg0) {
|
||||||
if (arg0.isDropCompleted() == false) {
|
if (arg0.isDropCompleted() == false) {
|
||||||
|
@ -332,6 +353,25 @@ public class LaticeApplicationWindow extends Application {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//rules / referee implementaion
|
||||||
|
|
||||||
|
this.transition(namePlayer1, namePlayer2);
|
||||||
|
//root.setLeft(namePlayer1);
|
||||||
|
|
||||||
|
//###################### display name, score and deck of each player ######################//
|
||||||
|
HBox players = new HBox();
|
||||||
|
|
||||||
|
ArrayList<Player> allPlayers = new ArrayList<>();
|
||||||
|
allPlayers.add(player1);
|
||||||
|
allPlayers.add(player2);
|
||||||
|
|
||||||
|
for (Player nameplayer : allPlayers ) {
|
||||||
|
VBox player = new VBox();
|
||||||
|
|
||||||
Text name = new Text();
|
Text name = new Text();
|
||||||
name.setFont(Font.font(nameplayer.getName(), FontWeight.BOLD, 20));
|
name.setFont(Font.font(nameplayer.getName(), FontWeight.BOLD, 20));
|
||||||
name.setText(nameplayer.getName());
|
name.setText(nameplayer.getName());
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package latice.model;
|
||||||
|
|
||||||
|
public class Constant {
|
||||||
|
|
||||||
|
//for creating rectangles
|
||||||
|
public static final int NUMBER_OF_BOX_ON_ONE_LINE = 9;
|
||||||
|
|
||||||
|
public static final int RECTANGLE_HEIGHT = 50;
|
||||||
|
|
||||||
|
public static final int RECTANGLE_WIDTH = 50;
|
||||||
|
|
||||||
|
public static final int Y_CENTER = 37;
|
||||||
|
|
||||||
|
public static final int X_CENTER = 355;
|
||||||
|
|
||||||
|
public static final int BOX_WIDTH = 52;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue