public override string ToString() { string empty1 = string.Empty; string empty2 = string.Empty; for (int index = 0; index < GUILayoutEntry.indent; ++index) { empty2 += " "; } string str1 = empty1 + base.ToString() + " Margins: " + (object)this.m_ChildMinHeight + " {\n"; GUILayoutEntry.indent += 4; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; str1 = str1 + current.ToString() + "\n"; } } string str2 = str1 + empty2 + "}"; GUILayoutEntry.indent -= 4; return(str2); }
public override string ToString() { string text = ""; string text2 = ""; for (int i = 0; i < GUILayoutEntry.indent; i++) { text2 += " "; } text = string.Concat(new string[] { text, base.ToString(), " Margins: ", this.m_ChildMinHeight.ToString(), " {\n" }); GUILayoutEntry.indent += 4; foreach (GUILayoutEntry current in this.entries) { string arg_9E_0 = text; GUILayoutEntry expr_8D = current; text = arg_9E_0 + ((expr_8D != null) ? expr_8D.ToString() : null) + "\n"; } text = text + text2 + "}"; GUILayoutEntry.indent -= 4; return(text); }
public Rect GetLast() { Rect result; if (this.m_Cursor == 0) { Debug.LogError("You cannot call GetLast immediately after beginning a group."); result = GUILayoutEntry.kDummyRect; } else if (this.m_Cursor <= this.entries.Count) { GUILayoutEntry gUILayoutEntry = this.entries[this.m_Cursor - 1]; result = gUILayoutEntry.rect; } else { Debug.LogError(string.Concat(new object[] { "Getting control ", this.m_Cursor, "'s position in a group with only ", this.entries.Count, " controls when doing ", Event.current.type })); result = GUILayoutEntry.kDummyRect; } return(result); }
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); }
public GUILayoutEntry GetNext() { bool flag = this.m_Cursor < this.entries.Count; GUILayoutEntry result; if (flag) { GUILayoutEntry gUILayoutEntry = this.entries[this.m_Cursor]; this.m_Cursor++; result = gUILayoutEntry; } else { bool flag2 = Event.current.type == EventType.Repaint; if (flag2) { throw new ArgumentException(string.Concat(new string[] { "Getting control ", this.m_Cursor.ToString(), "'s position in a group with only ", this.entries.Count.ToString(), " controls when doing ", Event.current.rawType.ToString(), "\nAborting" })); } result = GUILayoutGroup.none; } return(result); }
public Rect PeekNext() { if (m_Cursor < entries.Count) { GUILayoutEntry gUILayoutEntry = entries[m_Cursor]; return(gUILayoutEntry.rect); } throw new ArgumentException("Getting control " + m_Cursor + "'s position in a group with only " + entries.Count + " controls when doing " + Event.current.rawType + "\nAborting"); }
public GUILayoutEntry GetNext() { if (this.m_Cursor < this.entries.Count) { GUILayoutEntry entry = this.entries[this.m_Cursor]; ++this.m_Cursor; return(entry); } throw new ArgumentException("Getting control " + (object)this.m_Cursor + "'s position in a group with only " + (object)this.entries.Count + " controls when doing " + (object)Event.current.rawType + "\nAborting"); }
public Rect PeekNext() { if (this.m_Cursor < this.entries.Count) { GUILayoutEntry entry = this.entries[this.m_Cursor]; return(entry.rect); } object[] objArray1 = new object[] { "Getting control ", this.m_Cursor, "'s position in a group with only ", this.entries.Count, " controls when doing ", Event.current.rawType, "\nAborting" }; throw new ArgumentException(string.Concat(objArray1)); }
public GUILayoutEntry GetNext() { if (m_Cursor < entries.Count) { GUILayoutEntry e = (GUILayoutEntry)entries[m_Cursor]; m_Cursor++; return(e); } throw new ArgumentException("Getting control " + m_Cursor + "'s position in a group with only " + entries.Count + " controls when doing " + Event.current.rawType + "\nAborting"); }
private void AddYRecursive(GUILayoutEntry e, float y) { e.rect.y = e.rect.y + y; GUILayoutGroup gUILayoutGroup = e as GUILayoutGroup; if (gUILayoutGroup != null) { for (int i = 0; i < gUILayoutGroup.entries.Count; i++) { this.AddYRecursive(gUILayoutGroup.entries[i], y); } } }
private static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options) { GUIUtility.CheckOnGUI(); EventType type = Event.current.type; Rect rect; if (type != EventType.Layout) { if (type != EventType.Used) { GUILayoutEntry next = GUILayoutUtility.current.topLevel.GetNext(); rect = next.rect; } else { rect = GUILayoutUtility.kDummyRect; } } else { if (style.isHeightDependantOnWidth) { GUILayoutUtility.current.topLevel.Add(new GUIWordWrapSizer(style, content, options)); } else { Vector2 constraints = new Vector2(0f, 0f); if (options != null) { foreach (GUILayoutOption guilayoutOption in options) { GUILayoutOption.Type type2 = guilayoutOption.type; if (type2 != GUILayoutOption.Type.maxHeight) { if (type2 == GUILayoutOption.Type.maxWidth) { constraints.x = (float)guilayoutOption.value; } } else { constraints.y = (float)guilayoutOption.value; } } } Vector2 vector = style.CalcSizeWithConstraints(content, constraints); GUILayoutUtility.current.topLevel.Add(new GUILayoutEntry(vector.x, vector.x, vector.y, vector.y, style, options)); } rect = GUILayoutUtility.kDummyRect; } return(rect); }
public Rect PeekNext() { if (m_Cursor < entries.Count) { GUILayoutEntry e = (GUILayoutEntry)entries[m_Cursor]; return(e.rect); } if (Event.current.type == EventType.Repaint) { throw new ArgumentException("Getting control " + m_Cursor + "'s position in a group with only " + entries.Count + " controls when doing " + Event.current.rawType + "\nAborting"); } return(kDummyRect); }
public Rect GetLast() { if (m_Cursor == 0) { Debug.LogError("You cannot call GetLast immediately after beginning a group."); return(GUILayoutEntry.kDummyRect); } if (m_Cursor <= entries.Count) { GUILayoutEntry gUILayoutEntry = entries[m_Cursor - 1]; return(gUILayoutEntry.rect); } Debug.LogError("Getting control " + m_Cursor + "'s position in a group with only " + entries.Count + " controls when doing " + Event.current.type); return(GUILayoutEntry.kDummyRect); }
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 gUILayoutOption in options) { switch (gUILayoutOption.type) { case GUILayoutOption.Type.maxHeight: constraints.y = (float)gUILayoutOption.value; break; case GUILayoutOption.Type.maxWidth: constraints.x = (float)gUILayoutOption.value; break; } } } Vector2 vector = style.CalcSizeWithConstraints(content, constraints); current.topLevel.Add(new GUILayoutEntry(vector.x, vector.x, vector.y, vector.y, style, options)); } return(kDummyRect); case EventType.Used: return(kDummyRect); default: { GUILayoutEntry next = current.topLevel.GetNext(); return(next.rect); } } }
public GUILayoutEntry GetNext() { if (this.m_Cursor < this.entries.Count) { GUILayoutEntry result = this.entries[this.m_Cursor]; this.m_Cursor++; return(result); } throw new ArgumentException(string.Concat(new object[] { "Getting control ", this.m_Cursor, "'s position in a group with only ", this.entries.Count, " controls when doing ", Event.current.rawType, "\nAborting" })); }
public Rect GetLast() { bool flag = this.m_Cursor == 0; Rect result; if (flag) { bool flag2 = Event.current.type == EventType.Repaint; if (flag2) { Debug.LogError("You cannot call GetLast immediately after beginning a group."); } result = GUILayoutEntry.kDummyRect; } else { bool flag3 = this.m_Cursor <= this.entries.Count; if (flag3) { GUILayoutEntry gUILayoutEntry = this.entries[this.m_Cursor - 1]; result = gUILayoutEntry.rect; } else { bool flag4 = Event.current.type == EventType.Repaint; if (flag4) { Debug.LogError(string.Concat(new string[] { "Getting control ", this.m_Cursor.ToString(), "'s position in a group with only ", this.entries.Count.ToString(), " controls when doing ", Event.current.rawType.ToString() })); } result = GUILayoutEntry.kDummyRect; } } return(result); }
public void Add(GUILayoutEntry e) { this.entries.Add(e); }
public override void SetHorizontal(float x, float width) { base.SetHorizontal(x, width); if (this.resetCoords) { x = 0.0f; } RectOffset padding = this.style.padding; if (this.isVertical) { if (this.style != GUIStyle.none) { using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; float num = (float)Mathf.Max(current.margin.left, padding.left); float x1 = x + num; float width1 = width - (float)Mathf.Max(current.margin.right, padding.right) - num; if (current.stretchWidth != 0) { current.SetHorizontal(x1, width1); } else { current.SetHorizontal(x1, Mathf.Clamp(width1, current.minWidth, current.maxWidth)); } } } } else { float num1 = x - (float)this.margin.left; float num2 = width + (float)this.margin.horizontal; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; if (current.stretchWidth != 0) { current.SetHorizontal(num1 + (float)current.margin.left, num2 - (float)current.margin.horizontal); } else { current.SetHorizontal(num1 + (float)current.margin.left, Mathf.Clamp(num2 - (float)current.margin.horizontal, current.minWidth, current.maxWidth)); } } } } } else { if (this.style != GUIStyle.none) { float a1 = (float)padding.left; float a2 = (float)padding.right; if (this.entries.Count != 0) { a1 = Mathf.Max(a1, (float)this.entries[0].margin.left); a2 = Mathf.Max(a2, (float)this.entries[this.entries.Count - 1].margin.right); } x += a1; width -= a2 + a1; } float num1 = width - this.spacing * (float)(this.entries.Count - 1); float t = 0.0f; if ((double)this.m_ChildMinWidth != (double)this.m_ChildMaxWidth) { t = Mathf.Clamp((float)(((double)num1 - (double)this.m_ChildMinWidth) / ((double)this.m_ChildMaxWidth - (double)this.m_ChildMinWidth)), 0.0f, 1f); } float num2 = 0.0f; if ((double)num1 > (double)this.m_ChildMaxWidth && this.m_StretchableCountX > 0) { num2 = (num1 - this.m_ChildMaxWidth) / (float)this.m_StretchableCountX; } int num3 = 0; bool flag = true; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; float f = Mathf.Lerp(current.minWidth, current.maxWidth, t) + num2 * (float)current.stretchWidth; if (current.style != GUILayoutUtility.spaceStyle) { int num4 = current.margin.left; if (flag) { num4 = 0; flag = false; } int num5 = num3 <= num4 ? num4 : num3; x += (float)num5; num3 = current.margin.right; } current.SetHorizontal(Mathf.Round(x), Mathf.Round(f)); x += f + this.spacing; } } } }
public override void SetVertical(float y, float height) { base.SetVertical(y, height); if (this.entries.Count == 0) { return; } RectOffset padding = this.style.padding; if (this.resetCoords) { y = 0.0f; } if (this.isVertical) { if (this.style != GUIStyle.none) { float a1 = (float)padding.top; float a2 = (float)padding.bottom; if (this.entries.Count != 0) { a1 = Mathf.Max(a1, (float)this.entries[0].margin.top); a2 = Mathf.Max(a2, (float)this.entries[this.entries.Count - 1].margin.bottom); } y += a1; height -= a2 + a1; } float num1 = height - this.spacing * (float)(this.entries.Count - 1); float t = 0.0f; if ((double)this.m_ChildMinHeight != (double)this.m_ChildMaxHeight) { t = Mathf.Clamp((float)(((double)num1 - (double)this.m_ChildMinHeight) / ((double)this.m_ChildMaxHeight - (double)this.m_ChildMinHeight)), 0.0f, 1f); } float num2 = 0.0f; if ((double)num1 > (double)this.m_ChildMaxHeight && this.m_StretchableCountY > 0) { num2 = (num1 - this.m_ChildMaxHeight) / (float)this.m_StretchableCountY; } int num3 = 0; bool flag = true; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; float f = Mathf.Lerp(current.minHeight, current.maxHeight, t) + num2 * (float)current.stretchHeight; if (current.style != GUILayoutUtility.spaceStyle) { int num4 = current.margin.top; if (flag) { num4 = 0; flag = false; } int num5 = num3 <= num4 ? num4 : num3; y += (float)num5; num3 = current.margin.bottom; } current.SetVertical(Mathf.Round(y), Mathf.Round(f)); y += f + this.spacing; } } } else if (this.style != GUIStyle.none) { using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; float num = (float)Mathf.Max(current.margin.top, padding.top); float y1 = y + num; float height1 = height - (float)Mathf.Max(current.margin.bottom, padding.bottom) - num; if (current.stretchHeight != 0) { current.SetVertical(y1, height1); } else { current.SetVertical(y1, Mathf.Clamp(height1, current.minHeight, current.maxHeight)); } } } } else { float num1 = y - (float)this.margin.top; float num2 = height + (float)this.margin.vertical; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; if (current.stretchHeight != 0) { current.SetVertical(num1 + (float)current.margin.top, num2 - (float)current.margin.vertical); } else { current.SetVertical(num1 + (float)current.margin.top, Mathf.Clamp(num2 - (float)current.margin.vertical, current.minHeight, current.maxHeight)); } } } } }
public override void CalcWidth() { if (this.entries.Count == 0) { this.maxWidth = this.minWidth = (float)this.style.padding.horizontal; } else { int b1 = 0; int b2 = 0; this.m_ChildMinWidth = 0.0f; this.m_ChildMaxWidth = 0.0f; this.m_StretchableCountX = 0; bool flag = true; if (this.isVertical) { using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; current.CalcWidth(); RectOffset margin = current.margin; if (current.style != GUILayoutUtility.spaceStyle) { if (!flag) { b1 = Mathf.Min(margin.left, b1); b2 = Mathf.Min(margin.right, b2); } else { b1 = margin.left; b2 = margin.right; flag = false; } this.m_ChildMinWidth = Mathf.Max(current.minWidth + (float)margin.horizontal, this.m_ChildMinWidth); this.m_ChildMaxWidth = Mathf.Max(current.maxWidth + (float)margin.horizontal, this.m_ChildMaxWidth); } this.m_StretchableCountX += current.stretchWidth; } } this.m_ChildMinWidth -= (float)(b1 + b2); this.m_ChildMaxWidth -= (float)(b1 + b2); } else { int num1 = 0; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; current.CalcWidth(); RectOffset margin = current.margin; if (current.style != GUILayoutUtility.spaceStyle) { int num2; if (!flag) { num2 = num1 <= margin.left ? margin.left : num1; } else { num2 = 0; flag = false; } this.m_ChildMinWidth += current.minWidth + this.spacing + (float)num2; this.m_ChildMaxWidth += current.maxWidth + this.spacing + (float)num2; num1 = margin.right; this.m_StretchableCountX += current.stretchWidth; } else { this.m_ChildMinWidth += current.minWidth; this.m_ChildMaxWidth += current.maxWidth; this.m_StretchableCountX += current.stretchWidth; } } } this.m_ChildMinWidth -= this.spacing; this.m_ChildMaxWidth -= this.spacing; if (this.entries.Count != 0) { b1 = this.entries[0].margin.left; b2 = num1; } else { b1 = b2 = 0; } } float num3; float num4; if (this.style != GUIStyle.none || this.m_UserSpecifiedWidth) { num3 = (float)Mathf.Max(this.style.padding.left, b1); num4 = (float)Mathf.Max(this.style.padding.right, b2); } else { this.m_Margin.left = b1; this.m_Margin.right = b2; num3 = num4 = 0.0f; } this.minWidth = Mathf.Max(this.minWidth, this.m_ChildMinWidth + num3 + num4); if ((double)this.maxWidth == 0.0) { this.stretchWidth += this.m_StretchableCountX + (!this.style.stretchWidth ? 0 : 1); this.maxWidth = this.m_ChildMaxWidth + num3 + num4; } else { this.stretchWidth = 0; } this.maxWidth = Mathf.Max(this.maxWidth, this.minWidth); if ((double)this.style.fixedWidth == 0.0) { return; } this.maxWidth = this.minWidth = this.style.fixedWidth; this.stretchWidth = 0; } }
public override void CalcHeight() { if (this.entries.Count == 0) { this.maxHeight = this.minHeight = (float)this.style.padding.vertical; } else { int b1 = 0; int b2 = 0; this.m_ChildMinHeight = 0.0f; this.m_ChildMaxHeight = 0.0f; this.m_StretchableCountY = 0; if (this.isVertical) { int a = 0; bool flag = true; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; current.CalcHeight(); RectOffset margin = current.margin; if (current.style != GUILayoutUtility.spaceStyle) { int num; if (!flag) { num = Mathf.Max(a, margin.top); } else { num = 0; flag = false; } this.m_ChildMinHeight += current.minHeight + this.spacing + (float)num; this.m_ChildMaxHeight += current.maxHeight + this.spacing + (float)num; a = margin.bottom; this.m_StretchableCountY += current.stretchHeight; } else { this.m_ChildMinHeight += current.minHeight; this.m_ChildMaxHeight += current.maxHeight; this.m_StretchableCountY += current.stretchHeight; } } } this.m_ChildMinHeight -= this.spacing; this.m_ChildMaxHeight -= this.spacing; if (this.entries.Count != 0) { b1 = this.entries[0].margin.top; b2 = a; } else { b2 = b1 = 0; } } else { bool flag = true; using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator()) { while (enumerator.MoveNext()) { GUILayoutEntry current = enumerator.Current; current.CalcHeight(); RectOffset margin = current.margin; if (current.style != GUILayoutUtility.spaceStyle) { if (!flag) { b1 = Mathf.Min(margin.top, b1); b2 = Mathf.Min(margin.bottom, b2); } else { b1 = margin.top; b2 = margin.bottom; flag = false; } this.m_ChildMinHeight = Mathf.Max(current.minHeight, this.m_ChildMinHeight); this.m_ChildMaxHeight = Mathf.Max(current.maxHeight, this.m_ChildMaxHeight); } this.m_StretchableCountY += current.stretchHeight; } } } float num1; float num2; if (this.style != GUIStyle.none || this.m_UserSpecifiedHeight) { num1 = (float)Mathf.Max(this.style.padding.top, b1); num2 = (float)Mathf.Max(this.style.padding.bottom, b2); } else { this.m_Margin.top = b1; this.m_Margin.bottom = b2; num1 = num2 = 0.0f; } this.minHeight = Mathf.Max(this.minHeight, this.m_ChildMinHeight + num1 + num2); if ((double)this.maxHeight == 0.0) { this.stretchHeight += this.m_StretchableCountY + (!this.style.stretchHeight ? 0 : 1); this.maxHeight = this.m_ChildMaxHeight + num1 + num2; } else { this.stretchHeight = 0; } this.maxHeight = Mathf.Max(this.maxHeight, this.minHeight); if ((double)this.style.fixedHeight == 0.0) { return; } this.maxHeight = this.minHeight = this.style.fixedHeight; this.stretchHeight = 0; } }
private void AddYRecursive(GUILayoutEntry e, float y) { e.rect.y += y; GUILayoutGroup guiLayoutGroup = e as GUILayoutGroup; if (guiLayoutGroup == null) return; for (int index = 0; index < guiLayoutGroup.entries.Count; ++index) this.AddYRecursive(guiLayoutGroup.entries[index], y); }
public GUILayoutEntry GetNext() => default; // 0x0000000180A1DE50-0x0000000180A1E120 public void Add(GUILayoutEntry e) { } // 0x0000000180A1CAA0-0x0000000180A1CB00