public void UF_SetDirty() { if (this.IsActive()) { UILayoutTools.UF_MarkLayoutForRebuild(this); } }
protected void SetDirty() { if (!IsDestroyed() && this.IsActive()) { UILayoutTools.UF_MarkLayoutForRebuild(this); } }
private void UF_UpdateAttachedTargetSize(Vector2 sizeDelta) { if (m_attachedTargets != null && m_attachedTargets.Count > 0) { foreach (var item in m_attachedTargets) { Vector2 size = new Vector2(Mathf.Min(sizeDelta.x, rectTransform.sizeDelta.x), Mathf.Min(sizeDelta.y, rectTransform.sizeDelta.y)); if (item.target != null) { UILayoutTools.UF_ContentSizeFitter(item.target, item.fitterType, size, item.padding); } } } }
//构建布局 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); }
//构建布局 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); }
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); }
protected override void OnDisable() { UILayoutTools.UF_MarkLayoutForRebuild(this); base.OnDisable(); }
protected override void OnDisable() { //LayoutRebuilder.MarkLayoutForRebuild (this.rectTransform); UILayoutTools.UF_MarkLayoutForRebuild(this); base.OnDisable(); }