Interface SimulationProxy
-
public interface SimulationProxyThe 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSimulationProxy.ButtonTypeThis is to identify the buttons
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidattachToGameWindow(GameWindow gameWindow)Attach this simulation proxy to a specific game window.voidattachToGameWindow(GameWindow gameWindow, boolean stopWithWindowClose)Attach this simulation proxy to a specific game window.voidbuttonPressed(SimulationProxy.ButtonType type)This is called when a button is pressed by the uservoidclearCell(int x, int y)Clear all entities in the given cell.voidentityValueChange(String name, String value)This function gets called when a user changes a value or fires a function in the uivoidrefreshTaskInformation()This gets called by the user to refresh task status information.voidselectedEntityChanged(String name)This gets called when the user changes the selected elementvoidselectedSimulationEntityChange(SimulationTreeNode node)This function gets called when the user selects a different nodevoidsimulationSpeedChange(int value)This is called if the speed slider is changed by the uservoidspawnEntityAt(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.voidwindowClosed()Called when the window is closing.
-
-
-
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 tostopWithWindowClose- Iftruethe 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 instantiatex- coordinatey- coordinate
-
clearCell
void clearCell(int x, int y)Clear all entities in the given cell.- Parameters:
x- coordinatey- coordinate
-
selectedSimulationEntityChange
void selectedSimulationEntityChange(SimulationTreeNode node)
This function gets called when the user selects a different node- Parameters:
node- The node with was selected
-
-