/* * Func: SetItemActive(itemName) * Change item with given name to state UIStateItem.STATE_ACTIVE * * (start code) * GetComponent<UIStateGroupControl>().SetItemActive("item (2)"); * (end code) * * Parameters: * itemName - <UIStateItem> item name */ public void SetItemActive(string itemName) { UIStateItem StateItem = GetStateItem(itemName); if (StateItem == null) { return; } StateItem.SetStateActive(); }
// TESTING void DrawStateItemTesting() { // current state EditorGUILayout.LabelField("Current state: ", scriptStateItem.CurrentState, guistyleBold); EditorGUILayout.LabelField("Set state to: "); if (GUILayout.Button("Set to default")) { scriptStateItem.SetStateDefault(true); } EditorGUILayout.Space(); GUILayout.BeginHorizontal(); if (GUILayout.Button(UIStateItem.STATE_INACTIVE)) { scriptStateItem.SetStateInactive(true); } if (GUILayout.Button(UIStateItem.STATE_ACTIVE)) { scriptStateItem.SetStateActive(true); } if (GUILayout.Button(UIStateItem.STATE_DISABLED)) { scriptStateItem.SetStateDisabled(true); } GUILayout.EndHorizontal(); // custom States if (scriptStateItem.States.Length > 3) { EditorGUILayout.BeginHorizontal(); for (int i = 3; i < scriptStateItem.States.Length; i++) { if (i % 3 == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } if (GUILayout.Button(scriptStateItem.States[i])) { scriptStateItem.SetState(scriptStateItem.States[i], true); } } EditorGUILayout.EndHorizontal(); } }