UIStateGroupControl extends UIStateGroup into the group of items with only one item selected.
UIStateGroupControl works with active and inactive states of UIStateItem. It reacts to any UIStateItem state change and controls that only one item should be selected at the same time.
There are two modes available - one active - one inactive
In "one active" UIStateGroupControl controls that only one item is active.
And "one inactive" has an inverse behavior when only one item could be inactive.
Enumeration of possible group modes
OneActive
OneInActive
public void SetMode( |
| ) |
Change group mode and set items to initial states
GetComponent<UIStateGroupControl>().SetMode(STATE_GROUP_CONTROL_MODE.OneInActive);
newMode | STATE_GROUP_CONTROL_MODE new group mode |
public override void ItemStateChanged( |
| ) |
Internal function. Called automatically from UIStateItem for each state change
See UIStateGroup.ItemStateChanged (itemName) for details.
itemName string | item name |
public void SetItemActive( |
| ) |
Change item with given name to state UIStateItem.STATE_ACTIVE
GetComponent<UIStateGroupControl>().SetItemActive("item (2)");
itemName string | UIStateItem item name |
public void SetItemInactive( |
| ) |
Change item with given name to state UIStateItem.STATE_INACTIVE
GetComponent<UIStateGroupControl>().SetItemInactive("item (2)");
itemName string | UIStateItem item name |
Flushes state for all items and makes active the first one
// Example - selecting first item in group init
// NOTE: Make sure to disable Init on start for all items, to let group control init state
void Awake() {
GetComponent<UIStateGroupControl>().OnInitFinish.AddListener(OnRadioGroupInitFinished);
}
void OnRadioGroupInitFinished() {
GetComponent<UIStateGroupControl>().SelectFirstItem();
}
Flush all items for default state according to current Mode
GetComponent<UIStateGroupControl>().Flush();