Sinespace Client 2025.3.19431
Client-side scripting for Sinespace
SineSpace.Scripting.Components.SUIDropdown Class Reference
Inheritance diagram for SineSpace.Scripting.Components.SUIDropdown:
ScriptClassComponent< T > ScriptClass< T > ScriptClassWrapper< T > ScriptClass

Public Member Functions

void RefreshShownValue ()
 Refreshes the text and image (if available) of the currently selected option.
 
void AddOptions (string[] options)
 
void AddOptions (Table options)
 Add multiple options to the options of the Dropdown based on a list of OptionData objects.
 
void AddOptions (SResource[] optionsSprites)
 Add multiple options to the options of the Dropdown based on a list of OptionData objects.
 
void ClearOptions ()
 Clear the list of options in the Dropdown.
 
void Show ()
 Show the dropdown list.
 
void Hide ()
 Hide the dropdown list.
 
void OnValueChanged (Closure callback)
 A UnityEvent that is invoked when when a user has clicked one of the options in the dropdown list.
 
void SetValueWithoutNotify (int value)
 Change the current value (selected item) of the dropdown, but do NOT call its OnValueChanged function.
 
bool SetValueByText (string text)
 Attempts to set the dropdown to the first option in the dropdown list that matches the inputted text. Returns true if found, false if no matches found.
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 
- Public Member Functions inherited from ScriptClass
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
void Initialise (SScript runtime, object wrapper)
 

Properties

bool Interactable [get, set]
 Will this component will accept input?
 
SGameObject Template [get, set]
 The Rect Transform of the template for the dropdown list.
 
SUIText CaptionText [get, set]
 The Text component to hold the text of the currently selected option.
 
SUIImage CaptionImage [get, set]
 The Image component to hold the image of the currently selected option.
 
SUIText ItemText [get, set]
 The Text component to hold the text of the item.
 
SUIImage ItemImage [get, set]
 Get item image.
 
string[] OptionsAsText [get]
 The list of possible options.
 
SResource[] OptionsAsSprites [get]
 The list of possible options. Images can be specified for each option.
 
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.
 
SColor NormalColor [get, set]
 The normal color of the control.
 
SColor HighlightedColor [get, set]
 The color of the control when it is highlighted.
 
SColor PressedColor [get, set]
 The color of the control when it is pressed.
 
SColor DisabledColor [get, set]
 The color of the control when it is disabled.
 
float ColorMultiplier [get, set]
 This multiplies the tint color for each transition by its value. With this you can create colors greater than 1 to brighten the colors on graphic elements whose base color is less than white.
 
- Properties inherited from ScriptClassComponent< T >
SGameObject GameObject [get]
 Return the GameObject which component added.
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive.
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 
- Properties inherited from ScriptClass
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass
void Initialise (SScript runtime)
 

Member Function Documentation

◆ AddOptions() [1/3]

void SineSpace.Scripting.Components.SUIDropdown.AddOptions ( SResource[] optionsSprites)

Add multiple options to the options of the Dropdown based on a list of OptionData objects.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
local thisObject=Space.Host.ExecutingObject
local script=thisObject.Script
local res=script.Resources
dropDown.AddOptions(res)
Parameters
optionsSpritesthe optionsprites loaded from resource

◆ AddOptions() [2/3]

void SineSpace.Scripting.Components.SUIDropdown.AddOptions ( string[] options)

◆ AddOptions() [3/3]

void SineSpace.Scripting.Components.SUIDropdown.AddOptions ( Table options)

Add multiple options to the options of the Dropdown based on a list of OptionData objects.

local thisObject=Space.Host.ExecutingObject
local script=thisObject.Script
local dropDown=Space.Host.GetReference("DropDown").UIDropdown
local image1=script.GetResource("Image1")
local image2=script.GetResource("Image2")
local op={{"test1",image1},{"test2",image2}}
dropDown.AddOptions(op)

◆ ClearOptions()

void SineSpace.Scripting.Components.SUIDropdown.ClearOptions ( )

Clear the list of options in the Dropdown.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Clear()
dropDown.ClearOptions()
end
void ClearOptions()
Clear the list of options in the Dropdown.
Definition SUIDropdown.cs:110

◆ Hide()

void SineSpace.Scripting.Components.SUIDropdown.Hide ( )

Hide the dropdown list.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Hide()
dropDown.Hide()
end <br>
void Hide()
Hide the dropdown list.
Definition SUIDropdown.cs:142

◆ OnValueChanged()

void SineSpace.Scripting.Components.SUIDropdown.OnValueChanged ( Closure callback)

A UnityEvent that is invoked when when a user has clicked one of the options in the dropdown list.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
dropDown.OnValueChanged(function ()
Space.Log("Hello Lua!")
end)

◆ RefreshShownValue()

void SineSpace.Scripting.Components.SUIDropdown.RefreshShownValue ( )

Refreshes the text and image (if available) of the currently selected option.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Refresh()
dropDown.RefreshShownValue()
end
void RefreshShownValue()
Refreshes the text and image (if available) of the currently selected option.
Definition SUIDropdown.cs:43

◆ SetValueByText()

bool SineSpace.Scripting.Components.SUIDropdown.SetValueByText ( string text)

Attempts to set the dropdown to the first option in the dropdown list that matches the inputted text. Returns true if found, false if no matches found.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
local options = {"Room 1", "Room 2", "Room 3", "Room 4"}
dropDown.AddOoptions(options)
dropDown.SetValueByText("Room 3")

◆ SetValueWithoutNotify()

void SineSpace.Scripting.Components.SUIDropdown.SetValueWithoutNotify ( int value)

Change the current value (selected item) of the dropdown, but do NOT call its OnValueChanged function.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
dropDown.SetValueWithoutNotify(2)

◆ Show()

void SineSpace.Scripting.Components.SUIDropdown.Show ( )

Show the dropdown list.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Show()
dropDown.Show()
end <br>
void Show()
Show the dropdown list.
Definition SUIDropdown.cs:126

Property Documentation

◆ CaptionImage

SUIImage SineSpace.Scripting.Components.SUIDropdown.CaptionImage
getset

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

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function CapImage()
Space.Log(image.Color.ToString()
end <br>

◆ CaptionText

SUIText SineSpace.Scripting.Components.SUIDropdown.CaptionText
getset

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

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function CapText()
local cap=dropDown.CaptionText
Space.Log(cap.Color.ToString())&ndash;This will show the color of caption text
end
SUIText CaptionText
The Text component to hold the text of the currently selected option.
Definition SUIDropdown.cs:179

◆ ColorMultiplier

float SineSpace.Scripting.Components.SUIDropdown.ColorMultiplier
getset

This multiplies the tint color for each transition by its value. With this you can create colors greater than 1 to brighten the colors on graphic elements whose base color is less than white.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.ColorMultiplier)

◆ DisabledColor

SColor SineSpace.Scripting.Components.SUIDropdown.DisabledColor
getset

The color of the control when it is disabled.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.DisabledColor.ToString())

◆ HighlightedColor

SColor SineSpace.Scripting.Components.SUIDropdown.HighlightedColor
getset

The color of the control when it is highlighted.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.HighlightedColor.ToString())

◆ Interactable

bool SineSpace.Scripting.Components.SUIDropdown.Interactable
getset

Will this component will accept input?

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.Interactable)

◆ ItemImage

SUIImage SineSpace.Scripting.Components.SUIDropdown.ItemImage
getset

Get item image.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function ItemImage()
local iI=dropDown.ItemImage
Space.Log(iI.Color.ToString())
end
SUIImage ItemImage
Get item image.
Definition SUIDropdown.cs:231

◆ ItemText

SUIText SineSpace.Scripting.Components.SUIDropdown.ItemText
getset

The Text component to hold the text of the item.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function ItemText()
local iT=dropDown.ItemText
Space.Log(iT.Color.ToString())
end
SUIText ItemText
The Text component to hold the text of the item.
Definition SUIDropdown.cs:213

◆ NormalColor

SColor SineSpace.Scripting.Components.SUIDropdown.NormalColor
getset

The normal color of the control.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.NormalColor.ToString())

◆ OptionsAsSprites

SResource [] SineSpace.Scripting.Components.SUIDropdown.OptionsAsSprites
get

The list of possible options. Images can be specified for each option.

optionsSprites = Space.Host.ExecutingObject.UIDropdown.OptionsAsSprites

◆ OptionsAsText

string [] SineSpace.Scripting.Components.SUIDropdown.OptionsAsText
get

The list of possible options.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Text()
local texts=dropDown.OptionsAsText
for i = 1, #texts do
Space.Log(texts[i])
end
end
string[] OptionsAsText
The list of possible options.
Definition SUIDropdown.cs:285

◆ PressedColor

SColor SineSpace.Scripting.Components.SUIDropdown.PressedColor
getset

The color of the control when it is pressed.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.PressedColor.ToString())

◆ Template

SGameObject SineSpace.Scripting.Components.SUIDropdown.Template
getset

The Rect Transform of the template for the dropdown list.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Temp()
local tem=dropDown.Template
Space.Log(tem.Name)
end
&ndash;This will show the name of the template
SGameObject Template
The Rect Transform of the template for the dropdown list.
Definition SUIDropdown.cs:161

◆ Value

int SineSpace.Scripting.Components.SUIDropdown.Value
getset

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.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
Space.Log(dropDown.value)