Class MainController

    • Constructor Detail

      • MainController

        public MainController()
    • Method Detail

      • set

        public void set​(Parser parser,
                        AppGUI appGUI)
        Set parser and application to controllers
        Parameters:
        parser - parser
        appGUI - application
      • setChat

        public Chat setChat()
        Set chat
        Returns:
        chat set
      • quit

        public void quit()
        Restart the application
      • closeConnection

        public void closeConnection()
        Close the connection
      • sendUsername

        public boolean sendUsername​(String name)
        Send username to server
        Parameters:
        name - username
        Returns:
        if username is valid
      • setMode

        public void setMode​(String mode)
        Send chosen game mode to server
        Parameters:
        mode - game mode
      • setConnection

        public boolean setConnection​(String ip,
                                     int port)
        Setup connection
        Parameters:
        ip - server ip
        port - server port
        Returns:
        if the conenction is set successfully
      • send

        public void send​(String name)
        Send players'actions to server
        Parameters:
        name - player's username
      • getBoard

        public Cell[][] getBoard()
        Get updated board
        Returns:
        Refreshed board
      • getCommand

        public List<Command> getCommand()
        Get commands
        Returns:
        List of available commands
      • getUserInfo

        public List<Player> getUserInfo()
        Get player's information
        Returns:
        List of players'new information
      • getCurrentPlayer

        public String getCurrentPlayer()
        Get the current player
        Returns:
        Player
      • getPlayer

        public String getPlayer()
        Get player's username
        Returns:
        player's username
      • getGamePhase

        public String getGamePhase()
        Get Game Phase
        Returns:
        Current game phase
      • changeScene

        public void changeScene()
        Change the scene
      • update

        public void update​(String message)
        Receive answers from server
        Specified by:
        update in interface Observer<String>
        Parameters:
        message - message sent