Esempio n. 1
0
 public override void SetVertical(float y, float height)
 {
     if (this.entries.Count == 0)
     {
         base.SetVertical(y, height);
     }
     else if (this.isVertical)
     {
         base.SetVertical(y, height);
     }
     else
     {
         if (this.resetCoords)
         {
             y = 0.0f;
         }
         float num1 = y - (float)this.margin.top;
         float num2 = y + (float)this.margin.vertical - this.spacing * (float)(this.m_Lines - 1);
         float t    = 0.0f;
         if ((double)this.m_ChildMinHeight != (double)this.m_ChildMaxHeight)
         {
             t = Mathf.Clamp((float)(((double)num2 - (double)this.m_ChildMinHeight) / ((double)this.m_ChildMaxHeight - (double)this.m_ChildMinHeight)), 0.0f, 1f);
         }
         float num3 = num1;
         for (int index = 0; index < this.m_Lines; ++index)
         {
             if (index > 0)
             {
                 num3 += (float)Mathf.Max(this.m_LineInfo[index].topBorder, this.m_LineInfo[index - 1].bottomBorder);
             }
             this.m_LineInfo[index].start = num3;
             this.m_LineInfo[index].size  = Mathf.Lerp(this.m_LineInfo[index].minSize, this.m_LineInfo[index].maxSize, t);
             num3 += this.m_LineInfo[index].size + this.spacing;
         }
         using (List <GUILayoutEntry> .Enumerator enumerator = this.entries.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 GUILayoutEntry      current  = enumerator.Current;
                 FlowLayout.LineInfo lineInfo = this.m_LineInfo[(int)current.rect.y];
                 if (current.stretchHeight != 0)
                 {
                     current.SetVertical(lineInfo.start + (float)current.margin.top, lineInfo.size - (float)current.margin.vertical);
                 }
                 else
                 {
                     current.SetVertical(lineInfo.start + (float)current.margin.top, Mathf.Clamp(lineInfo.size - (float)current.margin.vertical, current.minHeight, current.maxHeight));
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public override void SetVertical(float y, float height)
 {
     if (this.entries.Count == 0)
     {
         base.SetVertical(y, height);
         return;
     }
     if (this.isVertical)
     {
         base.SetVertical(y, height);
     }
     else
     {
         if (this.resetCoords)
         {
             y = 0f;
         }
         float num  = y - (float)this.margin.top;
         float num2 = y + (float)this.margin.vertical;
         float num3 = num2 - this.spacing * (float)(this.m_Lines - 1);
         float t    = 0f;
         if (this.m_ChildMinHeight != this.m_ChildMaxHeight)
         {
             t = Mathf.Clamp((num3 - this.m_ChildMinHeight) / (this.m_ChildMaxHeight - this.m_ChildMinHeight), 0f, 1f);
         }
         float num4 = num;
         for (int i = 0; i < this.m_Lines; i++)
         {
             if (i > 0)
             {
                 num4 += (float)Mathf.Max(this.m_LineInfo[i].topBorder, this.m_LineInfo[i - 1].bottomBorder);
             }
             this.m_LineInfo[i].start = num4;
             this.m_LineInfo[i].size  = Mathf.Lerp(this.m_LineInfo[i].minSize, this.m_LineInfo[i].maxSize, t);
             num4 += this.m_LineInfo[i].size + this.spacing;
         }
         foreach (GUILayoutEntry current in this.entries)
         {
             FlowLayout.LineInfo lineInfo = this.m_LineInfo[(int)current.rect.y];
             if (current.stretchHeight != 0)
             {
                 current.SetVertical(lineInfo.start + (float)current.margin.top, lineInfo.size - (float)current.margin.vertical);
             }
             else
             {
                 current.SetVertical(lineInfo.start + (float)current.margin.top, Mathf.Clamp(lineInfo.size - (float)current.margin.vertical, current.minHeight, current.maxHeight));
             }
         }
     }
 }