UnityEngine.UI.GridLayoutGroup.CalculateLayoutInputVertical C# (CSharp) Method

CalculateLayoutInputVertical() public method

Called by the layout system.

public CalculateLayoutInputVertical ( ) : void
return void
        public override void CalculateLayoutInputVertical()
        {
            int constraintCount = 0;
            if (this.m_Constraint == Constraint.FixedColumnCount)
            {
                constraintCount = Mathf.CeilToInt((((float) base.rectChildren.Count) / ((float) this.m_ConstraintCount)) - 0.001f);
            }
            else if (this.m_Constraint == Constraint.FixedRowCount)
            {
                constraintCount = this.m_ConstraintCount;
            }
            else
            {
                float x = base.rectTransform.rect.size.x;
                int num3 = Mathf.Max(1, Mathf.FloorToInt((((x - base.padding.horizontal) + this.spacing.x) + 0.001f) / (this.cellSize.x + this.spacing.x)));
                constraintCount = Mathf.CeilToInt(((float) base.rectChildren.Count) / ((float) num3));
            }
            float totalMin = (base.padding.vertical + ((this.cellSize.y + this.spacing.y) * constraintCount)) - this.spacing.y;
            base.SetLayoutInputForAxis(totalMin, totalMin, -1f, 1);
        }

Usage Example

コード例 #1
0
 static public int CalculateLayoutInputVertical(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.GridLayoutGroup self = (UnityEngine.UI.GridLayoutGroup)checkSelf(l);
         self.CalculateLayoutInputVertical();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
All Usage Examples Of UnityEngine.UI.GridLayoutGroup::CalculateLayoutInputVertical