Пример #1
0
        void ShowStates()
        {
            EditorGUILayout.LabelField("States", new GUIStyle("boldLabel"), GUILayout.Width(100));

            EditorGUI.indentLevel += 1;

            for (int i = 0; i < states.Count; i++)
            {
                bool locked = lockedStates.Contains(states[i]);

                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(locked);

                states[i] = EditorGUILayout.TextField(states[i]);

                EditorGUI.EndDisabledGroup();

                if (i == 0)
                {
                    if (CustomEditorBase.SmallAddButton())
                    {
                        AddState("");
                    }
                }
                else
                {
                    EditorGUI.BeginDisabledGroup(locked);

                    if (CustomEditorBase.DeleteButton())
                    {
                        RemoveState(i);
                        break;
                    }

                    EditorGUI.EndDisabledGroup();
                }

                GUILayout.Space(6);

                EditorGUILayout.EndHorizontal();
            }

            if (EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Tab)
            {
                AddState("");
            }

            EditorGUI.indentLevel -= 1;
            CustomEditorBase.Separator();
        }