Class InGameController

java.lang.Object
View.bookscrabbleapp.InGameController
All Implemented Interfaces:
Observer, javafx.fxml.Initializable

public class InGameController extends Object implements Observer, javafx.fxml.Initializable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    boardClickHandler(javafx.scene.input.MouseEvent e)
    this method is called when the user clicks on the board.
    void
    this function iterates through the boardStatus and draws the board
    void
    this function is called when the user clicks on the finish my turn button it will clear the changes list in the viewModel it will send the changes that the user did to the viewModel and will try to place the word
    void
    initialize(URL url, ResourceBundle resourceBundle)
    This method is called when the InGame scene is initialized.
    void
    insertPlayerDetails(String name, int id)
    This method place the user details on the left side of the screen and binds the details to the player's details in the ViewModel.
    void
    This method redirects the user to the login page
    void
    this function is called when the user clicks on reset button it will undo all the moves that the user did it will remove all the tiles that the user put on the board and will return them to the hand
    void
    this method is called when a user got a positive answer from the server about his move, and it lets the other players to challenge the server decision.
    void
    This alert is triggered when the host disconnects from the game, it redirects the guest to the login page
    void
     
    void
    this function is called when the user clicks on undo button it will undo the last move that the user did it will remove the last tile that the user put on the board and will return it to the hand
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InGameController

      public InGameController()
  • Method Details

    • boardClickHandler

      public void boardClickHandler(javafx.scene.input.MouseEvent e)
      this method is called when the user clicks on the board. it checks if the click was on a square in the board it checks if the user has the turn to play. it checks if the user has already picked a tile from his hand and if so, it puts the tile on the board
      Parameters:
      e - the mouse event
    • showChallengeAlert

      public void showChallengeAlert(String... words)
      this method is called when a user got a positive answer from the server about his move, and it lets the other players to challenge the server decision.
      Parameters:
      words - the words that were created during the turn
    • showDisconnectionAlert

      public void showDisconnectionAlert()
      This alert is triggered when the host disconnects from the game, it redirects the guest to the login page
    • takeTileFromBag

      public void takeTileFromBag()
    • moveToLoginScene

      public void moveToLoginScene()
      This method redirects the user to the login page
    • initialize

      public void initialize(URL url, ResourceBundle resourceBundle)
      This method is called when the InGame scene is initialized. in this method - all the required parameters are initialized before starting the game.
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      url -
      resourceBundle -
    • insertPlayerDetails

      public void insertPlayerDetails(String name, int id)
      This method place the user details on the left side of the screen and binds the details to the player's details in the ViewModel.
      Parameters:
      name - the name of the player
      id - the id of the player
    • undoBtnClickHandler

      public void undoBtnClickHandler()
      this function is called when the user clicks on undo button it will undo the last move that the user did it will remove the last tile that the user put on the board and will return it to the hand
    • resetBtnClickHandler

      public void resetBtnClickHandler()
      this function is called when the user clicks on reset button it will undo all the moves that the user did it will remove all the tiles that the user put on the board and will return them to the hand
    • drawBoard

      public void drawBoard()
      this function iterates through the boardStatus and draws the board
    • finishMyTurnBtnHandler

      public void finishMyTurnBtnHandler()
      this function is called when the user clicks on the finish my turn button it will clear the changes list in the viewModel it will send the changes that the user did to the viewModel and will try to place the word
    • update

      public void update(Observable o, Object arg)
      Specified by:
      update in interface Observer