Interface SimulationProxy


  • public interface SimulationProxy
    The SimulationProxy interface. This is used for communication most between the UI and the simulation.

    First the attachToGameWindow(GameWindow) needs to be called to establish the connection. This should set up all communication channels from the Simulation to the UI.

    The other methods are communication channels from the UI the Simulation.

    Version:
    1.0
    Author:
    Tobias Wältken, Tim Neumann
    • Method Detail

      • attachToGameWindow

        void attachToGameWindow​(GameWindow gameWindow)
        Attach this simulation proxy to a specific game window.
        Parameters:
        gameWindow - The game window to attach to
      • attachToGameWindow

        void attachToGameWindow​(GameWindow gameWindow,
                                boolean stopWithWindowClose)
        Attach this simulation proxy to a specific game window.
        Parameters:
        gameWindow - The game window to attach to
        stopWithWindowClose - If true the simulation will stop when the attached window is closed
      • windowClosed

        void windowClosed()
        Called when the window is closing.
      • buttonPressed

        void buttonPressed​(SimulationProxy.ButtonType type)
        This is called when a button is pressed by the user
        Parameters:
        type - The type of the pressed button
      • simulationSpeedChange

        void simulationSpeedChange​(int value)
        This is called if the speed slider is changed by the user
        Parameters:
        value - The new selected speed
      • selectedEntityChanged

        void selectedEntityChanged​(String name)
        This gets called when the user changes the selected element
        Parameters:
        name - The name of the selected element
      • refreshTaskInformation

        void refreshTaskInformation()
        This gets called by the user to refresh task status information.

        Calling this must verify the task.

      • spawnEntityAt

        void spawnEntityAt​(String typeName,
                           int x,
                           int y)
        Spawn a new entity of the given type at the given position and bind the program to this entity.
        Parameters:
        typeName - the entity type to instantiate
        x - coordinate
        y - coordinate
      • clearCell

        void clearCell​(int x,
                       int y)
        Clear all entities in the given cell.
        Parameters:
        x - coordinate
        y - coordinate
      • selectedSimulationEntityChange

        void selectedSimulationEntityChange​(SimulationTreeNode node)
        This function gets called when the user selects a different node
        Parameters:
        node - The node with was selected
      • entityValueChange

        void entityValueChange​(String name,
                               String value)
        This function gets called when a user changes a value or fires a function in the ui
        Parameters:
        name - The name of the setting
        value - The new user selected value