UnityEngine.GUILayoutUtility.LayoutSingleGroup C# (CSharp) Method

LayoutSingleGroup() private static method

private static LayoutSingleGroup ( GUILayoutGroup i ) : void
i GUILayoutGroup
return void
        private static void LayoutSingleGroup(GUILayoutGroup i)
        {
            if (!i.isWindow)
            {
                float minWidth = i.minWidth;
                float maxWidth = i.maxWidth;
                i.CalcWidth();
                i.SetHorizontal(i.rect.x, Mathf.Clamp(i.maxWidth, minWidth, maxWidth));
                float minHeight = i.minHeight;
                float maxHeight = i.maxHeight;
                i.CalcHeight();
                i.SetVertical(i.rect.y, Mathf.Clamp(i.maxHeight, minHeight, maxHeight));
            }
            else
            {
                i.CalcWidth();
                Rect rect = Internal_GetWindowRect(i.windowID);
                i.SetHorizontal(rect.x, Mathf.Clamp(rect.width, i.minWidth, i.maxWidth));
                i.CalcHeight();
                i.SetVertical(rect.y, Mathf.Clamp(rect.height, i.minHeight, i.maxHeight));
                Internal_MoveWindow(i.windowID, i.rect);
            }
        }

Usage Example

コード例 #1
0
        internal static float LayoutFromInspector(float width)
        {
            bool  flag = GUILayoutUtility.current.topLevel != null && GUILayoutUtility.current.topLevel.windowID == -1;
            float result;

            if (flag)
            {
                GUILayoutUtility.current.topLevel.CalcWidth();
                GUILayoutUtility.current.topLevel.SetHorizontal(0f, width);
                GUILayoutUtility.current.topLevel.CalcHeight();
                GUILayoutUtility.current.topLevel.SetVertical(0f, Mathf.Min((float)Screen.height / GUIUtility.pixelsPerPoint, GUILayoutUtility.current.topLevel.maxHeight));
                float minHeight = GUILayoutUtility.current.topLevel.minHeight;
                GUILayoutUtility.LayoutFreeGroup(GUILayoutUtility.current.windows);
                result = minHeight;
            }
            else
            {
                bool flag2 = GUILayoutUtility.current.topLevel != null;
                if (flag2)
                {
                    GUILayoutUtility.LayoutSingleGroup(GUILayoutUtility.current.topLevel);
                }
                result = 0f;
            }
            return(result);
        }
All Usage Examples Of UnityEngine.GUILayoutUtility::LayoutSingleGroup