UnityEngine.EventSystems.EventSystem.RaycastComparer C# (CSharp) Method

RaycastComparer() private static method

private static RaycastComparer ( RaycastResult lhs, RaycastResult rhs ) : int
lhs RaycastResult
rhs RaycastResult
return int
        private static int RaycastComparer(RaycastResult lhs, RaycastResult rhs)
        {
            if (lhs.module != rhs.module)
            {
                if (((lhs.module.eventCamera != null) && (rhs.module.eventCamera != null)) && (lhs.module.eventCamera.depth != rhs.module.eventCamera.depth))
                {
                    if (lhs.module.eventCamera.depth < rhs.module.eventCamera.depth)
                    {
                        return 1;
                    }
                    if (lhs.module.eventCamera.depth == rhs.module.eventCamera.depth)
                    {
                        return 0;
                    }
                    return -1;
                }
                if (lhs.module.sortOrderPriority != rhs.module.sortOrderPriority)
                {
                    return rhs.module.sortOrderPriority.CompareTo(lhs.module.sortOrderPriority);
                }
                if (lhs.module.renderOrderPriority != rhs.module.renderOrderPriority)
                {
                    return rhs.module.renderOrderPriority.CompareTo(lhs.module.renderOrderPriority);
                }
            }
            if (lhs.sortingLayer != rhs.sortingLayer)
            {
                int layerValueFromID = SortingLayer.GetLayerValueFromID(rhs.sortingLayer);
                int num2 = SortingLayer.GetLayerValueFromID(lhs.sortingLayer);
                return layerValueFromID.CompareTo(num2);
            }
            if (lhs.sortingOrder != rhs.sortingOrder)
            {
                return rhs.sortingOrder.CompareTo(lhs.sortingOrder);
            }
            if (lhs.depth != rhs.depth)
            {
                return rhs.depth.CompareTo(lhs.depth);
            }
            if (lhs.distance != rhs.distance)
            {
                return lhs.distance.CompareTo(rhs.distance);
            }
            return lhs.index.CompareTo(rhs.index);
        }