Skip to content

Commit

Permalink
font fix & prevent client from making same move
Browse files Browse the repository at this point in the history
  • Loading branch information
ELEXG committed May 21, 2024
1 parent de299ad commit 58e1a2c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/example/cs4b_project/Online_game.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public void initialize() {
boardArray[buttonPos].setText(player == 1 ? "X" : "O" );
boardArray[buttonPos].setStyle(textColor + "-fx-font-size: 28px;");
disableAllButtons();
disabledButtons.add(buttonPos);
sendMove(buttonPos);

// Set Internal Board
Expand Down Expand Up @@ -432,6 +433,8 @@ private void updateBoard(int pos) {
javafx.application.Platform.runLater(() ->
boardArray[pos].setText(player == 2 ? "X" : "O" )
);
boardArray[pos].setStyle(player == 2 ? "-fx-text-fill: #0831e7;" + "-fx-font-size: 28px;"
: "-fx-text-fill: #d40505;" + "-fx-font-size: 28px;");
disabledButtons.add(pos);
game.setPos(pos, player == 2 ? 1 : 2);
System.out.println("Set position: " + pos);
Expand Down

0 comments on commit 58e1a2c

Please sign in to comment.