UnityEngine.GUILayoutEntry.CalcHeight C# (CSharp) Method

CalcHeight() public method

public CalcHeight ( ) : void
return void
        public virtual void CalcHeight()
        {
        }

Usage Example

コード例 #1
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;
     }
 }