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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SimulationProxy.ButtonType
This is to identify the buttons
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
attachToGameWindow(GameWindow gameWindow)
Attach this simulation proxy to a specific game window.void
attachToGameWindow(GameWindow gameWindow, boolean stopWithWindowClose)
Attach this simulation proxy to a specific game window.void
buttonPressed(SimulationProxy.ButtonType type)
This is called when a button is pressed by the uservoid
clearCell(int x, int y)
Clear all entities in the given cell.void
entityValueChange(String name, String value)
This function gets called when a user changes a value or fires a function in the uivoid
refreshTaskInformation()
This gets called by the user to refresh task status information.void
selectedEntityChanged(String name)
This gets called when the user changes the selected elementvoid
selectedSimulationEntityChange(SimulationTreeNode node)
This function gets called when the user selects a different nodevoid
simulationSpeedChange(int value)
This is called if the speed slider is changed by the uservoid
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.void
windowClosed()
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
- Iftrue
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 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
-
-