public static bool ToolWindowsCommonGUI(EditorWindow window) { if (SkillEditor.Instance == null) { window.Close(); return(false); } if (SkillEditorGUILayout.DoToolWindowsDisabledGUI()) { return(false); } if (EditorApplication.isCompiling) { GUI.enabled = false; } SkillEditorStyles.Init(); if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.F1) { EditorCommands.ToggleShowHints(); return(false); } EditorGUI.indentLevel = 0; return(true); }
public void OnGUI() { if (this.justEnabled) { this.Initialize(); this.justEnabled = false; this.Initialized = true; } if (this.isToolWindow && !SkillEditorGUILayout.ToolWindowsCommonGUI(this)) { return; } this.currentEvent = Event.current; this.eventType = this.currentEvent.type; this.DoGUI(); }
private static bool DoToolWindowsDisabledGUI() { if (SkillEditorGUILayout.DoEditorDisabledGUI()) { return(true); } if (EditorApplication.isPlaying && SkillEditorSettings.DisableToolWindowsWhenPlaying) { GUILayout.Label(Strings.Label_Tool_Windows_disabled_when_playing, new GUILayoutOption[0]); SkillEditorSettings.DisableToolWindowsWhenPlaying = !GUILayout.Toggle(!SkillEditorSettings.DisableToolWindowsWhenPlaying, Strings.Label_Enable_Tool_Windows_When_Playing, new GUILayoutOption[0]); if (GUI.changed) { SkillEditorSettings.SaveSettings(); } return(SkillEditorSettings.DisableToolWindowsWhenPlaying); } return(false); }
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(); }