Class UIHandler
Controls the general UI (like top and bottom bars). Also references the other main panels of the UI.
Inheritance
object
UIHandler
Namespace: AS2.UI
Assembly: .dll
Syntax
public class UIHandler : MonoBehaviour
Fields
|
Edit this page
View Source
Declaration
public UIHandler.UITool activeTool
Field Value
|
Edit this page
View Source
Declaration
public Button button_backgroundGridActive
Field Value
|
Edit this page
View Source
Declaration
public Button button_bondsActive
Field Value
|
Edit this page
View Source
Declaration
public Button button_circuitViewType
Field Value
|
Edit this page
View Source
Declaration
public Button button_collisionCheck
Field Value
|
Edit this page
View Source
Declaration
public Button button_exit
Field Value
|
Edit this page
View Source
Declaration
public Button button_jumpCut
Field Value
|
Edit this page
View Source
Declaration
public Button button_pSetPositioning
Field Value
|
Edit this page
View Source
Declaration
public Button button_playPause
Field Value
|
Edit this page
View Source
Declaration
public Button button_settings
Field Value
|
Edit this page
View Source
Declaration
public Button button_stepBack
Field Value
|
Edit this page
View Source
Declaration
public Button button_stepForward
Field Value
|
Edit this page
View Source
Declaration
public Button button_toolAdd
Field Value
|
Edit this page
View Source
Declaration
public Button button_toolAddObject
Field Value
|
Edit this page
View Source
Declaration
public Button button_toolMove
Field Value
|
Edit this page
View Source
Declaration
public Button button_toolPSetMove
Field Value
|
Edit this page
View Source
Declaration
public Button button_toolRemove
Field Value
|
Edit this page
View Source
Declaration
public Button button_toolStandard
Field Value
|
Edit this page
View Source
Declaration
public Button button_viewType
Field Value
|
Edit this page
View Source
dropdown_chirality
Declaration
public TMP_Dropdown dropdown_chirality
Field Value
Type |
Description |
TMP_Dropdown |
|
|
Edit this page
View Source
dropdown_compass
Declaration
public TMP_Dropdown dropdown_compass
Field Value
Type |
Description |
TMP_Dropdown |
|
|
Edit this page
View Source
frameMargin
Margin around the particle system when framing the
system in the viewport.
Declaration
Field Value
|
Edit this page
View Source
image_circuitViewType
Declaration
public Image image_circuitViewType
Field Value
|
Edit this page
View Source
image_pSetPositioning
Declaration
public Image image_pSetPositioning
Field Value
|
Edit this page
View Source
Declaration
public Image image_playPauseButton
Field Value
|
Edit this page
View Source
image_viewType
Declaration
public Image image_viewType
Field Value
|
Edit this page
View Source
initializationUI
Declaration
public InitializationUIHandler initializationUI
Field Value
|
Edit this page
View Source
objectUI
Declaration
public ObjectUIHandler objectUI
Field Value
|
Edit this page
View Source
overlayColor_active
Declaration
private Color overlayColor_active
Field Value
|
Edit this page
View Source
overlayColor_inactive
Declaration
private Color overlayColor_inactive
Field Value
|
Edit this page
View Source
particleUI
Declaration
public ParticleUIHandler particleUI
Field Value
|
Edit this page
View Source
settingsUI
Declaration
public SettingsUIHandler settingsUI
Field Value
|
Edit this page
View Source
sim
Declaration
public AmoebotSimulator sim
Field Value
|
Edit this page
View Source
slider_round
Declaration
public Slider slider_round
Field Value
|
Edit this page
View Source
slider_speed
Declaration
public Slider slider_speed
Field Value
|
Edit this page
View Source
slider_speed_values
Declaration
private float[] slider_speed_values
Field Value
|
Edit this page
View Source
sprite_circuitViewTypeCircuitsDisabled
Declaration
public Sprite sprite_circuitViewTypeCircuitsDisabled
Field Value
|
Edit this page
View Source
sprite_circuitViewTypeCircuitsEnabled
Declaration
public Sprite sprite_circuitViewTypeCircuitsEnabled
Field Value
|
Edit this page
View Source
sprite_pSetPositioning_auto
Declaration
public Sprite sprite_pSetPositioning_auto
Field Value
|
Edit this page
View Source
sprite_pSetPositioning_auto2D
Declaration
public Sprite sprite_pSetPositioning_auto2D
Field Value
|
Edit this page
View Source
sprite_pSetPositioning_def
Declaration
public Sprite sprite_pSetPositioning_def
Field Value
|
Edit this page
View Source
sprite_pSetPositioning_line
Declaration
public Sprite sprite_pSetPositioning_line
Field Value
|
Edit this page
View Source
sprite_pause
Declaration
public Sprite sprite_pause
Field Value
|
Edit this page
View Source
sprite_play
Declaration
public Sprite sprite_play
Field Value
|
Edit this page
View Source
sprite_viewTypeCircular
Declaration
public Sprite sprite_viewTypeCircular
Field Value
|
Edit this page
View Source
sprite_viewTypeHexagonal
Declaration
public Sprite sprite_viewTypeHexagonal
Field Value
|
Edit this page
View Source
sprite_viewTypeHexagonalCirc
Declaration
public Sprite sprite_viewTypeHexagonalCirc
Field Value
|
Edit this page
View Source
text_round
Declaration
public TextMeshProUGUI text_round
Field Value
Type |
Description |
TextMeshProUGUI |
|
|
Edit this page
View Source
text_speed
Declaration
public TextMeshProUGUI text_speed
Field Value
Type |
Description |
TextMeshProUGUI |
|
|
Edit this page
View Source
toggle_alwaysUpdateWhenRoundSliderIsChanged
Declaration
public Toggle toggle_alwaysUpdateWhenRoundSliderIsChanged
Field Value
|
Edit this page
View Source
Declaration
private Color toolColor_active
Field Value
|
Edit this page
View Source
Declaration
private Color toolColor_inactive
Field Value
|
Edit this page
View Source
Declaration
private List<GameObject> tools_initMode
Field Value
Type |
Description |
List<GameObject> |
|
|
Edit this page
View Source
Declaration
private List<GameObject> tools_playMode
Field Value
Type |
Description |
List<GameObject> |
|
|
Edit this page
View Source
topAndBottomBarFraction
Fraction of the viewport height taken up by the top
and bottom bar, used for framing the system in view.
Declaration
public float topAndBottomBarFraction
Field Value
|
Edit this page
View Source
ui
Declaration
Field Value
Type |
Description |
GameObject |
|
Methods
|
Edit this page
View Source
Centers the camera to the particles. Sets the (0,0) position if there are no particles.
Declaration
public void Button_CameraCenterPressed()
|
Edit this page
View Source
Called when the cut rounds button has been pressed.
Deletes the history of later rounds than the currently active round.
Declaration
public void Button_CutPressed()
|
Edit this page
View Source
Declaration
public void Button_ExitPressed()
|
Edit this page
View Source
Changes the camera position and zoom level such that the whole
particle system is in frame.
Declaration
public void Button_FrameSystemPressed()
|
Edit this page
View Source
Called when the open button has been pressed.
Opens the interface to load a saved simulator configuration.
Declaration
public void Button_OpenPressed()
|
Edit this page
View Source
Called when the save log button has been pressed.
Saves the log to a file.
Declaration
public void Button_PrintLogToFilePressed()
|
Edit this page
View Source
Called when the save button has been pressed.
Saves the current simulator configuration.
Declaration
public void Button_SavePressed()
|
Edit this page
View Source
Called when the screenshot button has been pressed.
Makes a screenshot of the simulation and saves it to a file
selected via a file browser.
Declaration
public void Button_ScreenshotPressed()
|
Edit this page
View Source
Called when the step back button has been pressed.
Goes back a round if the sim is not running.
Declaration
public void Button_StepBackPressed()
|
Edit this page
View Source
Called when the step forward button has been pressed.
Goes forward a round if the sim is not running.
Declaration
public void Button_StepForwardPressed()
|
Edit this page
View Source
Toggles the bonds on/off.
Declaration
public void Button_ToggleBondsPressed()
|
Edit this page
View Source
Toggles the circuit view on/off.
Declaration
public void Button_ToggleCircuitViewPressed()
|
Edit this page
View Source
Toggles the collision check on/off.
Declaration
public void Button_ToggleCollisionCheck()
|
Edit this page
View Source
Toggles the positioning mode of the partition sets.
Declaration
public void Button_TogglePSetPositioningPressed()
|
Edit this page
View Source
Toggles the view type (hexagon, circle, graph, ...).
Declaration
public void Button_ToggleViewPressed()
|
Edit this page
View Source
Selects the add object tool.
Declaration
public void Button_ToolAddObjectPressed()
|
Edit this page
View Source
Declaration
public void Button_ToolAddPressed()
|
Edit this page
View Source
Declaration
public void Button_ToolMovePressed()
|
Edit this page
View Source
Selects the partition set move tool.
Declaration
public void Button_ToolPSetMovePressed()
|
Edit this page
View Source
Declaration
public void Button_ToolRemovePressed()
|
Edit this page
View Source
Selects the standard selection tool.
Declaration
public void Button_ToolStandardPressed()
|
Edit this page
View Source
Returns the color used to display that the setting is active.
Declaration
public Color GetButtonColor_Active()
Returns
Type |
Description |
Color |
The active overlay color.
|
|
Edit this page
View Source
Returns the color used to display that the setting is inactive.
Declaration
public Color GetButtonColor_Inactive()
Returns
Type |
Description |
Color |
The inactive overlay color.
|
|
Edit this page
View Source
GetDropdownValue_Chirality()
Gets the chirality value from the corresponding dropdown UI element.
Declaration
public Initialization.Chirality GetDropdownValue_Chirality()
Returns
Type |
Description |
Initialization.Chirality |
The selected chirality value. Can be Random, Clockwise or
Counterclockwise.
|
|
Edit this page
View Source
GetDropdownValue_Compass()
Gets the compass dir value from the corresponding dropdown UI element.
Declaration
public Initialization.Compass GetDropdownValue_Compass()
Returns
Type |
Description |
Initialization.Compass |
The selected compass direction. Can be any cardinal direction
or Random.
|
|
Edit this page
View Source
Generates the tooltip matching the current partition set
view type.
Declaration
private string GetPSetViewModeTooltip()
Returns
Type |
Description |
string |
The new tooltip message for the partition set
view type button.
|
|
Edit this page
View Source
Generates the tooltip matching the current view type.
Declaration
private string GetViewModeTooltip()
Returns
Type |
Description |
string |
The new tooltip message for the partition set
view type button.
|
|
Edit this page
View Source
Makes the top right buttons that should not be used
during Init Mode not interactable.
(Originally this method has hidden the button.)
Declaration
public void HideTopRightButtons()
|
Edit this page
View Source
HideUI()
Hides the UI. Use this for things like screenshots.
Declaration
|
Edit this page
View Source
InitUI()
Initializes the part of the visual interface that is controlled by this class.
Declaration
|
Edit this page
View Source
JumpToRound(int)
Jumps to a certain round. The UI is updated afterwards.
Declaration
private void JumpToRound(int newRound)
Parameters
Type |
Name |
Description |
int |
newRound |
The round to jump to. Must be in the
range of valid rounds.
|
|
Edit this page
View Source
NotifyPlayPause(bool)
Notifies the UI handler that the play/pause has been toggled.
Declaration
public void NotifyPlayPause(bool running)
Parameters
Type |
Name |
Description |
bool |
running |
The currently active running state. True if
the simulation is running.
|
|
Edit this page
View Source
Processes all the hotkeys that are included in the simulator.
Note: You can change the hotkeys if you want.
Declaration
private void ProcessInputs()
|
Edit this page
View Source
RegisterSim(AmoebotSimulator)
Registers the simulator at this object.
Declaration
public void RegisterSim(AmoebotSimulator sim)
Parameters
|
Edit this page
View Source
Sets the background color of an arbitrary standard button.
Declaration
private void SetButtonColor(Button button, Color color)
Parameters
Type |
Name |
Description |
Button |
button |
The button to change.
|
Color |
color |
The color the button should have.
|
|
Edit this page
View Source
Makes the top right buttons that should not be used
during Init Mode interactable.
(Originally this method has shown the buttons.)
Declaration
public void ShowTopRightButtons()
|
Edit this page
View Source
ShowUI()
Declaration
|
Edit this page
View Source
SliderRound_onDragEnd()
Called when the round slider drag has been finished. Alternative to SliderRound_onValueChanged().
Changes the round of the simulation.
Declaration
public void SliderRound_onDragEnd()
|
Edit this page
View Source
SliderRound_onValueChanged()
Called when the round slider value has been changed. Alternative to SliderRound_onDragEnd().
Changes the round of the simulation.
Declaration
public void SliderRound_onValueChanged()
|
Edit this page
View Source
SliderSpeed_onValueChanged()
Called when the speed slider value has been changed.
Changes the speed of the simulation.
Declaration
public void SliderSpeed_onValueChanged()
|
Edit this page
View Source
Start()
Declaration
|
Edit this page
View Source
ToggleUI()
Toggles the UI visibility.
Declaration
|
Edit this page
View Source
Update()
Update loop of the UI Handler. Calls UpdateUI and updates the particle and object panel.
Also processes the inputs for hotkeys.
Declaration
|
Edit this page
View Source
Updates the color of the tool buttons. The active tool is highlighted.
Declaration
private void UpdateTools()
|
Edit this page
View Source
Tries to update the tooltip message of the Tooltip
component in the given GameObject.
Declaration
private void UpdateTooltip(GameObject go, string message)
Parameters
Type |
Name |
Description |
GameObject |
go |
The GameObject that has a Tooltip.
|
string |
message |
The new tooltip message.
|
|
Edit this page
View Source
UpdateUI(bool)
Updates the UI without a forced round slider update.
Declaration
private void UpdateUI(bool running)
Parameters
Type |
Name |
Description |
bool |
running |
Indicates whether or not the simulation
is currently running.
|
|
Edit this page
View Source
UpdateUI(bool, bool)
Updates the UI (things like enable/disable buttons, set sliders, update rounds, set button colors, etc.).
Declaration
public void UpdateUI(bool running, bool forceRoundSliderUpdate)
Parameters
Type |
Name |
Description |
bool |
running |
Indicates whether or not the simulation
is currently running.
|
bool |
forceRoundSliderUpdate |
Indicates whether the round slider must be
updated for a reason other than the simulation running (like pressing the
step forward or step back button).
|