private void BuildRingForScopeRecursive(VisualElement ve, ref int scopeIndex, List <VisualElementFocusRing.FocusRingRecord> scopeList)
        {
            int childCount = ve.hierarchy.childCount;

            for (int i = 0; i < childCount; i++)
            {
                VisualElement visualElement = ve.hierarchy[i];
                bool          flag          = visualElement.parent != null && visualElement == visualElement.parent.contentContainer;
                bool          flag2         = visualElement.isCompositeRoot | flag;
                if (flag2)
                {
                    VisualElementFocusRing.FocusRingRecord expr_58 = new VisualElementFocusRing.FocusRingRecord();
                    int num = scopeIndex;
                    scopeIndex                     = num + 1;
                    expr_58.m_AutoIndex            = num;
                    expr_58.m_Focusable            = visualElement;
                    expr_58.m_IsSlot               = flag;
                    expr_58.m_ScopeNavigationOrder = new List <VisualElementFocusRing.FocusRingRecord>();
                    VisualElementFocusRing.FocusRingRecord focusRingRecord = expr_58;
                    scopeList.Add(focusRingRecord);
                    int num2 = 0;
                    this.BuildRingForScopeRecursive(visualElement, ref num2, focusRingRecord.m_ScopeNavigationOrder);
                }
                else
                {
                    bool flag3 = visualElement.canGrabFocus && visualElement.tabIndex >= 0;
                    if (flag3)
                    {
                        VisualElementFocusRing.FocusRingRecord expr_CB = new VisualElementFocusRing.FocusRingRecord();
                        int num = scopeIndex;
                        scopeIndex                     = num + 1;
                        expr_CB.m_AutoIndex            = num;
                        expr_CB.m_Focusable            = visualElement;
                        expr_CB.m_IsSlot               = false;
                        expr_CB.m_ScopeNavigationOrder = null;
                        scopeList.Add(expr_CB);
                    }
                    this.BuildRingForScopeRecursive(visualElement, ref scopeIndex, scopeList);
                }
            }
        }
        private int FocusRingSort(VisualElementFocusRing.FocusRingRecord a, VisualElementFocusRing.FocusRingRecord b)
        {
            bool flag = a.m_Focusable.tabIndex == 0 && b.m_Focusable.tabIndex == 0;
            int  result;

            if (flag)
            {
                result = this.FocusRingAutoIndexSort(a, b);
            }
            else
            {
                bool flag2 = a.m_Focusable.tabIndex == 0;
                if (flag2)
                {
                    result = 1;
                }
                else
                {
                    bool flag3 = b.m_Focusable.tabIndex == 0;
                    if (flag3)
                    {
                        result = -1;
                    }
                    else
                    {
                        int num = Comparer <int> .Default.Compare(a.m_Focusable.tabIndex, b.m_Focusable.tabIndex);

                        bool flag4 = num == 0;
                        if (flag4)
                        {
                            num = this.FocusRingAutoIndexSort(a, b);
                        }
                        result = num;
                    }
                }
            }
            return(result);
        }
        private int FocusRingAutoIndexSort(VisualElementFocusRing.FocusRingRecord a, VisualElementFocusRing.FocusRingRecord b)
        {
            switch (this.defaultFocusOrder)
            {
            case VisualElementFocusRing.DefaultFocusOrder.ChildOrder:
            {
IL_1E:
                int result = Comparer <int> .Default.Compare(a.m_AutoIndex, b.m_AutoIndex);

                return(result);
            }

            case VisualElementFocusRing.DefaultFocusOrder.PositionXY:
            {
                VisualElement visualElement  = a.m_Focusable as VisualElement;
                VisualElement visualElement2 = b.m_Focusable as VisualElement;
                bool          flag           = visualElement != null && visualElement2 != null;
                int           result;
                if (flag)
                {
                    bool flag2 = visualElement.layout.position.x < visualElement2.layout.position.x;
                    if (flag2)
                    {
                        result = -1;
                        return(result);
                    }
                    bool flag3 = visualElement.layout.position.x > visualElement2.layout.position.x;
                    if (flag3)
                    {
                        result = 1;
                        return(result);
                    }
                    bool flag4 = visualElement.layout.position.y < visualElement2.layout.position.y;
                    if (flag4)
                    {
                        result = -1;
                        return(result);
                    }
                    bool flag5 = visualElement.layout.position.y > visualElement2.layout.position.y;
                    if (flag5)
                    {
                        result = 1;
                        return(result);
                    }
                }
                result = Comparer <int> .Default.Compare(a.m_AutoIndex, b.m_AutoIndex);

                return(result);
            }

            case VisualElementFocusRing.DefaultFocusOrder.PositionYX:
            {
                VisualElement visualElement3 = a.m_Focusable as VisualElement;
                VisualElement visualElement4 = b.m_Focusable as VisualElement;
                bool          flag6          = visualElement3 != null && visualElement4 != null;
                int           result;
                if (flag6)
                {
                    bool flag7 = visualElement3.layout.position.y < visualElement4.layout.position.y;
                    if (flag7)
                    {
                        result = -1;
                        return(result);
                    }
                    bool flag8 = visualElement3.layout.position.y > visualElement4.layout.position.y;
                    if (flag8)
                    {
                        result = 1;
                        return(result);
                    }
                    bool flag9 = visualElement3.layout.position.x < visualElement4.layout.position.x;
                    if (flag9)
                    {
                        result = -1;
                        return(result);
                    }
                    bool flag10 = visualElement3.layout.position.x > visualElement4.layout.position.x;
                    if (flag10)
                    {
                        result = 1;
                        return(result);
                    }
                }
                result = Comparer <int> .Default.Compare(a.m_AutoIndex, b.m_AutoIndex);

                return(result);
            }
            }
            goto IL_1E;
        }