| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | deleteBtn.AddListener(DeleteHero); |
| | | awakeBtn.AddListener(() => |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(38, true)) |
| | | { |
| | | return; |
| | | } |
| | | HeroUIManager.Instance.selectAwakeHeroGuid = guid; |
| | | UIManager.Instance.OpenWindow<HeroAwakeWin>(); |
| | | }); |
| | |
| | | Display(); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | PackManager.Instance.RefreshItemLockEvent -= RefreshItemLockEvent; |
| | |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class)); |
| | | jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class); |
| | | descText.text = hero.heroConfig.Desc; |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower()); |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculateFightPower()); |
| | | PlayerMainDate.Instance.AddPowerNotOnTeam(hero); |
| | | lockImg.SetActive(hero.isLock); |
| | | unLockImg.SetActive(!hero.isLock); |
| | |
| | | RefreshRedImg(); |
| | | |
| | | HeroUIManager.Instance.RemoveNewHero(hero.heroId); |
| | | 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 RefreshItemLockEvent(PackType type, string guid, bool lockState) |
| | | { |
| | |
| | | ReturnCell(cell); |
| | | }); |
| | | |
| | | HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false)); |
| | | HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false)); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | if (teamType != TeamType.Story) |
| | | return; |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower()); |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculateFightPower()); |
| | | } |
| | | |
| | | void RefreshFreeze() |