Difference between revisions of "GUIContainer"
From Virtual World Web Wiki
(Documentation for the GUIContainer class) |
(Documentation for the GUIContainer class) |
||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | A base class for all hierachical GUI windows and components | ||
+ | |||
* This is a JavaScript visible object | * This is a JavaScript visible object | ||
===Remarks <nowiki>[</nowiki>[{{fullurl:GUIContainer Remarks|action=edit}} edit]<nowiki>]</nowiki>=== | ===Remarks <nowiki>[</nowiki>[{{fullurl:GUIContainer Remarks|action=edit}} edit]<nowiki>]</nowiki>=== | ||
− | {{:GUIContainer Remarks}} | + | {{#ifexist:GUIContainer Remarks|{{:GUIContainer Remarks}}|}} |
===Properties=== | ===Properties=== | ||
− | :{{CSharp| | + | :{{CSharp|float Alpha {get; set;} }} |
:: | :: | ||
::Sets the Alpha on the CanvasGroup of this object (which applies to children) | ::Sets the Alpha on the CanvasGroup of this object (which applies to children) | ||
Line 27: | Line 29: | ||
:: | :: | ||
::Ignore this container for determining if the user can click and rotate their camera. | ::Ignore this container for determining if the user can click and rotate their camera. | ||
+ | |||
+ | :{{CSharp|bool FreezeRotation {get; set;} }} | ||
:{{CSharp|int Height {get; set;} }} | :{{CSharp|int Height {get; set;} }} | ||
Line 39: | Line 43: | ||
:: | :: | ||
::Enables/disables interactivity of this object's CanvasGroup (which applies to children) | ::Enables/disables interactivity of this object's CanvasGroup (which applies to children) | ||
+ | |||
+ | :{{CSharp|bool IsEnabled {get;} }} | ||
:{{CSharp|string Name {get; set;} }} | :{{CSharp|string Name {get; set;} }} | ||
+ | :: | ||
+ | ::The internal name for the GUIContainer | ||
− | :{{CSharp| | + | :{{CSharp|float Opacity {get; set;} }} |
:: | :: | ||
::Sets the opacity (alpha) on the CanvasRenderer of this object (which does not apply to children), allowing for variable transparency effects | ::Sets the opacity (alpha) on the CanvasRenderer of this object (which does not apply to children), allowing for variable transparency effects | ||
Line 57: | Line 65: | ||
:: | :: | ||
::Sets an offset for the Outline component | ::Sets an offset for the Outline component | ||
+ | |||
+ | :{{CSharp|ComponentLayoutExtended PanelLayoutExtended {get;} }} | ||
+ | :: | ||
+ | ::The component's layout properties if it's in a layout group | ||
+ | |||
+ | :{{CSharp|GUIContainer Parent {get; set;} }} | ||
+ | :: | ||
+ | ::Changes the parent within the hierarchy | ||
+ | |||
+ | :{{CSharp|bool PassThrough {get; set;} }} | ||
:{{CSharp|GUIRectTransform RectTransform {get; set;} }} | :{{CSharp|GUIRectTransform RectTransform {get; set;} }} | ||
Line 99: | Line 117: | ||
===Events=== | ===Events=== | ||
− | :{{CSharp|OnAnimate( | + | :{{CSharp|OnAnimate()}} |
:: | :: | ||
::Fires every AnimateInterval milliseconds after StartAnimate() is called. Never called more often than once per render frame | ::Fires every AnimateInterval milliseconds after StartAnimate() is called. Never called more often than once per render frame | ||
− | :{{CSharp|OnDisappeared( | + | :{{CSharp|OnDisappeared()}} |
:: | :: | ||
::Event fired when the Disappear() function completes | ::Event fired when the Disappear() function completes | ||
+ | |||
+ | :{{CSharp|OnEnabled()}} | ||
+ | |||
+ | :{{CSharp|OnResize()}} | ||
+ | :: | ||
+ | ::Event fired each time the size of the component changes | ||
===Methods=== | ===Methods=== | ||
− | :{{CSharp|void Appear(string animationName)}} | + | :{{CSharp|void AbortDelay()}} |
+ | :: | ||
+ | ::Abort the current delay timer | ||
+ | |||
+ | :{{CSharp|void Appear(string animationName {{=}} "")}} | ||
:: | :: | ||
::Causes the container to appear using its animator | ::Causes the container to appear using its animator | ||
Line 120: | Line 148: | ||
::Remove all children from this container | ::Remove all children from this container | ||
− | :{{CSharp|GUIContainer CreateComponent(string type, string componentName, string templateName)}} | + | :{{CSharp|GUIContainer CreateComponent(string type, string componentName {{=}} NULL, string templateName {{=}} NULL)}} |
+ | :: | ||
+ | ::Creates a new component as a child of this container. | ||
− | :{{CSharp|GUIContainer CreateComponentFromTemplate(string templateName, string objectName)}} | + | :{{CSharp|GUIContainer CreateComponentFromTemplate(string templateName, string objectName {{=}} NULL)}} |
:: | :: | ||
::Creates a new component under this container of the specified template | ::Creates a new component under this container of the specified template | ||
− | :{{CSharp|void Delay( | + | :{{CSharp|void Delay(float duration, JSFlexibleFunction callback)}} |
:: | :: | ||
::Call back a particular function after a given number of seconds | ::Call back a particular function after a given number of seconds | ||
Line 134: | Line 164: | ||
::Destroy this container and all children | ::Destroy this container and all children | ||
− | :{{CSharp|void Disappear(string animationName)}} | + | :{{CSharp|void Disappear(string animationName {{=}} "")}} |
:: | :: | ||
::Causes the container to disappear using its animator | ::Causes the container to disappear using its animator | ||
− | :{{CSharp|GUIComponent FindChild(string | + | :{{CSharp|GUIComponent FindChild(string searchName, bool traverse {{=}} false)}} |
+ | :: | ||
+ | ::Finds a child node matching a given name, optionally traversing breadth first through children until it's found. | ||
:{{CSharp|GUIComponent GetComponent(int index)}} | :{{CSharp|GUIComponent GetComponent(int index)}} | ||
Line 152: | Line 184: | ||
::Gets an array of components from this container | ::Gets an array of components from this container | ||
− | :{{CSharp|void Hide( | + | :{{CSharp|void Hide(float fadeDelay {{=}} 0.1, JSFlexibleFunction callback {{=}} NULL)}} |
:: | :: | ||
::Fade component out from visible and to 0 Alpha and not visible | ::Fade component out from visible and to 0 Alpha and not visible | ||
Line 160: | Line 192: | ||
::Ends the sensitivity of a component (see: MakeSensitive) | ::Ends the sensitivity of a component (see: MakeSensitive) | ||
− | :{{CSharp|void MakeSensitive(JSFlexibleFunction callback, bool singleClick)}} | + | :{{CSharp|void MakeSensitive(JSFlexibleFunction callback, bool singleClick {{=}} true)}} |
:: | :: | ||
::Provides a function callback when the user clicks and whether the click occured on or off the object | ::Provides a function callback when the user clicks and whether the click occured on or off the object | ||
− | :{{CSharp| | + | :{{CSharp|float PlayAnimation(string animationName)}} |
+ | :: | ||
+ | ::Causes the container to play a particular animation | ||
− | :{{CSharp| | + | :{{CSharp|void SafeDestroy()}} |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
:: | :: | ||
− | :: | + | ::Destroy this container and all children |
:{{CSharp|void SendToBack()}} | :{{CSharp|void SendToBack()}} | ||
Line 212: | Line 208: | ||
::Move container to back of the parent's ordering - this will cause reordering if done inside LayoutGroups | ::Move container to back of the parent's ordering - this will cause reordering if done inside LayoutGroups | ||
− | :{{CSharp|void Show( | + | :{{CSharp|void Show(float fadeDelay {{=}} 0.1, JSFlexibleFunction callback {{=}} NULL)}} |
:: | :: | ||
::Fade component in from not visible and 0 Alpha to visible and full Alpha | ::Fade component in from not visible and 0 Alpha to visible and full Alpha |
Latest revision as of 17:18, 19 November 2018
A base class for all hierachical GUI windows and components
- This is a JavaScript visible object
Remarks [edit]
Properties
- float Alpha {get; set;}
- Sets the Alpha on the CanvasGroup of this object (which applies to children)
- int AnimateDueTime {get; set;}
- Number of milliseconds to wait after StartAnimate() before the first OnAnimate callback fires
- int AnimateInterval {get; set;}
- Minimum number of milliseconds between Animate calls
- int AnimateTime {get;}
- How many milliseconds since StartAnimate() was called
- bool BlocksRaycasts {get; set;}
- Sets "BlocksRaycast" value on this object's CanvasGroup - without BlocksRaycast, this object will allow objects underneath it to receive clicks and hovers instead of itself
- bool ClickThrough {get; set;}
- Ignore this container for determining if the user can click and rotate their camera.
- bool FreezeRotation {get; set;}
- int Height {get; set;}
- The Y sizeDelta of this container
- bool IgnoreParentGroups {get; set;}
- Allows this object's CanvasGroup to override parent CanvasGroup properties (like BlocksRaycasts or Alpha)
- bool Interactable {get; set;}
- Enables/disables interactivity of this object's CanvasGroup (which applies to children)
- bool IsEnabled {get;}
- string Name {get; set;}
- The internal name for the GUIContainer
- float Opacity {get; set;}
- Sets the opacity (alpha) on the CanvasRenderer of this object (which does not apply to children), allowing for variable transparency effects
- bool Outline {get; set;}
- Apply an Outline component to this container
- Color32 OutlineColor {get; set;}
- Sets a color for the Outline component
- JSVector2 OutlineOffset {get; set;}
- Sets an offset for the Outline component
- ComponentLayoutExtended PanelLayoutExtended {get;}
- The component's layout properties if it's in a layout group
- GUIContainer Parent {get; set;}
- Changes the parent within the hierarchy
- bool PassThrough {get; set;}
- GUIRectTransform RectTransform {get; set;}
- Reference to the container's RectTransform
- bool Shadow {get; set;}
- Apply a Shadow component to this container
- Color32 ShadowColor {get; set;}
- Sets a color for the Shadow component
- JSVector2 ShadowOffset {get; set;}
- Sets an offset for the Shadow component
- int SubComponents {get;}
- Number of child components
- bool Visible {get; set;}
- Whether or not to display this object and its children
- int Width {get; set;}
- The X sizeDelta of this container
- Rectangle WorldRect {get;}
- Gets the screen-space coordinates of this container and returns them as a rectangle {x, y, width, height}
- int X {get; set;}
- The anchored X position of this container
- int Y {get; set;}
- The anchored Y position of this container
Events
- OnAnimate()
- Fires every AnimateInterval milliseconds after StartAnimate() is called. Never called more often than once per render frame
- OnDisappeared()
- Event fired when the Disappear() function completes
- OnEnabled()
- OnResize()
- Event fired each time the size of the component changes
Methods
- void AbortDelay()
- Abort the current delay timer
- void Appear(string animationName = "")
- Causes the container to appear using its animator
- void BringToFront()
- Move container to front of the parent's ordering - this will cause reordering if done inside LayoutGroups
- void ClearChildren()
- Remove all children from this container
- GUIContainer CreateComponent(string type, string componentName = NULL, string templateName = NULL)
- Creates a new component as a child of this container.
- GUIContainer CreateComponentFromTemplate(string templateName, string objectName = NULL)
- Creates a new component under this container of the specified template
- void Delay(float duration, JSFlexibleFunction callback)
- Call back a particular function after a given number of seconds
- void Destroy()
- Destroy this container and all children
- void Disappear(string animationName = "")
- Causes the container to disappear using its animator
- GUIComponent FindChild(string searchName, bool traverse = false)
- Finds a child node matching a given name, optionally traversing breadth first through children until it's found.
- GUIComponent GetComponent(int index)
- Returns the indexed component from this container
- GUIComponent GetComponentByName(string componentName)
- Returns the first child component with a given name
- GUIComponent[] GetComponents()
- Gets an array of components from this container
- void Hide(float fadeDelay = 0.1, JSFlexibleFunction callback = NULL)
- Fade component out from visible and to 0 Alpha and not visible
- bool MakeNumb()
- Ends the sensitivity of a component (see: MakeSensitive)
- void MakeSensitive(JSFlexibleFunction callback, bool singleClick = true)
- Provides a function callback when the user clicks and whether the click occured on or off the object
- float PlayAnimation(string animationName)
- Causes the container to play a particular animation
- void SafeDestroy()
- Destroy this container and all children
- void SendToBack()
- Move container to back of the parent's ordering - this will cause reordering if done inside LayoutGroups
- void Show(float fadeDelay = 0.1, JSFlexibleFunction callback = NULL)
- Fade component in from not visible and 0 Alpha to visible and full Alpha
- void StartAnimate()
- Start the animate timer callbacks
- void StopAnimate()
- Stop the animate timer callbacks