| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | 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() |
| | |
| | | attrPanel.localPosition = foldPos.localPosition; |
| | | // //禁止attrScroll滚动 |
| | | // allAttrScroll.enabled = false; |
| | | var _rect = allAttrScroll.GetComponent<RectTransform>(); |
| | | _rect.sizeDelta = new Vector2(_rect.rect.width, 197); |
| | | |
| | | } |
| | | else |
| | |
| | | unfoldImg.SetActive(true); |
| | | attrPanel.localPosition = unfoldPos.localPosition; |
| | | // allAttrScroll.enabled = true; |
| | | var _rect = allAttrScroll.GetComponent<RectTransform>(); |
| | | _rect.sizeDelta = new Vector2(_rect.rect.width, 933); |
| | | } |
| | | } |
| | | |