Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            GUILayout.BeginVertical();

            try
            {
                fsmInspector.OnGUI();
            }
            catch (Exception e)
            {
                if (e is ExitGUIException)
                {
                    throw;
                }

                //TODO: detect if stuck in loop here
                // E.g., set a "triedToRecover" flag that is cleared when OnGUI succeeds.
                // If triedToRecover is true here it means we failed twice!

                fsmInspector.Reset();
                Repaint();

                GUIUtility.ExitGUI();
            }

            GUILayout.EndVertical();

            if (Event.current.type == EventType.Repaint)
            {
                if (inspectorWindow == null)
                {
                    inspectorWindow = EditorHacks.GetUnityInspectorWindow();
                }
                HighlighterHelper.Init(inspectorWindow);
                HighlighterHelper.FromGUILayout("PlayMakerFSM_" + fsmComponent.GetInstanceID());

                HighlighterHelper.OnGUI();
            }
        }
Esempio n. 2
0
        public void OnGUI(Rect area)
        {
            EditorGUI.set_indentLevel(0);
            GUILayout.BeginArea(area);
            if (EditorApplication.get_isPlaying() && FsmEditorSettings.DisableInspectorWhenPlaying)
            {
                GUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.Label(Strings.get_Hint_Inspector_disabled_when_playing(), new GUILayoutOption[0]);
                FsmEditorSettings.DisableInspectorWhenPlaying = !GUILayout.Toggle(!FsmEditorSettings.DisableInspectorWhenPlaying, Strings.get_Hint_Enable_inspector_when_playing(), new GUILayoutOption[0]);
                if (GUI.get_changed())
                {
                    FsmEditorSettings.SaveSettings();
                }
                GUILayout.EndArea();
                return;
            }
            this.View = area;
            SkillEditorGUILayout.LabelWidth(150f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            this.DoModeSelector();
            if (this.inspectorMode != InspectorMode.FsmInspector && this.inspectorMode != InspectorMode.Preferences && !Application.get_isPlaying() && SkillEditor.SelectedFsmUsesTemplate)
            {
                GUILayout.Label(Strings.get_Label_FSM_Uses_Template(), new GUILayoutOption[0]);
                if (FsmEditorSettings.ShowHints)
                {
                    GUILayout.Box(Strings.get_InspectorPanel_FSM_Uses_Template(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
            }
            else
            {
                if (this.inspectorMode != InspectorMode.Preferences)
                {
                    SkillEditorGUILayout.UnlockFsmGUI(SkillEditor.SelectedFsm);
                    EditorGUI.BeginDisabledGroup(SkillEditor.SelectedFsm != null && SkillEditor.SelectedFsm.get_Locked());
                }
                switch (this.inspectorMode)
                {
                case InspectorMode.FsmInspector:
                    FsmInspector.OnGUI();
                    break;

                case InspectorMode.StateInspector:
                    if (!SkillEditor.SelectedFsmIsLocked)
                    {
                        InspectorPanel.BeginPrefabInstanceCheck();
                        SkillEditor.StateInspector.OnGUI();
                        InspectorPanel.EndPrefabInstanceCheck();
                    }
                    else
                    {
                        GUILayout.FlexibleSpace();
                    }
                    break;

                case InspectorMode.EventManager:
                    if (!SkillEditor.SelectedFsmIsLocked)
                    {
                        InspectorPanel.BeginPrefabInstanceCheck();
                        SkillEditor.EventManager.OnGUI();
                        InspectorPanel.EndPrefabInstanceCheck();
                    }
                    else
                    {
                        GUILayout.FlexibleSpace();
                    }
                    break;

                case InspectorMode.VariableManager:
                    if (!SkillEditor.SelectedFsmIsLocked)
                    {
                        InspectorPanel.BeginPrefabInstanceCheck();
                        SkillEditor.VariableManager.OnGUI();
                        InspectorPanel.EndPrefabInstanceCheck();
                    }
                    else
                    {
                        GUILayout.FlexibleSpace();
                    }
                    break;

                case InspectorMode.Preferences:
                    FsmEditorSettings.OnGUI();
                    break;

                case InspectorMode.Watermarks:
                    WatermarkSelector.OnGUI();
                    break;
                }
                if (this.inspectorMode != InspectorMode.Preferences)
                {
                    EditorGUI.EndDisabledGroup();
                }
            }
            this.DoBottomToolbar();
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
 public override void OnInspectorGUI()
 {
     fsmInspector.OnGUI();
 }