Package view

Class GameController

java.lang.Object
view.GameController

public class GameController extends Object
  • Constructor Details

    • GameController

      public GameController()
      The GameController function is the main function that controls all the game's logic. It takes in a String word, an ArrayList<Integer> indexRow, and an ArrayList<Integer> indexCol as parameters. The GameController function then checks if the word is valid by calling on checkWord() from WordChecker class. If it is valid, it will call on updateBoard() from Board class to update board with new tiles and score for player who played that turn.
  • Method Details

    • initiatePlayerName

      public void initiatePlayerName()
      The initiatePlayerName function is used to create the labels for each player's name.
    • initiatePlayerScore

      public void initiatePlayerScore()
      The initiatePlayerScore function creates the labels for each player's score.
    • initiatePlayerButton

      public void initiatePlayerButton()
      The initiatePlayerButton function creates the buttons that will be used in the game.
    • toggleStartButton

      public void toggleStartButton()
      The toggleStartButton function is used to toggle the visibility of the startGame button. This function is called when a game has ended, and it allows for another game to be started.
    • initializeHostAction

      public void initializeHostAction()
      The initializeHostAction function is called in the initialize function of the GameController class. It sets up a listener for changes to the messageFromHost property of a player object, which is used by players to communicate with each other and with their host. The listener calls handleHostAction when it detects that there has been an update to this property, passing along whatever new value was assigned to it as an argument.
    • initializeBoardUpdateAction

      public void initializeBoardUpdateAction()
      The initializeBoardUpdateAction function is responsible for updating the board whenever a new image is selected. It does this by binding the imagePath property to the viewSharedData's ViewModel's ImagePath property, and then adding a listener to that bound property. Whenever there is an update in that bound property, it calls updateBoardCellImage with whatever new value was passed into it as an argument.
    • updateBoardCellImage

      public void updateBoardCellImage(String newAction)
      The updateBoardCellImage function is used to update the image of a cell on the board.
      Parameters:
      newAction - newAction Update the board cell image
    • handleHostAction

      public void handleHostAction(String action)
      The handleHostAction function is a function that handles the actions sent from the host. The function receives an action string and performs a switch case on it, performing different actions depending on what action was received.
      Parameters:
      action - action Determine which action to take
    • bindAll

      public void bindAll()
    • bindButtons

      public void bindButtons()
    • setViewSharedData

      public void setViewSharedData(ViewSharedData viewSharedData)
    • Submit

      public void Submit() throws IOException
      Throws:
      IOException
    • challenge

      public void challenge()
    • exit

      public void exit()
    • SwapTiles

      public void SwapTiles()
    • SkipTurn

      public void SkipTurn()
    • squareClickHandler

      public void squareClickHandler()
    • start

      public void start() throws IOException
      Throws:
      IOException
    • sendStartToServer

      public void sendStartToServer()
    • loadScene

      public void loadScene(String sceneName) throws IOException
      Throws:
      IOException
    • loadBoard

      public void loadBoard() throws IOException
      Throws:
      IOException