| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | //用于显示获得物品的窗口
|
| | | public class CommonGetItemWin : UIBase
|
| | | {
|
| | | [SerializeField] Transform bg;
|
| | | [SerializeField] ScrollerController scroller;
|
| | | [SerializeField] Text tipText;
|
| | |
|
| | |
| | | {
|
| | | tipText.text = Language.Get(ItemLogicUtility.Instance.sourceTip);
|
| | | }
|
| | | ForceRefreshLayout().Forget();
|
| | | }
|
| | |
|
| | |
|
| | |
| | | var _cell = cell as CommonGetItemCell;
|
| | | _cell?.Display(cell.index, showItems);
|
| | | }
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 强制刷新Layout,解决嵌套Layout和ContentSizeFitter的重叠问题
|
| | | /// </summary>
|
| | | async UniTask ForceRefreshLayout()
|
| | | {
|
| | | await UniTask.DelayFrame(2);
|
| | | // 刷新所有Layout组件
|
| | | var layouts = bg.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>());
|
| | | }
|
| | |
|
| | | }
|
| | | }
|