public void SetMode(InspectorMode mode) { if (this.inspectorMode == mode) { return; } SkillEditor.DoDirtyFsmPrefab(); EditorPrefs.SetInt(EditorPrefStrings.get_InspectorMode(), (int)mode); Keyboard.ResetFocus(); this.inspectorMode = mode; this.ResetView(); InspectorMode inspectorMode = this.inspectorMode; if (inspectorMode != InspectorMode.FsmInspector) { if (inspectorMode == InspectorMode.Watermarks) { WatermarkSelector.Init(); } } else { FsmInspector.Init(); } SkillEditor.Repaint(true); }
public void ResetView() { switch (this.inspectorMode) { case InspectorMode.FsmInspector: FsmInspector.Reset(); return; case InspectorMode.StateInspector: SkillEditor.StateInspector.Reset(); return; case InspectorMode.EventManager: SkillEditor.EventManager.Reset(); return; case InspectorMode.VariableManager: SkillEditor.VariableManager.Reset(); return; case InspectorMode.Preferences: break; case InspectorMode.Watermarks: WatermarkSelector.ResetSelection(); break; default: return; } }
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(); }