Ui XML State - funovus/editor-wiki GitHub Wiki
Table of Contents
- [Ui XML Reference\State](#ui-xml-referencestate)
* [name](#name)
* [numberValue](#numbervalue)
* [stringValue](#stringvalue)
* [booleanValue](#booleanvalue)
|
Ui XML Reference\State
Define a UI state. Often used with bind
properties. The value can be changed based on events or lua scripts.
<VStack xmlns:bind="https://platform.wildsky.dev/xml/ui/bind">
<!-- Declare initial state values. -->
<State name="red" booleanValue="false" />
<!-- Show different background images depending on the state value and flip state value when clicked. -->
<Button bind:backgroundImage="'btn_' .. (state.red and 'red' or 'blue')" bind:onClick="state.red = not state.red">
<Text text="switch color" />
</Button>
<Text bind:text="state.red and 'red' or 'blue'" />
</VStack>
Example lua script to modify a state's value:
local state = DCEI.GetXmlUiState(text_ui)
-- updates any lua state conditions defined in the XML element that use the `mode` state
state.mode = "default"
This XML produces the following UI:
Define a UI state
This frame cannot have child frame.
This frame doesn't support common attributes.
Value type: string
The name of the UI state. Used to identify the state when binding properties or updated the value.
<State name="enable" booleanValue="false" />
Lua script to modify the state's value:
local state = DCEI.GetXmlUiState(xml)
state.enable = "true"
Value type: number
The number value of the UI state.
<State name="size" numberValue="100" />
Lua script to modify the state's value:
local state = DCEI.GetXmlUiState(xml)
state.size = "500"
Value type: string
The string value of the UI state.
<State name="text" stringValue="Placeholder Text" />
Lua script to modify the state's value:
local state = DCEI.GetXmlUiState(xml)
state.text = "Still Placeholder Text"
Value type: boolean
The boolean value of the UI state.
<State name="enable" booleanValue="false" />
Lua script to modify the state's value:
local state = DCEI.GetXmlUiState(xml)
state.enable = "true"