Esempio n. 1
0
        private void DrawEventsPanel()
        {
            if (Selection.transforms.Length > 1)
            {
                return;
            }

            EditorGUI.BeginDisabledGroup(Selection.transforms.Length > 1);
            GUILayout.Space(3);
            EditorGUILayout.BeginVertical(GUI.skin.box);

            foldOutEvents.target = EditorGUILayout.Foldout(foldOutEvents.target, "   Events", true, GUI.skin.label);
            GUILayout.Space(3);

            if (foldOutEvents.faded > 0)
            {
                EditorGUILayout.BeginFadeGroup(foldOutEvents.faded);

                EditorGUILayout.BeginVertical();

                toolBarEventsID = GUILayout.Toolbar(toolBarEventsID, toolBarEventsTitle);
                EditorGUILayout.BeginVertical();

                if (toolBarEventsID == 0 || toolBarEventsID == 4)
                {
                    TSSEditorUtils.DrawEventProperty(serializedItem.FindProperty("OnClosed"), item.OnClosed.GetPersistentEventCount());
                }
                if (toolBarEventsID == 1 || toolBarEventsID == 4)
                {
                    TSSEditorUtils.DrawEventProperty(serializedItem.FindProperty("OnOpening"), item.OnOpening.GetPersistentEventCount());
                }
                if (toolBarEventsID == 2 || toolBarEventsID == 4)
                {
                    TSSEditorUtils.DrawEventProperty(serializedItem.FindProperty("OnOpened"), item.OnOpened.GetPersistentEventCount());
                }
                if (toolBarEventsID == 3 || toolBarEventsID == 4)
                {
                    TSSEditorUtils.DrawEventProperty(serializedItem.FindProperty("OnClosing"), item.OnClosing.GetPersistentEventCount());
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndFadeGroup();
            }

            EditorGUILayout.EndVertical();
            EditorGUI.EndDisabledGroup();
        }
Esempio n. 2
0
        private bool DrawState(TSSState state, int stateID)
        {
            if (state == null)
            {
                return(false);
            }

            EditorGUILayout.BeginVertical();

            TSSEditorUtils.BeginBlackVertical();

            EditorGUILayout.BeginHorizontal();

            bool isStateEnabled = state.enabled;

            TSSEditorUtils.DrawGenericProperty(ref isStateEnabled, core);
            if (core.currentState == state && state.enabled && !isStateEnabled)
            {
                if (Application.isPlaying)
                {
                    state.Close();
                }
                else
                {
                    state.ActivateManualy(ActivationMode.closeBranchImmediately);
                }
                core.currentState = null;
            }

            state.enabled = isStateEnabled;

            EditorGUI.BeginDisabledGroup(!state.enabled);

            state.editing = EditorGUILayout.Foldout(state.editing, string.Format("   {0} {1}", state.name, state == core.defaultState ? " (default)" : string.Empty), true, stateFoldAutStyle);

            if (state != core.defaultState && GUILayout.Button(stateSetDefault, TSSEditorUtils.max80pxWidth, TSSEditorUtils.fixedLineHeight))
            {
                Undo.RecordObject(core, "[TSS Core] default state");
                core.SetDefaultState(state);
            }

            else if (state == core.defaultState && GUILayout.Button(stateUnsetDefault, TSSEditorUtils.max80pxWidth, TSSEditorUtils.fixedLineHeight))
            {
                Undo.RecordObject(core, "[TSS Core] default state");
                core.SetDefaultState();
            }

            if (core.currentState == state)
            {
                GUI.color = TSSEditorUtils.greenColor;
            }

            if (GUILayout.Button(stateSelect, TSSEditorUtils.max50pxWidth, TSSEditorUtils.fixedLineHeight))
            {
                SelectState(state);
            }

            GUI.color = Color.white;

            EditorGUI.EndDisabledGroup();

            if (DrawStateDeleteButton(state))
            {
                return(false);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!state.enabled);

            if (state.editing)
            {
                TSSEditorUtils.DrawGenericProperty(ref state.name, "State Name", core);

                TSSEditorUtils.DrawSeparator();
                DrawStateItems(state);

                TSSEditorUtils.DrawSeparator();
                TSSEditorUtils.DrawEventProperty(statesProperty.GetArrayElementAtIndex(stateID), "onOpen", state.onOpen.GetPersistentEventCount());
                GUILayout.Space(3);
                TSSEditorUtils.DrawEventProperty(statesProperty.GetArrayElementAtIndex(stateID), "onClose", state.onClose.GetPersistentEventCount());

                if (core.useInput)
                {
                    TSSEditorUtils.DrawSeparator();
                    TSSEditorUtils.DrawKeyCodeListProperty(state.onKeyboard, core, statesProperty.GetArrayElementAtIndex(stateID).FindPropertyRelative("onKeyboard"), false);
                }
            }

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
            GUILayout.Space(3);

            return(true);
        }