From 8f1e4dc19a0664e6a8ee4fdad2065efb5c16d053 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 31 十月 2025 16:08:09 +0800
Subject: [PATCH] 0312 购买物品 拥有数量如果是能自动转换货币的显示货币值否则显示物品数量;物品图标下标显示购买的总数量;强制刷新武将界面的排版
---
Main/System/HeroUI/HeroTrainWin.cs | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 11d1c80..fe2b66f 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
@@ -196,6 +197,7 @@
Display();
}
+
protected override void OnPreClose()
{
PackManager.Instance.RefreshItemLockEvent -= RefreshItemLockEvent;
@@ -253,8 +255,31 @@
RefreshRedImg();
HeroUIManager.Instance.RemoveNewHero(hero.heroId);
+ 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 RefreshItemLockEvent(PackType type, string guid, bool lockState)
{
if (type != PackType.Hero)
--
Gitblit v1.8.0