GetGuideLineForRect() private static method

private static GetGuideLineForRect ( Rect rect, Vector3 pivot, Quaternion rotation, int axis, float side ) : Vector3[]
rect UnityEngine.Rect
pivot Vector3
rotation UnityEngine.Quaternion
axis int
side float
return Vector3[]
        private static List <SnapGuide> GetSnapGuides(Transform parentSpace, Transform self, RectTransform parentRect, RectTransform rect, int axis, int side)
        {
            List <SnapGuide> list = new List <SnapGuide>();

            if (parentRect != null)
            {
                float num  = RectTransformSnapping.kSidesAndMiddle[side];
                float num2 = Mathf.Lerp(rect.anchorMin[axis], rect.anchorMax[axis], num);
                list.Add(new SnapGuide(num2 * parentRect.rect.size[axis], RectTransformSnapping.GetGuideLineForRect(parentRect, axis, num2)));
                float num3 = Mathf.Lerp(rect.anchorMin[axis], rect.anchorMax[axis], num);
                if (num != num3)
                {
                    list.Add(new SnapGuide(num * parentRect.rect.size[axis], false, RectTransformSnapping.GetGuideLineForRect(parentRect, axis, num)));
                }
            }
            IEnumerator enumerator = parentSpace.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Transform transform = (Transform)enumerator.Current;
                    if (!(transform == self))
                    {
                        RectTransform component = transform.GetComponent <RectTransform>();
                        if (component)
                        {
                            if (side == 0)
                            {
                                bool safe = component.anchorMin[axis] == rect.anchorMin[axis];
                                list.Add(new SnapGuide(component.GetRectInParentSpace().min[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0f)));
                                safe = (component.anchorMax[axis] == rect.anchorMin[axis]);
                                list.Add(new SnapGuide(component.GetRectInParentSpace().max[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 1f)));
                            }
                            if (side == 2)
                            {
                                bool safe = component.anchorMax[axis] == rect.anchorMax[axis];
                                list.Add(new SnapGuide(component.GetRectInParentSpace().max[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 1f)));
                                safe = (component.anchorMin[axis] == rect.anchorMax[axis]);
                                list.Add(new SnapGuide(component.GetRectInParentSpace().min[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0f)));
                            }
                            if (side == 1)
                            {
                                bool safe = component.anchorMin[axis] - rect.anchorMin[axis] == -(component.anchorMax[axis] - rect.anchorMax[axis]);
                                list.Add(new SnapGuide(component.GetRectInParentSpace().center[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0.5f)));
                            }
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            return(list);
        }
        private static List <SnapGuide> GetSnapGuides(Transform parentSpace, Transform self, RectTransform parentRect, RectTransform rect, int axis, int side)
        {
            List <SnapGuide> snapGuideList = new List <SnapGuide>();

            if ((Object)parentRect != (Object)null)
            {
                float num1  = RectTransformSnapping.kSidesAndMiddle[side];
                float side1 = Mathf.Lerp(rect.anchorMin[axis], rect.anchorMax[axis], num1);
                snapGuideList.Add(new SnapGuide(side1 * parentRect.rect.size[axis], RectTransformSnapping.GetGuideLineForRect(parentRect, axis, side1)));
                float num2 = Mathf.Lerp(rect.anchorMin[axis], rect.anchorMax[axis], num1);
                if ((double)num1 != (double)num2)
                {
                    snapGuideList.Add(new SnapGuide(num1 * parentRect.rect.size[axis], false, RectTransformSnapping.GetGuideLineForRect(parentRect, axis, num1)));
                }
            }
            foreach (Transform transform in parentSpace)
            {
                if (!((Object)transform == (Object)self))
                {
                    RectTransform component = transform.GetComponent <RectTransform>();
                    if ((bool)((Object)component))
                    {
                        if (side == 0)
                        {
                            bool safe1 = (double)component.anchorMin[axis] == (double)rect.anchorMin[axis];
                            snapGuideList.Add(new SnapGuide(component.GetRectInParentSpace().min[axis], safe1, RectTransformSnapping.GetGuideLineForRect(component, axis, 0.0f)));
                            bool safe2 = (double)component.anchorMax[axis] == (double)rect.anchorMin[axis];
                            snapGuideList.Add(new SnapGuide(component.GetRectInParentSpace().max[axis], safe2, RectTransformSnapping.GetGuideLineForRect(component, axis, 1f)));
                        }
                        if (side == 2)
                        {
                            bool safe1 = (double)component.anchorMax[axis] == (double)rect.anchorMax[axis];
                            snapGuideList.Add(new SnapGuide(component.GetRectInParentSpace().max[axis], safe1, RectTransformSnapping.GetGuideLineForRect(component, axis, 1f)));
                            bool safe2 = (double)component.anchorMin[axis] == (double)rect.anchorMax[axis];
                            snapGuideList.Add(new SnapGuide(component.GetRectInParentSpace().min[axis], safe2, RectTransformSnapping.GetGuideLineForRect(component, axis, 0.0f)));
                        }
                        if (side == 1)
                        {
                            bool safe = (double)component.anchorMin[axis] - (double)rect.anchorMin[axis] == -((double)component.anchorMax[axis] - (double)rect.anchorMax[axis]);
                            snapGuideList.Add(new SnapGuide(component.GetRectInParentSpace().center[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0.5f)));
                        }
                    }
                }
            }
            return(snapGuideList);
        }
        private static List <SnapGuide> GetSnapGuides(Transform parentSpace, Transform self, RectTransform parentRect, RectTransform rect, int axis, int side)
        {
            List <SnapGuide> list = new List <SnapGuide>();

            if (parentRect != null)
            {
                float num  = RectTransformSnapping.kSidesAndMiddle[side];
                float num2 = Mathf.Lerp(rect.anchorMin[axis], rect.anchorMax[axis], num);
                list.Add(new SnapGuide(num2 * parentRect.rect.size[axis], RectTransformSnapping.GetGuideLineForRect(parentRect, axis, num2)));
                float num3 = Mathf.Lerp(rect.anchorMin[axis], rect.anchorMax[axis], num);
                if (num != num3)
                {
                    list.Add(new SnapGuide(num * parentRect.rect.size[axis], false, RectTransformSnapping.GetGuideLineForRect(parentRect, axis, num)));
                }
            }
            foreach (Transform transform in parentSpace)
            {
                if (!(transform == self))
                {
                    RectTransform component = transform.GetComponent <RectTransform>();
                    if (component)
                    {
                        if (side == 0)
                        {
                            bool safe = component.anchorMin[axis] == rect.anchorMin[axis];
                            list.Add(new SnapGuide(component.GetRectInParentSpace().min[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0f)));
                            safe = (component.anchorMax[axis] == rect.anchorMin[axis]);
                            list.Add(new SnapGuide(component.GetRectInParentSpace().max[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 1f)));
                        }
                        if (side == 2)
                        {
                            bool safe = component.anchorMax[axis] == rect.anchorMax[axis];
                            list.Add(new SnapGuide(component.GetRectInParentSpace().max[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 1f)));
                            safe = (component.anchorMin[axis] == rect.anchorMax[axis]);
                            list.Add(new SnapGuide(component.GetRectInParentSpace().min[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0f)));
                        }
                        if (side == 1)
                        {
                            bool safe = component.anchorMin[axis] - rect.anchorMin[axis] == -(component.anchorMax[axis] - rect.anchorMax[axis]);
                            list.Add(new SnapGuide(component.GetRectInParentSpace().center[axis], safe, RectTransformSnapping.GetGuideLineForRect(component, axis, 0.5f)));
                        }
                    }
                }
            }
            return(list);
        }
 internal static void CalculatePivotSnapValues(Rect rect, Vector3 pivot, Quaternion rotation)
 {
     for (int axis = 0; axis < 2; ++axis)
     {
         RectTransformSnapping.s_SnapGuides[axis].Clear();
         for (int index = 0; index < RectTransformSnapping.kSidesAndMiddle.Length; ++index)
         {
             RectTransformSnapping.s_SnapGuides[axis].AddGuide(new SnapGuide(RectTransformSnapping.kSidesAndMiddle[index], RectTransformSnapping.GetGuideLineForRect(rect, pivot, rotation, axis, RectTransformSnapping.kSidesAndMiddle[index])));
         }
     }
 }
 internal static void CalculatePivotSnapValues(Rect rect, Vector3 pivot, Quaternion rotation)
 {
     for (int i = 0; i < 2; i++)
     {
         RectTransformSnapping.s_SnapGuides[i].Clear();
         for (int j = 0; j < RectTransformSnapping.kSidesAndMiddle.Length; j++)
         {
             RectTransformSnapping.s_SnapGuides[i].AddGuide(new SnapGuide(RectTransformSnapping.kSidesAndMiddle[j], RectTransformSnapping.GetGuideLineForRect(rect, pivot, rotation, i, RectTransformSnapping.kSidesAndMiddle[j])));
         }
     }
 }