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));
}