| | |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | |
| | | [SerializeField] GameObject unGetObj; |
| | | [SerializeField] GameObject activeObj; // 可激活带流光效果材质 |
| | | [SerializeField] GameObject actLimitObj; // 活动限定 |
| | | |
| | | private int displayVersion; |
| | | |
| | | public void Display(int index, int quality) |
| | | { |
| | | displayVersion++; |
| | | int version = displayVersion; |
| | | |
| | | var heroID = HeroUIManager.Instance.heroCollectDict[quality][index]; |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | |
| | |
| | | |
| | | HB122_tagSCHeroInfo.tagSCHero colData; |
| | | HeroUIManager.Instance.TryGetHeroBookInfo(heroID, out colData); |
| | | heroCardBG.SetSprite("herocardbg" + heroConfig.Quality); |
| | | |
| | | LoadImageAsync(heroCardBG, "herocardbg" + heroConfig.Quality, version).Forget(); |
| | | |
| | | //分为0未获得、1可激活、2常规、3突破升级、4、星升级、5已满级 |
| | | int funcState = HeroUIManager.Instance.GetHeroBookState(heroID, quality); |
| | |
| | | unGetObj.SetActive(funcState == 0); |
| | | actLimitObj.SetActive(heroConfig.IsActLimit == 1); |
| | | |
| | | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); |
| | | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); |
| | | heroModel.Create(heroConfig.SkinIDList[0], heroConfig.UIScale); |
| | | LoadImageAsync(countryImg, HeroUIManager.Instance.GetCountryIconName(heroConfig.Country), version).Forget(); |
| | | LoadImageAsync(jobImg, HeroUIManager.Instance.GetJobIconName(heroConfig.Class), version).Forget(); |
| | | |
| | | DelayedCreateSpine(heroConfig.SkinIDList[0], heroConfig.UIScale, version).Forget(); |
| | | |
| | | redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID; |
| | | |
| | | if (funcState == 3 || funcState == 4) |
| | | { |
| | | trainStateImg.SetActive(true); |
| | | trainStateImg.SetSprite("herofuncstate4"); |
| | | LoadImageAsync(trainStateImg, "herofuncstate4", version).Forget(); |
| | | } |
| | | else |
| | | { |
| | |
| | | var state = HeroUIManager.Instance.GetHeroBookState(heroID, quality); |
| | | if (state == 1 || state == 3 || state == 4) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroCollectionLvUpWin>().Forget(); |
| | | } |
| | | else |
| | | { |
| | | HeroUIManager.Instance.selectForPreviewHeroID = heroID; |
| | | UIManager.Instance.OpenWindow<HeroBestWin>(); |
| | | UIManager.Instance.OpenWindowAsync<HeroBestBaseWin>().Forget(); |
| | | } |
| | | }); |
| | | |
| | | // bookLVBtn.AddListener(() => |
| | | // { |
| | | // HeroUIManager.Instance.selectCollectHeroID = heroID; |
| | | // UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); |
| | | // }); |
| | | } |
| | | |
| | | private async UniTaskVoid LoadImageAsync(Image image, string iconKey, int version) |
| | | { |
| | | var sprite = await UILoader.LoadSpriteAsync(iconKey); |
| | | if (displayVersion != version) return; |
| | | if (image != null && sprite != null) |
| | | image.overrideSprite = sprite; |
| | | } |
| | | |
| | | private async UniTaskVoid DelayedCreateSpine(int skinID, float scale, int version) |
| | | { |
| | | await UniTask.NextFrame(); |
| | | await UniTask.NextFrame(); |
| | | if (displayVersion != version) return; |
| | | heroModel.Create(skinID, scale).Forget(); |
| | | } |
| | | } |
| | | |
| | | |