From 0fcd4e99286827bdb32e68e98ebe83377b50a4a9 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 04 十一月 2025 16:41:59 +0800
Subject: [PATCH] 0312 强制刷新武将属性界面排版
---
Main/System/HeroUI/HeroAllAttrWin.cs | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/Main/System/HeroUI/HeroAllAttrWin.cs b/Main/System/HeroUI/HeroAllAttrWin.cs
index a8c650a..455bd7e 100644
--- a/Main/System/HeroUI/HeroAllAttrWin.cs
+++ b/Main/System/HeroUI/HeroAllAttrWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -9,11 +10,12 @@
/// </summary>
public class HeroAllAttrWin : UIBase
{
- [SerializeField] GameObject baseAttrGroup;
- [SerializeField] GameObject fightAttrGroup;
- [SerializeField] GameObject fightAntiAttrGroup;
- [SerializeField] GameObject specialAttrGroup;
-
+ [SerializeField] Transform allContent;
+ [SerializeField] GameObject baseAttrGroup;
+ [SerializeField] GameObject fightAttrGroup;
+ [SerializeField] GameObject fightAntiAttrGroup;
+ [SerializeField] GameObject specialAttrGroup;
+
Dictionary<int, Button> attrBtns = new Dictionary<int, Button>();
@@ -93,9 +95,11 @@
{
SmallTipWin.showText = PlayerPropertyConfig.Get(id).desc;
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
- UIManager.Instance.OpenWindow<SmallTipWin>();
+ UIManager.Instance.OpenWindow<SmallTipWin>();
});
}
+
+ ForceRefreshLayout();
}
@@ -123,4 +127,24 @@
}
+ /// <summary>
+ /// 寮哄埗鍒锋柊Layout锛岃В鍐冲祵濂桳ayout鍜孋ontentSizeFitter鐨勯噸鍙犻棶棰�
+ /// </summary>
+ async UniTask ForceRefreshLayout()
+ {
+ await UniTask.DelayFrame(2);
+ // 鍒锋柊鎵�鏈塋ayout缁勪欢
+ var layouts = allContent.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>());
+ }
+
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0