// The matching end for BeginLayoutGroup
        internal static void EndLayoutGroup()
        {
            if (current.layoutGroups.Count == 0 ||
                Event.current == null
                )
            {
                Debug.LogError("EndLayoutGroup: BeginLayoutGroup must be called first.");

                return;
            }
            if (Event.current.type != EventType.Layout && Event.current.type != EventType.Used)
            {
                GUIDebugger.LogLayoutEndGroup();
            }

            current.layoutGroups.Pop();
            if (0 < current.layoutGroups.Count)
            {
                current.topLevel = (GUILayoutGroup)current.layoutGroups.Peek();
            }
            else
            {
                current.topLevel = new 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);
        }
        internal static GUILayoutGroup BeginLayoutArea(GUIStyle style, Type layoutType)
        {
            EventType      type = Event.current.type;
            GUILayoutGroup gUILayoutGroup;

            if (type != EventType.Used && type != EventType.Layout)
            {
                gUILayoutGroup = (GUILayoutUtility.current.windows.GetNext() as GUILayoutGroup);
                if (gUILayoutGroup == null)
                {
                    throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
                }
                gUILayoutGroup.ResetCursor();
                GUIDebugger.LogLayoutGroupEntry(gUILayoutGroup.rect, gUILayoutGroup.margin, gUILayoutGroup.style, gUILayoutGroup.isVertical);
            }
            else
            {
                gUILayoutGroup       = GUILayoutUtility.CreateGUILayoutGroupInstanceOfType(layoutType);
                gUILayoutGroup.style = style;
                GUILayoutUtility.current.windows.Add(gUILayoutGroup);
            }
            GUILayoutUtility.current.layoutGroups.Push(gUILayoutGroup);
            GUILayoutUtility.current.topLevel = gUILayoutGroup;
            return(gUILayoutGroup);
        }
Exemple #4
0
        internal static GUILayoutGroup BeginLayoutArea(GUIStyle style, Type layoutType)
        {
            EventType      type      = Event.current.type;
            EventType      eventType = type;
            GUILayoutGroup gUILayoutGroup;

            if (eventType != EventType.Layout && eventType != EventType.Used)
            {
                gUILayoutGroup = (GUILayoutUtility.current.windows.GetNext() as GUILayoutGroup);
                bool flag = gUILayoutGroup == null;
                if (flag)
                {
                    throw new ExitGUIException("GUILayout: Mismatched LayoutGroup." + Event.current.type.ToString());
                }
                gUILayoutGroup.ResetCursor();
                GUIDebugger.LogLayoutGroupEntry(gUILayoutGroup.rect, gUILayoutGroup.marginLeft, gUILayoutGroup.marginRight, gUILayoutGroup.marginTop, gUILayoutGroup.marginBottom, gUILayoutGroup.style, gUILayoutGroup.isVertical);
            }
            else
            {
                gUILayoutGroup       = GUILayoutUtility.CreateGUILayoutGroupInstanceOfType(layoutType);
                gUILayoutGroup.style = style;
                GUILayoutUtility.current.windows.Add(gUILayoutGroup);
            }
            GUILayoutUtility.current.layoutGroups.Push(gUILayoutGroup);
            GUILayoutUtility.current.topLevel = gUILayoutGroup;
            return(gUILayoutGroup);
        }
Exemple #5
0
        private static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options)
        {
            GUIUtility.CheckOnGUI();
            EventType type      = Event.current.type;
            EventType eventType = type;
            Rect      rect;

            if (eventType != EventType.Layout)
            {
                if (eventType != EventType.Used)
                {
                    GUILayoutEntry next = GUILayoutUtility.current.topLevel.GetNext();
                    GUIDebugger.LogLayoutEntry(next.rect, next.marginLeft, next.marginRight, next.marginTop, next.marginBottom, next.style);
                    rect = next.rect;
                }
                else
                {
                    rect = GUILayoutUtility.kDummyRect;
                }
            }
            else
            {
                bool isHeightDependantOnWidth = style.isHeightDependantOnWidth;
                if (isHeightDependantOnWidth)
                {
                    GUILayoutUtility.current.topLevel.Add(new GUIWordWrapSizer(style, content, options));
                }
                else
                {
                    Vector2 constraints = new Vector2(0f, 0f);
                    bool    flag        = options != null;
                    if (flag)
                    {
                        for (int i = 0; i < options.Length; i++)
                        {
                            GUILayoutOption      gUILayoutOption = options[i];
                            GUILayoutOption.Type type2           = gUILayoutOption.type;
                            GUILayoutOption.Type type3           = type2;
                            if (type3 != GUILayoutOption.Type.maxWidth)
                            {
                                if (type3 == GUILayoutOption.Type.maxHeight)
                                {
                                    constraints.y = (float)gUILayoutOption.value;
                                }
                            }
                            else
                            {
                                constraints.x = (float)gUILayoutOption.value;
                            }
                        }
                    }
                    Vector2 vector = style.CalcSizeWithConstraints(content, constraints);
                    vector.x = Mathf.Ceil(vector.x);
                    vector.y = Mathf.Ceil(vector.y);
                    GUILayoutUtility.current.topLevel.Add(new GUILayoutEntry(vector.x, vector.x, vector.y, vector.y, style, options));
                }
                rect = GUILayoutUtility.kDummyRect;
            }
            return(rect);
        }
Exemple #6
0
        internal static void EndLayoutGroup()
        {
            bool flag = GUILayoutUtility.current.layoutGroups.Count == 0 || Event.current == null;

            if (flag)
            {
                Debug.LogError("EndLayoutGroup: BeginLayoutGroup must be called first.");
            }
            else
            {
                bool flag2 = Event.current.type != EventType.Layout && Event.current.type != EventType.Used;
                if (flag2)
                {
                    GUIDebugger.LogLayoutEndGroup();
                }
                GUILayoutUtility.current.layoutGroups.Pop();
                bool flag3 = 0 < GUILayoutUtility.current.layoutGroups.Count;
                if (flag3)
                {
                    GUILayoutUtility.current.topLevel = (GUILayoutGroup)GUILayoutUtility.current.layoutGroups.Peek();
                }
                else
                {
                    GUILayoutUtility.current.topLevel = new GUILayoutGroup();
                }
            }
        }
Exemple #7
0
        // Generic helper - use this when creating a layoutgroup. It will make sure everything is wired up correctly.
        internal static GUILayoutGroup BeginLayoutGroup(GUIStyle style, GUILayoutOption[] options, Type layoutType)
        {
            unbalancedgroupscount++;
            GUILayoutGroup g;

            switch (Event.current.type)
            {
            case EventType.Used:
            case EventType.Layout:
                g       = CreateGUILayoutGroupInstanceOfType(layoutType);
                g.style = style;
                if (options != null)
                {
                    g.ApplyOptions(options);
                }
                current.topLevel.Add(g);
                break;

            default:
                g = current.topLevel.GetNext() as GUILayoutGroup;
                if (g == null)
                {
                    throw new ExitGUIException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
                }
                g.ResetCursor();
                GUIDebugger.LogLayoutGroupEntry(g.rect, g.marginLeft, g.marginRight, g.marginTop, g.marginBottom, g.style, g.isVertical);
                break;
            }
            current.layoutGroups.Push(g);
            current.topLevel = g;
            return(g);
        }
        // Generic helper - use this when creating a layout group. It will make sure everything is wired up correctly.
        internal static GUILayoutGroup BeginLayoutArea(GUIStyle style, Type layoutType)
        {
            GUILayoutGroup g;

            switch (Event.current.type)
            {
            case EventType.Used:
            case EventType.Layout:
                g       = CreateGUILayoutGroupInstanceOfType(layoutType);
                g.style = style;
                current.windows.Add(g);
                break;

            default:
                g = current.windows.GetNext() as GUILayoutGroup;
                if (g == null)
                {
                    throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
                }
                g.ResetCursor();
                GUIDebugger.LogLayoutGroupEntry(g.rect, g.marginLeft, g.marginRight, g.marginTop, g.marginBottom, g.style, g.isVertical);
                break;
            }
            current.layoutGroups.Push(g);
            current.topLevel = g;
            return(g);
        }
        internal static void EndLayoutGroup()
        {
            if (Event.current.type != EventType.Layout && Event.current.type != EventType.Used)
            {
                GUIDebugger.LogLayoutEndGroup();
            }
            EventType arg_31_0 = Event.current.type;

            GUILayoutUtility.current.layoutGroups.Pop();
            GUILayoutUtility.current.topLevel = ((0 >= GUILayoutUtility.current.layoutGroups.Count) ? null : ((GUILayoutGroup)GUILayoutUtility.current.layoutGroups.Peek()));
        }
        internal static void EndLayoutGroup()
        {
            if ((Event.current.type != EventType.Layout) && (Event.current.type != EventType.Used))
            {
                GUIDebugger.LogLayoutEndGroup();
            }
            EventType type = Event.current.type;

            current.layoutGroups.Pop();
            current.topLevel = (0 >= current.layoutGroups.Count) ? null : ((GUILayoutGroup)current.layoutGroups.Peek());
        }
        static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options)
        {
            GUIUtility.CheckOnGUI();

            switch (Event.current.type)
            {
            case EventType.Layout:
                if (style.isHeightDependantOnWidth)
                {
                    current.topLevel.Add(new GUIWordWrapSizer(style, content, options));
                }
                else
                {
                    Vector2 sizeConstraints = new Vector2(0, 0);
                    if (options != null)
                    {
                        foreach (var option in options)
                        {
                            switch (option.type)
                            {
                            case GUILayoutOption.Type.maxHeight:
                                sizeConstraints.y = (float)option.value;
                                break;

                            case GUILayoutOption.Type.maxWidth:
                                sizeConstraints.x = (float)option.value;
                                break;
                            }
                        }
                    }

                    Vector2 size = style.CalcSizeWithConstraints(content, sizeConstraints);
                    // This is needed on non-integer scale ratios to avoid errors to accumulate in further layout calculations
                    size.x = Mathf.Ceil(size.x);
                    size.y = Mathf.Ceil(size.y);
                    current.topLevel.Add(new GUILayoutEntry(size.x, size.x, size.y, size.y, style, options));
                }
                return(kDummyRect);

            case EventType.Used:
                return(kDummyRect);

            default:
                var entry = current.topLevel.GetNext();
                GUIDebugger.LogLayoutEntry(entry.rect, entry.marginLeft, entry.marginRight, entry.marginTop, entry.marginBottom, entry.style);
                return(entry.rect);
            }
        }
Exemple #12
0
 internal static void EndLayoutGroup()
 {
     if (GUILayoutUtility.current.layoutGroups.Count == 0 || Event.current == null)
     {
         Debug.LogError("EndLayoutGroup: BeginLayoutGroup must be called first.");
     }
     else
     {
         if (Event.current.type != EventType.Layout && Event.current.type != EventType.Used)
         {
             GUIDebugger.LogLayoutEndGroup();
         }
         EventType arg_5F_0 = Event.current.type;
         GUILayoutUtility.current.layoutGroups.Pop();
         GUILayoutUtility.current.topLevel = ((0 >= GUILayoutUtility.current.layoutGroups.Count) ? null : ((GUILayoutGroup)GUILayoutUtility.current.layoutGroups.Peek()));
     }
 }
Exemple #13
0
        static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options)
        {
            GUIUtility.CheckOnGUI();

            switch (Event.current.type)
            {
            case EventType.Layout:
                if (style.isHeightDependantOnWidth)
                {
                    current.topLevel.Add(new GUIWordWrapSizer(style, content, options));
                }
                else
                {
                    Vector2 sizeConstraints = new Vector2(0, 0);
                    if (options != null)
                    {
                        foreach (var option in options)
                        {
                            switch (option.type)
                            {
                            case GUILayoutOption.Type.maxHeight:
                                sizeConstraints.y = (float)option.value;
                                break;

                            case GUILayoutOption.Type.maxWidth:
                                sizeConstraints.x = (float)option.value;
                                break;
                            }
                        }
                    }

                    Vector2 size = style.CalcSizeWithConstraints(content, sizeConstraints);
                    current.topLevel.Add(new GUILayoutEntry(size.x, size.x, size.y, size.y, style, options));
                }
                return(kDummyRect);

            case EventType.Used:
                return(kDummyRect);

            default:
                var entry = current.topLevel.GetNext();
                GUIDebugger.LogLayoutEntry(entry.rect, entry.margin, entry.style);
                return(entry.rect);
            }
        }
        private static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options)
        {
            GUIUtility.CheckOnGUI();
            switch (Event.current.type)
            {
            case EventType.Layout:
                if (style.isHeightDependantOnWidth)
                {
                    current.topLevel.Add(new GUIWordWrapSizer(style, content, options));
                }
                else
                {
                    Vector2 constraints = new Vector2(0f, 0f);
                    if (options != null)
                    {
                        foreach (GUILayoutOption option in options)
                        {
                            switch (option.type)
                            {
                            case GUILayoutOption.Type.maxHeight:
                                constraints.y = (float)option.value;
                                break;

                            case GUILayoutOption.Type.maxWidth:
                                constraints.x = (float)option.value;
                                break;
                            }
                        }
                    }
                    Vector2 vector2 = style.CalcSizeWithConstraints(content, constraints);
                    current.topLevel.Add(new GUILayoutEntry(vector2.x, vector2.x, vector2.y, vector2.y, style, options));
                }
                return(kDummyRect);

            case EventType.Used:
                return(kDummyRect);
            }
            GUILayoutEntry next = current.topLevel.GetNext();

            GUIDebugger.LogLayoutEntry(next.rect, next.margin, next.style);
            return(next.rect);
        }
 public static void LogLayoutGroupEntry(Rect rect, RectOffset margins, GUIStyle style, bool isVertical)
 {
     GUIDebugger.INTERNAL_CALL_LogLayoutGroupEntry(ref rect, margins, style, isVertical);
 }
Exemple #16
0
 public static void LogLayoutGroupEntry(Rect rect, RectOffset margins, GUIStyle style, bool isVertical)
 {
     GUIDebugger.LogLayoutGroupEntry_Injected(ref rect, margins, style, isVertical);
 }
Exemple #17
0
 public static void LogLayoutEntry(Rect rect, int left, int right, int top, int bottom, GUIStyle style)
 {
     GUIDebugger.LogLayoutEntry_Injected(ref rect, left, right, top, bottom, style);
 }
Exemple #18
0
 public static void LogLayoutGroupEntry(Rect rect, int left, int right, int top, int bottom, GUIStyle style, bool isVertical)
 {
     GUIDebugger.LogLayoutGroupEntry_Injected(ref rect, left, right, top, bottom, style, isVertical);
 }
Exemple #19
0
 public static void LogBeginProperty(string targetTypeAssemblyQualifiedName, string path, Rect position)
 {
     GUIDebugger.LogBeginProperty_Injected(targetTypeAssemblyQualifiedName, path, ref position);
 }
Exemple #20
0
 public static void LogLayoutEntry(Rect rect, RectOffset margins, GUIStyle style)
 {
     GUIDebugger.LogLayoutEntry_Injected(ref rect, margins, style);
 }
 public static void LogLayoutEntry(Rect rect, RectOffset margins, GUIStyle style)
 {
     GUIDebugger.INTERNAL_CALL_LogLayoutEntry(ref rect, margins, style);
 }