From 4a1d377abd9b7b4cdb874e009bbfbe56206bdf82 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 10 十一月 2025 17:55:16 +0800
Subject: [PATCH] 0312 图鉴界面强制刷新排版

---
 Main/System/HeroUI/HeroBestWin.cs |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/Main/System/HeroUI/HeroBestWin.cs b/Main/System/HeroUI/HeroBestWin.cs
index 8963c0d..ccf470b 100644
--- a/Main/System/HeroUI/HeroBestWin.cs
+++ b/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锛岃В鍐冲祵濂桳ayout鍜孋ontentSizeFitter鐨勯噸鍙犻棶棰�
+    /// </summary>
+    async UniTask ForceRefreshLayout()
+    {
+        await UniTask.DelayFrame(2);
+        // 鍒锋柊鎵�鏈塋ayout缁勪欢
+        var layouts = allAttrScroll.GetComponentsInChildren<LayoutGroup>(true);
+        foreach (var layout in layouts)
+        {
+            LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
+        }
+        await UniTask.DelayFrame(2);
+        // 鍒锋柊鎵�鏈塋ayout缁勪欢
+        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);
         }
     }
 

--
Gitblit v1.8.0