Example #1
0
        //构建布局
        public void UF_RebuildLoyout()
        {
            if (rectTransform == null)
            {
                return;
            }

            if (this.IsActive() && m_FitterType != SizeFitterType.None)
            {
                var gridSize = UILayoutTools.UF_BuildLayoutGrid(this.rectTransform, m_Alignement, m_Padding, m_Space, m_Constraint);
                UILayoutTools.UF_ContentSizeFitter(this.rectTransform, m_FitterType, gridSize);
            }

            //重构本层
            UILayoutTools.UF_RebuildSiblingLayout(this);

            //重构上层布局
            UILayoutTools.UF_RebuildParentLayout(this);
        }
Example #2
0
        //构建布局
        protected virtual void OnRebuildLoyout()
        {
            if (rectTransform == null)
            {
                return;
            }

            //构建布局
            Vector2 layoutSize = UILayoutTools.UF_BuildLayoutGrid(rectTransform, m_Alignement, m_Padding, m_Space, m_Constraint);

            //内容大小自适应
            UILayoutTools.UF_ContentSizeFitter(rectTransform, m_FitterType, layoutSize);

            //重构本层
            UILayoutTools.UF_RebuildSiblingLayout(this);

            //重构上层布局
            UILayoutTools.UF_RebuildParentLayout(this);
        }
Example #3
0
 public void UF_RebuildLoyout()
 {
     if (rectTransform == null)
     {
         return;
     }
     //float size = LayoutUtility.GetPreferredSize(this.rectTransform, (int)axis);
     if (this.IsActive() && m_FitterType != SizeFitterType.None)
     {
         Vector2 size      = UF_GetPreferredSize(this.rectTransform);
         Vector2 sizeDelta = UF_GetSizeWithCurrentAnchors(this.rectTransform, size);
         UILayoutTools.UF_ContentSizeFitter(this.rectTransform, m_FitterType, sizeDelta);
         UF_UpdateAttachedTargetSize(sizeDelta);
     }
     //重构本层
     UILayoutTools.UF_RebuildSiblingLayout(this);
     //重构上层布局
     UILayoutTools.UF_RebuildParentLayout(this);
 }