wiki.sine.space | sinespace

Difference between revisions of "Scripting/SUIDropdown"

From wiki.sine.space
Jump to: navigation, search
(Added and defined all members (15) of SUIDropdown)
 
(Added simple examples to all members (15) of SUIDropdown)
Line 1: Line 1:
 
=Members=
 
=Members=
{{ScriptFunction|void|AddOptions|(Table options)|Add multiple options to the options of the Dropdown.|5=<pre></pre>}}
+
{{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></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></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></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></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></pre>}}
+
{{ScriptFunction|void|Show|()|Show the dropdown list.|5=<pre>Space.Host.ExecutingObject.UIDropdown.Show()</pre>}}
  
  
Line 16: Line 16:
 
=Properties=
 
=Properties=
  
{{ScriptFunction|SUIImage|CaptionImage|{ get; set; }|The Image component to hold the image of the currently selected option.|5= <pre></pre>}}
+
{{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></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; }|xxxxx|5= <pre></pre>}}
+
{{ScriptFunction|bool|Interactable|{ get; set; }|Is this UIDropdown interactable?|5= <pre>Space.Host.ExecutingObject.UIDropdown.Interactable = true</pre>}}
  
{{ScriptFunction|SUIImage|ItemImage|{ get; set; }|The Image component to hold the image of the item.|5= <pre></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></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></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></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></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></pre>}}
+
{{ScriptFunction|string[]|OptionsAsText|{ get; }|The list of possible options. (Text)|5= <pre>optionsText = Space.Host.ExecutingObject.UIDropdown.OptionsAsText</pre>}}
  
 
{{Scripting Navbox}}
 
{{Scripting Navbox}}

Revision as of 14:53, 27 December 2020

Members

AddOptions

void AddOptions (Table options)

Add multiple options to the options of the Dropdown.

Space.Host.ExecutingObject.UIDropdown.AddOptions({"option1","option2","option3"})


ClearOptions

void ClearOptions ()

Clear the list of options in the Dropdown.

Space.Host.ExecutingObject.UIDropdown.ClearOptions()


Hide

void Hide ()

Hide the dropdown list.

Space.Host.ExecutingObject.UIDropdown.Hide()


OnValueChanged

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.

https://wiki.sine.space/index.php?title=Scripting/SUIDropdown


RefreshShownValue

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.

Space.Host.ExecutingObject.UIDropdown.RefreshShownValue()


Show

void Show ()

Show the dropdown list.

Space.Host.ExecutingObject.UIDropdown.Show()



Properties

CaptionImage

SUIImage CaptionImage { get; set; }

The Image component to hold the image of the currently selected option.

captionImage = Space.Host.ExecutingObject.UIDropdown.CaptionImage


CaptionText

SUIText CaptionText { get; set; }

The Text component to hold the text of the currently selected option.

captionText = Space.Host.ExecutingObject.UIDropdown.CaptionText
captionText.Text = "new caption"


Interactable

bool Interactable { get; set; }

Is this UIDropdown interactable?

Space.Host.ExecutingObject.UIDropdown.Interactable = true


ItemImage

SUIImage ItemImage { get; set; }

The Image component to hold the image of the item.

itemImage = Space.Host.ExecutingObject.UIDropdown.ItemImage


ItemText

SUIText ItemText { get; set; }

The Text component to hold the text of the item.

Space.Host.ExecutingObject.UIDropdown.ItemText.Text = "new text"


Template

SGameObject Template { get; set; }

The Rect Transform of the template for the dropdown list.

ddRect = Space.Host.ExecutingObject.UIDropdown.Template


Value

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.

Space.Host.ExecutingObject.UIDropdown.Value= 2


OptionsAsSprites

[[Scripting/SResource[]|SResource[]]] OptionsAsSprites { get; }

The list of possible options. (Sprites)

optionsSprites = Space.Host.ExecutingObject.UIDropdown.OptionsAsSprites


OptionsAsText

[[Scripting/string[]|string[]]] OptionsAsText { get; }

The list of possible options. (Text)

optionsText = Space.Host.ExecutingObject.UIDropdown.OptionsAsText