// GUI METHODS: ------------------------------------------------------------------------------------------------ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("This component is only accessable through the Preferences Panel", MessageType.Info); if (GUILayout.Button("Open Preferences Window")) { PreferencesWindow.OpenWindow(); } }
private void ChangeSidebarIndex(int nextIndex) { this.sidebarIndex = nextIndex; EditorPrefs.SetInt(KEY_SIDEBAR_INDEX, this.sidebarIndex); string windowName = PreferencesWindow.GetWindowTitle(); this.titleContent = new GUIContent(windowName); }
static void Start() { EditorApplication.update -= DatabaseQuickstartEditorOnLoad.Start; if (EditorPrefs.GetBool(KEY_PREFERENCES_STARTUP, true)) { EditorPrefs.SetBool(KEY_PREFERENCES_STARTUP, false); PreferencesWindow.SetSidebarIndex(0); PreferencesWindow.OpenWindow(); } }
public static PreferencesWindow OpenWindow() { PreferencesWindow window = EditorWindow.GetWindow <PreferencesWindow>( true, PreferencesWindow.GetWindowTitle(), true ); PreferencesWindow.Instance = window; window.LoadDatabases(); window.Show(); return(window); }
public static void OpenWindowTab(string tabName) { PreferencesWindow window = PreferencesWindow.OpenWindow(); tabName = tabName.ToLower(); for (int i = 0; i < DATABASES.Count; ++i) { if (DATABASES[i].name.ToLower() == tabName) { window.sidebarIndex = i; break; } } }
public static PreferencesWindow OpenWindow() { PreferencesWindow window = EditorWindow.GetWindow <PreferencesWindow>( true, PreferencesWindow.GetWindowTitle(), true ); PreferencesWindow.Instance = window; window.minSize = new Vector2(WIN_MIN_WIDTH, WIN_MIN_HEIGHT); window.maxSize = new Vector2(WIN_MIN_WIDTH, WIN_MIN_HEIGHT); window.LoadDatabases(); window.Show(); return(window); }
// GUI METHODS: --------------------------------------------------------------------------- private void OnGUI() { if (PreferencesWindow.Instance == null) { PreferencesWindow.OpenWindow(); } if (!this.initStyles) { this.InitializeStyles(); } int currentSidebarIndex = this.sidebarIndex; if (currentSidebarIndex < 0) { currentSidebarIndex = 0; this.ChangeSidebarIndex(currentSidebarIndex); } else if (currentSidebarIndex >= DATABASES.Count) { currentSidebarIndex = DATABASES.Count - 1; this.ChangeSidebarIndex(currentSidebarIndex); } EditorGUILayout.BeginHorizontal(); this.PaintSidebar(currentSidebarIndex); EditorGUILayout.BeginVertical(); this.PaintToolbar(currentSidebarIndex); this.PaintContent(currentSidebarIndex); EditorGUILayout.EndVertical(); this.Repaint(); EditorGUILayout.EndHorizontal(); }