UnityEngine.GUILayoutUtility.BeginLayoutGroup C# (CSharp) Method

BeginLayoutGroup() static private method

static private BeginLayoutGroup ( GUIStyle style, GUILayoutOption options, System layoutType ) : GUILayoutGroup
style GUIStyle
options GUILayoutOption
layoutType System
return GUILayoutGroup
        internal static GUILayoutGroup BeginLayoutGroup(GUIStyle style, GUILayoutOption[] options, System.Type layoutType)
        {
            GUILayoutGroup next;
            switch (Event.current.type)
            {
                case EventType.Used:
                case EventType.Layout:
                    next = CreateGUILayoutGroupInstanceOfType(layoutType);
                    next.style = style;
                    if (options != null)
                    {
                        next.ApplyOptions(options);
                    }
                    current.topLevel.Add(next);
                    break;

                default:
                    next = current.topLevel.GetNext() as GUILayoutGroup;
                    if (next == null)
                    {
                        throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
                    }
                    next.ResetCursor();
                    GUIDebugger.LogLayoutGroupEntry(next.rect, next.margin, next.style, next.isVertical);
                    break;
            }
            current.layoutGroups.Push(next);
            current.topLevel = next;
            return next;
        }

Usage Example

コード例 #1
0
ファイル: GUILayout.cs プロジェクト: zvars/UnityCsReference
        // Begin an automatically laid out scrollview.
        public static Vector2 BeginScrollView(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options)
        {
            GUIUtility.CheckOnGUI();

            GUIScrollGroup g = (GUIScrollGroup)GUILayoutUtility.BeginLayoutGroup(background, null, typeof(GUIScrollGroup));

            switch (Event.current.type)
            {
            case EventType.Layout:
                g.resetCoords              = true;
                g.isVertical               = true;
                g.stretchWidth             = 1;
                g.stretchHeight            = 1;
                g.verticalScrollbar        = verticalScrollbar;
                g.horizontalScrollbar      = horizontalScrollbar;
                g.needsVerticalScrollbar   = alwaysShowVertical;
                g.needsHorizontalScrollbar = alwaysShowHorizontal;
                g.ApplyOptions(options);
                break;

            default:
                break;
            }
            return(GUI.BeginScrollView(g.rect, scrollPosition, new Rect(0, 0, g.clientWidth, g.clientHeight), alwaysShowHorizontal, alwaysShowVertical, horizontalScrollbar, verticalScrollbar, background));
        }
All Usage Examples Of UnityEngine.GUILayoutUtility::BeginLayoutGroup