hch
12 小时以前 4a1d377abd9b7b4cdb874e009bbfbe56206bdf82
0312 图鉴界面强制刷新排版
1个文件已修改
28 ■■■■■ 已修改文件
Main/System/HeroUI/HeroBestWin.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroBestWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -159,8 +160,31 @@
        RefreshFetter();
        RefreshGift();
        RefreshAwake();
        ForceRefreshLayout();
    }
    /// <summary>
    /// 强制刷新Layout,解决嵌套Layout和ContentSizeFitter的重叠问题
    /// </summary>
    async UniTask ForceRefreshLayout()
    {
        await UniTask.DelayFrame(2);
        // 刷新所有Layout组件
        var layouts = allAttrScroll.GetComponentsInChildren<LayoutGroup>(true);
        foreach (var layout in layouts)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
        }
        await UniTask.DelayFrame(2);
        // 刷新所有Layout组件
        foreach (var layout in layouts)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
        }
    }
    void RefreshConn()
@@ -257,6 +281,8 @@
            attrPanel.localPosition = foldPos.localPosition;
            // //禁止attrScroll滚动
            // allAttrScroll.enabled = false;
            var _rect = allAttrScroll.GetComponent<RectTransform>();
            _rect.sizeDelta = new Vector2(_rect.rect.width, 197);
        }
        else
@@ -265,6 +291,8 @@
            unfoldImg.SetActive(true);
            attrPanel.localPosition = unfoldPos.localPosition;
            // allAttrScroll.enabled = true;
            var _rect = allAttrScroll.GetComponent<RectTransform>();
            _rect.sizeDelta = new Vector2(_rect.rect.width, 933);
        }
    }