wiki.sine.space | sinespace

Difference between revisions of "Scripting/SUIDropdown"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/suidropdown")
 
Line 1: Line 1:
=Members=
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/suidropdown
{{ScriptFunction|void|AddOptions|(Table options)|Add multiple options to the options of the Dropdown.|5=<pre>Space.Host.ExecutingObject.UIDropdown.AddOptions({"option1","option2","option3"})</pre>}}
+
 
+
{{ScriptFunction|void|ClearOptions|()|Clear the list of options in the Dropdown.|5=<pre>Space.Host.ExecutingObject.UIDropdown.ClearOptions()</pre>}}
+
 
+
{{ScriptFunction|void|Hide|()|Hide the dropdown list.|5=<pre>Space.Host.ExecutingObject.UIDropdown.Hide()</pre>}}
+
 
+
{{ScriptFunction|void|OnValueChanged|(Closure callback)|Bind a function to handle the event that is invoked when when a user has clicked one of the options in the dropdown list.|5=<pre>https://wiki.sine.space/index.php?title=Scripting/SUIDropdown</pre>}}
+
 
+
{{ScriptFunction|void|RefreshShownValue|()|Refreshes the text and image (if available) of the currently selected option.If you have modified the list of options, you should call this method afterwards to ensure that the visual state of the dropdown corresponds to the updated options.|5=<pre>Space.Host.ExecutingObject.UIDropdown.RefreshShownValue()</pre>}}
+
 
+
{{ScriptFunction|void|Show|()|Show the dropdown list.|5=<pre>Space.Host.ExecutingObject.UIDropdown.Show()</pre>}}
+
 
+
 
+
 
+
=Properties=
+
 
+
{{ScriptFunction|SUIImage|CaptionImage|{ get; set; }|The Image component to hold the image of the currently selected option.|5= <pre>captionImage = Space.Host.ExecutingObject.UIDropdown.CaptionImage</pre>}}
+
 
+
{{ScriptFunction|SUIText|CaptionText|{ get; set; }|The Text component to hold the text of the currently selected option.|5= <pre>captionText = Space.Host.ExecutingObject.UIDropdown.CaptionText
+
captionText.Text = "new caption"</pre>}}
+
 
+
{{ScriptFunction|bool|Interactable|{ get; set; }|Is this UIDropdown interactable?|5= <pre>Space.Host.ExecutingObject.UIDropdown.Interactable = true</pre>|6=<pre>--clicking this object will toggle a UIDropdown's interactable status
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
dropdown = Space.Host.GetReference("dropdown").UIDropdown
+
--make sure to add this reference to the Scripting Runtime component
+
 
+
 
+
OnClick = function()
+
dropdown.Interactable =  not dropdown.Interactable
+
end
+
 
+
 
+
thisGameObject.AddClickable()
+
thisGameObject.Clickable.OnClick(OnClick)</pre>}}
+
 
+
{{ScriptFunction|SUIImage|ItemImage|{ get; set; }|The Image component to hold the image of the item.|5= <pre>itemImage = Space.Host.ExecutingObject.UIDropdown.ItemImage</pre>}}
+
 
+
{{ScriptFunction|SUIText|ItemText|{ get; set; }|The Text component to hold the text of the item.|5= <pre>Space.Host.ExecutingObject.UIDropdown.ItemText.Text = "new text"</pre>}}
+
 
+
{{ScriptFunction|SGameObject|Template|{ get; set; }|The Rect Transform of the template for the dropdown list.|5= <pre>ddRect = Space.Host.ExecutingObject.UIDropdown.Template</pre>}}
+
 
+
{{ScriptFunction|int|Value|{ get; set; }|The Value is the index number of the current selection in the Dropdown. 0 is the first option in the Dropdown, 1 is the second, and so on.|5= <pre>Space.Host.ExecutingObject.UIDropdown.Value= 2</pre>}}
+
 
+
{{ScriptFunction|SResource[]|OptionsAsSprites|{ get; }|The list of possible options. (Sprites)|5= <pre>optionsSprites = Space.Host.ExecutingObject.UIDropdown.OptionsAsSprites</pre>}}
+
 
+
{{ScriptFunction|string[]|OptionsAsText|{ get; }|The list of possible options. (Text)|5= <pre>optionsText = Space.Host.ExecutingObject.UIDropdown.OptionsAsText</pre>}}
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 06:33, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/suidropdown