java.lang.Object
View.bookscrabbleapp.InGameController
- All Implemented Interfaces:
Observer,javafx.fxml.Initializable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidboardClickHandler(javafx.scene.input.MouseEvent e) this method is called when the user clicks on the board.voidthis function iterates through the boardStatus and draws the boardvoidthis 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 wordvoidinitialize(URL url, ResourceBundle resourceBundle) This method is called when the InGame scene is initialized.voidinsertPlayerDetails(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.voidThis method redirects the user to the login pagevoidthis 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 handvoidshowChallengeAlert(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.voidThis alert is triggered when the host disconnects from the game, it redirects the guest to the login pagevoidvoidthis 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 handvoidupdate(Observable o, Object arg)
-
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
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
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:
initializein interfacejavafx.fxml.Initializable- Parameters:
url-resourceBundle-
-
insertPlayerDetails
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 playerid- 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
-