예제 #1
0
        // 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();
            }
        }
예제 #2
0
        private void ChangeSidebarIndex(int nextIndex)
        {
            this.sidebarIndex = nextIndex;
            EditorPrefs.SetInt(KEY_SIDEBAR_INDEX, this.sidebarIndex);

            string windowName = PreferencesWindow.GetWindowTitle();

            this.titleContent = new GUIContent(windowName);
        }
예제 #3
0
        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();
            }
        }
예제 #4
0
        public static PreferencesWindow OpenWindow()
        {
            PreferencesWindow window = EditorWindow.GetWindow <PreferencesWindow>(
                true,
                PreferencesWindow.GetWindowTitle(),
                true
                );

            PreferencesWindow.Instance = window;
            window.LoadDatabases();
            window.Show();
            return(window);
        }
예제 #5
0
        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;
                }
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        // 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();
        }