Class WorldSpaceUIHandler
Controls the world space UI overlay (which shows the attributes of the particles).
Inheritance
Namespace: AS2.UI
Assembly: .dll
Syntax
public class WorldSpaceUIHandler : MonoBehaviour
Constructors
| Edit this page View SourceWorldSpaceUIHandler()
Declaration
public WorldSpaceUIHandler()
Fields
| Edit this page View SourceasciiDirectionArrows
Declaration
private Dictionary<Direction, string> asciiDirectionArrows
Field Value
| Type | Description |
|---|---|
| Dictionary<Direction, string> |
button_hideOverlay
Declaration
public Button button_hideOverlay
Field Value
| Type | Description |
|---|---|
| Button |
cameraRotation
Declaration
private float cameraRotation
Field Value
| Type | Description |
|---|---|
| float |
color_particleTextBackgroundClockwise
Declaration
private Color color_particleTextBackgroundClockwise
Field Value
| Type | Description |
|---|---|
| Color |
color_particleTextBackgroundCounterClockwise
Declaration
private Color color_particleTextBackgroundCounterClockwise
Field Value
| Type | Description |
|---|---|
| Color |
color_particleTextBackgroundDefault
Declaration
private Color color_particleTextBackgroundDefault
Field Value
| Type | Description |
|---|---|
| Color |
color_particleTextBackgroundFalse
Declaration
private Color color_particleTextBackgroundFalse
Field Value
| Type | Description |
|---|---|
| Color |
color_particleTextBackgroundTrue
Declaration
private Color color_particleTextBackgroundTrue
Field Value
| Type | Description |
|---|---|
| Color |
display_identifier
Declaration
private string display_identifier
Field Value
| Type | Description |
|---|---|
| string |
display_isVisible
Declaration
private bool display_isVisible
Field Value
| Type | Description |
|---|---|
| bool |
display_type
Declaration
private WorldSpaceUIHandler.TextType display_type
Field Value
| Type | Description |
|---|---|
| WorldSpaceUIHandler.TextType |
font_arrows
Declaration
public TMP_FontAsset font_arrows
Field Value
| Type | Description |
|---|---|
| TMP_FontAsset |
font_basic
Declaration
public TMP_FontAsset font_basic
Field Value
| Type | Description |
|---|---|
| TMP_FontAsset |
font_circles
Declaration
public TMP_FontAsset font_circles
Field Value
| Type | Description |
|---|---|
| TMP_FontAsset |
go_worldSpaceUI
Declaration
public GameObject go_worldSpaceUI
Field Value
| Type | Description |
|---|---|
| GameObject |
instance
Declaration
public static WorldSpaceUIHandler instance
Field Value
| Type | Description |
|---|---|
| WorldSpaceUIHandler |
isVisible
Declaration
private bool isVisible
Field Value
| Type | Description |
|---|---|
| bool |
particleTextUIData
Declaration
public Dictionary<IParticleState, WorldSpaceUIHandler.ParticleTextUIData> particleTextUIData
Field Value
| Type | Description |
|---|---|
| Dictionary<IParticleState, WorldSpaceUIHandler.ParticleTextUIData> |
pool_particleTextUI
Declaration
private Stack<GameObject> pool_particleTextUI
Field Value
| Type | Description |
|---|---|
| Stack<GameObject> |
showCompassDirArrows
Declaration
public bool showCompassDirArrows
Field Value
| Type | Description |
|---|---|
| bool |
tempParticleStack
Declaration
private Stack<IParticleState> tempParticleStack
Field Value
| Type | Description |
|---|---|
| Stack<IParticleState> |
Methods
| Edit this page View SourceAddParticleTextUI(IParticleState, Vector2, bool)
Adds a particle to the overlay system.
Declaration
public GameObject AddParticleTextUI(IParticleState particle, Vector2 particlePosition, bool isVisible = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle to add. |
| Vector2 | particlePosition | The initial position of the particle. |
| bool | isVisible | If the particle overlay is initially visible. |
Returns
| Type | Description |
|---|---|
| GameObject | The GameObject holding the overlay text. |
DisplayText(TextType, string, bool)
Displays the overlay over every particle that has the given attribute/value/text.
Declaration
public void DisplayText(WorldSpaceUIHandler.TextType type, string identifier, bool showOverlay = true)
Parameters
| Type | Name | Description |
|---|---|---|
| WorldSpaceUIHandler.TextType | type | The type of data to display. |
| string | identifier | Identifier of the field to be displayed, e.g., an attribute name. |
| bool | showOverlay | Determines whether the overlay should be shown. |
DisplayTextForParticle(IParticleState)
Displays the currently set overlay for a given particle.
Declaration
private void DisplayTextForParticle(IParticleState particle)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle for which the overlay should be displayed. |
HideAll()
Hides the world space UI and clears the line drawer. Call ShowVisible() to show the current overlay again.
Declaration
public void HideAll()
IsActive()
Checks if the UI is active.
Declaration
public bool IsActive()
Returns
| Type | Description |
|---|---|
| bool |
|
ParticleUpdate(IParticleState, Vector3)
Called by every particle after their regular movement updates.
Declaration
public void ParticleUpdate(IParticleState particle, Vector3 curPos)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle that should be updated. |
| Vector3 | curPos | The current world position of the particle. |
PoolCreate_particleTextUI(IParticleState, bool)
Makes a new text overlay GameObject available using the pooling mechanism.
Declaration
public GameObject PoolCreate_particleTextUI(IParticleState particle, bool isVisible)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle to which the text overlay should belong. |
| bool | isVisible | Determines whether the overlay element should be visible. |
Returns
| Type | Description |
|---|---|
| GameObject | The new text overlay GameObject. |
PoolRealease_particleTextUI(IParticleState)
Releases the text overlay element belonging to the given particle and returns it to the pool.
Declaration
public void PoolRealease_particleTextUI(IParticleState particle)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle whose overlay should be released. |
Refresh()
Refreshes the overlay if it is already shown. Call this when something has changed in the shown attributes.
Declaration
public void Refresh()
RemoveParticleTextUI(IParticleState)
Removes a particle from the overlay system.
Declaration
public bool RemoveParticleTextUI(IParticleState particle)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
SetCameraRotation(float)
Sets the rotation of the particle overlay. Use this in combination with the global rotation of the main camera.
Declaration
public void SetCameraRotation(float cameraRotationDegrees)
Parameters
| Type | Name | Description |
|---|---|---|
| float | cameraRotationDegrees | The main camera's current rotation in degrees. |
ShowVisible()
Shows the world space UI (all elements that are flagged as visible). This is the default value. Call HideAll() to hide it.
Declaration
public void ShowVisible()
Start()
Declaration
private void Start()
SwitchInitSimMode(bool)
Listener for the Init/Simulation Mode switch event. Disables the attribute overlay when the Mode is changed.
Declaration
private void SwitchInitSimMode(bool initMode)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | initMode | Whether Init Mode was opened (the value is ignored). |
UpdateParticleText(IParticleState, bool)
Updates the particle overlay for a single particle with a "True" or "False" text. Also sets a color based on the true/false value.
Declaration
private void UpdateParticleText(IParticleState particle, bool isTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle for which the overlay should be updated. |
| bool | isTrue | The truth value to display. |
UpdateParticleText(IParticleState, string)
Updates the particle overlay for a single particle with a text.
Declaration
private void UpdateParticleText(IParticleState particle, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle for which the overlay should be updated. |
| string | text | The text to display. |
UpdateParticleTextPosition(IParticleState, Vector2)
Updates the position of the particle overlay.
Declaration
private void UpdateParticleTextPosition(IParticleState particle, Vector2 particlePosition)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle for which the position of the overlay should be updated. |
| Vector2 | particlePosition | The new overlay position. |
UpdateParticleText_Chirality(IParticleState, bool)
Updates the particle overlay for a single particle with a text showing its chirality. The chirality is displayed using an ASCII character that shows a circular arrow.
Declaration
private void UpdateParticleText_Chirality(IParticleState particle, bool counterClockwise)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle for which the overlay should be updated. |
| bool | counterClockwise | The chirality to set. |
UpdateParticleText_CompassDir(IParticleState, Direction)
Updates the particle overlay for a single particle with a text showing its compass direction. The direction is displayed using an ASCII character that shows an arrow, if this is enabled.
Declaration
private void UpdateParticleText_CompassDir(IParticleState particle, Direction compassDir)
Parameters
| Type | Name | Description |
|---|---|---|
| IParticleState | particle | The particle for which the overlay should be updated. |
| Direction | compassDir | The compass dir to display. |