(Added simple examples to all members (15) of SUIDropdown) |
|||
Line 21: | Line 21: | ||
captionText.Text = "new caption"</pre>}} | captionText.Text = "new caption"</pre>}} | ||
− | {{ScriptFunction|bool|Interactable|{ get; set; }|Is this UIDropdown interactable?|5= <pre>Space.Host.ExecutingObject.UIDropdown.Interactable = true</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|SUIImage|ItemImage|{ get; set; }|The Image component to hold the image of the item.|5= <pre>itemImage = Space.Host.ExecutingObject.UIDropdown.ItemImage</pre>}} |
Add multiple options to the options of the Dropdown.
Space.Host.ExecutingObject.UIDropdown.AddOptions({"option1","option2","option3"})
Clear the list of options in the Dropdown.
Space.Host.ExecutingObject.UIDropdown.ClearOptions()
Hide the dropdown list.
Space.Host.ExecutingObject.UIDropdown.Hide()
Bind a function to handle the event that is invoked when when a user has clicked one of the options in the dropdown list.
https://wiki.sine.space/index.php?title=Scripting/SUIDropdown
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.
Space.Host.ExecutingObject.UIDropdown.RefreshShownValue()
Show the dropdown list.
Space.Host.ExecutingObject.UIDropdown.Show()
The Image component to hold the image of the currently selected option.
captionImage = Space.Host.ExecutingObject.UIDropdown.CaptionImage
The Text component to hold the text of the currently selected option.
captionText = Space.Host.ExecutingObject.UIDropdown.CaptionText captionText.Text = "new caption"
Is this UIDropdown interactable?
Space.Host.ExecutingObject.UIDropdown.Interactable = true
--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)
The Image component to hold the image of the item.
itemImage = Space.Host.ExecutingObject.UIDropdown.ItemImage
The Text component to hold the text of the item.
Space.Host.ExecutingObject.UIDropdown.ItemText.Text = "new text"
The Rect Transform of the template for the dropdown list.
ddRect = Space.Host.ExecutingObject.UIDropdown.Template
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.
Space.Host.ExecutingObject.UIDropdown.Value= 2
The list of possible options. (Sprites)
optionsSprites = Space.Host.ExecutingObject.UIDropdown.OptionsAsSprites
The list of possible options. (Text)
optionsText = Space.Host.ExecutingObject.UIDropdown.OptionsAsText
|