Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Components.SUIDropdown Class Reference
Inheritance diagram for SineSpace.Scripting.Components.SUIDropdown:
ScriptClassComponent< Dropdown >

Public Member Functions

void RefreshShownValue ()
 Refreshes the text and image (if available) of the currently selected option. More...
 
void AddOptions (string[] options)
 
void AddOptions (Table options)
 Add multiple options to the options of the Dropdown based on a list of OptionData objects. More...
 
void AddOptions (SResource[] optionsSprites)
 Add multiple options to the options of the Dropdown based on a list of OptionData objects. More...
 
void ClearOptions ()
 Clear the list of options in the Dropdown. More...
 
void Show ()
 Show the dropdown list. More...
 
void Hide ()
 Hide the dropdown list. More...
 
void OnValueChanged (Closure callback)
 A UnityEvent that is invoked when when a user has clicked one of the options in the dropdown list. More...
 
void SetValueWithoutNotify (int value)
 Change the current value (selected item) of the dropdown, but do NOT call its OnValueChanged function. More...
 
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. More...
 

Properties

bool Interactable [get, set]
 Will this component will accept input? More...
 
SGameObject Template [get, set]
 The Rect Transform of the template for the dropdown list. More...
 
SUIText CaptionText [get, set]
 The Text component to hold the text of the currently selected option. More...
 
SUIImage CaptionImage [get, set]
 The Image component to hold the image of the currently selected option. More...
 
SUIText ItemText [get, set]
 The Text component to hold the text of the item. More...
 
SUIImage ItemImage [get, set]
 Get item image. More...
 
string[] OptionsAsText [get]
 The list of possible options. More...
 
SResource[] OptionsAsSprites [get]
 The list of possible options. Images can be specified for each option. More...
 
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. More...
 
SColor NormalColor [get, set]
 The normal color of the control More...
 
SColor HighlightedColor [get, set]
 The color of the control when it is highlighted More...
 
SColor PressedColor [get, set]
 The color of the control when it is pressed More...
 
SColor DisabledColor [get, set]
 The color of the control when it is disabled More...
 
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. More...
 
- Properties inherited from ScriptClassComponent< Dropdown >
SGameObject GameObject [get]
 Return the GameObject which component added. More...
 

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

◆ Hide()

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

Hide the dropdown list.

local dropDown=Space.Host.GetReference("DropDown").UIDropdown
function Hide()
dropDown.Hide()
end
<br>

◆ 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

◆ 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>

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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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)
SineSpace.Scripting.Components.SUIDropdown.OptionsAsText
string[] OptionsAsText
The list of possible options.
Definition: SUIDropdown.cs:285
SineSpace.Scripting.Components.SUIDropdown.ItemImage
SUIImage ItemImage
Get item image.
Definition: SUIDropdown.cs:231
SineSpace.Scripting.Components.SUIDropdown.CaptionText
SUIText CaptionText
The Text component to hold the text of the currently selected option.
Definition: SUIDropdown.cs:179
SineSpace.Scripting.Components.SUIDropdown.ItemText
SUIText ItemText
The Text component to hold the text of the item.
Definition: SUIDropdown.cs:213
SineSpace.Scripting.Components.SUIDropdown.ClearOptions
void ClearOptions()
Clear the list of options in the Dropdown.
Definition: SUIDropdown.cs:110
SineSpace.Scripting.Components.SUIDropdown.Hide
void Hide()
Hide the dropdown list.
Definition: SUIDropdown.cs:142
SineSpace.Scripting.Components.SUIDropdown.RefreshShownValue
void RefreshShownValue()
Refreshes the text and image (if available) of the currently selected option.
Definition: SUIDropdown.cs:43
SineSpace.Scripting.Components.SUIDropdown.Template
SGameObject Template
The Rect Transform of the template for the dropdown list.
Definition: SUIDropdown.cs:161
SineSpace.Scripting.Components.SUIDropdown.Show
void Show()
Show the dropdown list.
Definition: SUIDropdown.cs:126