PopupLeft() private static method

private static PopupLeft ( Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, Rect &resultRect ) : bool
buttonRect UnityEngine.Rect
minSize UnityEngine.Vector2
maxSize UnityEngine.Vector2
popupContainerWindow ContainerWindow
resultRect UnityEngine.Rect
return bool
Exemplo n.º 1
0
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[2]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                }
            }
            ;
            List <Rect> rects = new List <Rect>();
            Rect        resultRect;

            foreach (int num in locationPriorityOrder)
            {
                switch (num)
                {
                case 0:
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 1:
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 2:
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 3:
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;
                }
            }
            return(PopupLocationHelper.GetLargestRect(rects));
        }
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                };
            }
            List <Rect> list = new List <Rect>();

            PopupLocationHelper.PopupLocation[] array = locationPriorityOrder;
            for (int i = 0; i < array.Length; i++)
            {
                switch (array[i])
                {
                case PopupLocationHelper.PopupLocation.Below:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Above:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Left:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Right:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }
                }
            }
            return(PopupLocationHelper.GetLargestRect(list));
        }