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