UIStateGroup
CJFinc.​UItools.​UIGroup
public
CJFinc.​UItools.​UIStateGroup
CJFinc.​UItools.​UIStateGroupControl

UIStateGroup allows to manage group of UIStateItem items and perform bulk state change

UIStateGroup-editor

In editor view UIStateGroup provides functionality to change all items to particular state

UIStateGroup-bulk-state-change
Callbacks

UIStateGroup implements callback event OnStateChange that called on each group state change

UIStateGroup-editor-callbacks
Details

Scripting functions listed bellow allows to do more different group states changes.

Properties
StateItems
public UIStateItem [] StateItems { get }

Array of all detected UIStateItem items

States
public string [] States { get }

String array of all states grabbed from StateItems

Functions
GetStateItem (itemName)
public UIStateItem GetStateItem(
string itemName
)

Gets UIStateItem by name from StateItems array

UIStateItem StateItem = GetComponent<UIStateGroup>().GetStateItem("item (1)");

if (StateItem != null) {
Debug.Log("Found item : " + StateItem.itemName);
}
Parameters
itemName
string

UIStateItem item name

Returns

Found UIStateItem or null

ItemStateChanged (itemName)
public virtual void ItemStateChanged(
string itemName
)

Internal function. Called automatically from UIStateItem for each state change

This function used as an internal callback between components UIStateItem and UIStateGroup

Parameters
itemName
string

item name

SetStateForItem (state, itemName)
public void SetStateForItem(
string state,
string itemName
)

Set state for item

GetComponent<UIStateGroup>().SetStateForItem(UIStateItem.STATE_ACTIVE, "item (1)");
GetComponent<UIStateGroup>().SetStateForItem("custom state", "item (1)");
Parameters
state
string

state name

itemName
string

UIStateItem item name

SetStateForItems (state, itemsNames)
public void SetStateForItems(
string state,
string [] itemsNames
)

Set state for several items

GetComponent<UIStateGroup>().SetStateForItems(UIStateItem.STATE_ACTIVE, new string [] {"item (1)", "item (3)"});
Parameters
state
string

state name

itemsNames
string[]

string array of UIStateItem items names

SetStateExceptItem (state, excludeItemName)
public void SetStateExceptItem(
string state,
string excludeItemName
)

Set state for all items excluding given item

GetComponent<UIStateGroup>().SetStateExceptItem(UIStateItem.STATE_ACTIVE, "item (1)");
Parameters
state
string

state name

excludeItemName
string

UIStateItem item name to exclude

SetStateExceptItems (state, excludeItemsNames)
public void SetStateExceptItems(
string state,
string [] excludeItemsNames
)

Set state for all items excluding given items names

GetComponent<UIStateGroup>().SetStateExceptItems(UIStateItem.STATE_ACTIVE, new string [] {"item (1)", "item (3)"});
Parameters
state
string

state name

excludeItemsNames
string[]

string array of UIStateItem items names to exclude

SetStateForAllItems (state)
public void SetStateForAllItems(
string state
)

Set state for all items

GetComponent<UIStateGroup>().SetStateForAllItems(UIStateItem.STATE_INACTIVE);
Parameters
state
string

state name

Variables
OnStateChange
public UnityEvent OnStateChange

This UnityEvent is called when animation transition is finished

You can subscribe any of your functions to this event.

GetComponent<UIStateGroup>().OnStateChange.AddListener(OnGroupStateChange);

...

void OnGroupStateChange() {
Debug.Log("Group state changes!");
}