示例#1
0
        private void PaintSidebar(int currentSidebarIndex)
        {
            this.scrollSidebar = EditorGUILayout.BeginScrollView(
                this.scrollSidebar,
                this.styleSidebar,
                GUILayout.MinWidth(SIDEBAR_WIDTH),
                GUILayout.MaxWidth(SIDEBAR_WIDTH),
                GUILayout.ExpandHeight(true)
                );

            for (int i = DATABASES.Count - 1; i >= 0; --i)
            {
                if (DATABASES[i].data == null)
                {
                    DATABASES.RemoveAt(i);
                }
            }

            for (int i = 0; i < DATABASES.Count; ++i)
            {
                Rect itemRect = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetItemPreferencesSidebar());

                if (UnityEngine.Event.current.type == EventType.MouseDown &&
                    itemRect.Contains(UnityEngine.Event.current.mousePosition))
                {
                    this.ChangeSidebarIndex(i);
                }

                bool isActive = (currentSidebarIndex == i);

                if (UnityEngine.Event.current.type == EventType.Repaint)
                {
                    string text = DATABASES[i].name;
                    CoreGUIStyles.GetItemPreferencesSidebar().Draw(itemRect, text, isActive, isActive, false, false);
                }
            }

            EditorGUILayout.EndScrollView();

            Rect borderRect = GUILayoutUtility.GetRect(1f, 1f, GUILayout.ExpandHeight(true), GUILayout.Width(1f));

            EditorGUI.DrawTextureAlpha(borderRect, Texture2D.blackTexture);
        }