public override int CompareTo(object o)
 {
     if (o is AddComponentWindow.ComponentElement)
     {
         AddComponentWindow.ComponentElement componentElement = (AddComponentWindow.ComponentElement)o;
         if (this.isLegacy && !componentElement.isLegacy)
         {
             return(1);
         }
         if (!this.isLegacy && componentElement.isLegacy)
         {
             return(-1);
         }
     }
     return(base.CompareTo(o));
 }
            public override int CompareTo(object o)
            {
                int result;

                if (o is AddComponentWindow.ComponentElement)
                {
                    AddComponentWindow.ComponentElement componentElement = (AddComponentWindow.ComponentElement)o;
                    if (this.isLegacy && !componentElement.isLegacy)
                    {
                        result = 1;
                        return(result);
                    }
                    if (!this.isLegacy && componentElement.isLegacy)
                    {
                        result = -1;
                        return(result);
                    }
                }
                result = base.CompareTo(o);
                return(result);
            }
        private void ListGUI(AddComponentWindow.Element[] tree, AddComponentWindow.GroupElement parent)
        {
            parent.scroll = GUILayout.BeginScrollView(parent.scroll, new GUILayoutOption[0]);
            EditorGUIUtility.SetIconSize(new Vector2(16f, 16f));
            List <AddComponentWindow.Element> children = this.GetChildren(tree, parent);
            Rect rect = default(Rect);

            for (int i = 0; i < children.Count; i++)
            {
                AddComponentWindow.Element element = children[i];
                Rect rect2 = GUILayoutUtility.GetRect(16f, 20f, new GUILayoutOption[]
                {
                    GUILayout.ExpandWidth(true)
                });
                if (Event.current.type == EventType.MouseMove || Event.current.type == EventType.MouseDown)
                {
                    if (parent.selectedIndex != i && rect2.Contains(Event.current.mousePosition))
                    {
                        parent.selectedIndex = i;
                        base.Repaint();
                    }
                }
                bool flag = false;
                if (i == parent.selectedIndex)
                {
                    flag = true;
                    rect = rect2;
                }
                if (Event.current.type == EventType.Repaint)
                {
                    GUIStyle   gUIStyle = AddComponentWindow.s_Styles.groupButton;
                    GUIContent content  = element.content;
                    bool       flag2    = element is AddComponentWindow.ComponentElement;
                    if (flag2)
                    {
                        AddComponentWindow.ComponentElement componentElement = (AddComponentWindow.ComponentElement)element;
                        gUIStyle = AddComponentWindow.s_Styles.componentButton;
                        if (componentElement.isLegacy && this.hasSearch)
                        {
                            content = componentElement.legacyContent;
                        }
                    }
                    gUIStyle.Draw(rect2, content, false, false, flag, flag);
                    if (!flag2)
                    {
                        Rect position = new Rect(rect2.x + rect2.width - 13f, rect2.y + 4f, 13f, 13f);
                        AddComponentWindow.s_Styles.rightArrow.Draw(position, false, false, false, false);
                    }
                }
                if (Event.current.type == EventType.MouseDown && rect2.Contains(Event.current.mousePosition))
                {
                    Event.current.Use();
                    parent.selectedIndex = i;
                    this.GoToChild(element, true);
                }
            }
            EditorGUIUtility.SetIconSize(Vector2.zero);
            GUILayout.EndScrollView();
            if (this.m_ScrollToSelected && Event.current.type == EventType.Repaint)
            {
                this.m_ScrollToSelected = false;
                Rect lastRect = GUILayoutUtility.GetLastRect();
                if (rect.yMax - lastRect.height > parent.scroll.y)
                {
                    parent.scroll.y = rect.yMax - lastRect.height;
                    base.Repaint();
                }
                if (rect.y < parent.scroll.y)
                {
                    parent.scroll.y = rect.y;
                    base.Repaint();
                }
            }
        }