|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | [SerializeField] Button heroCardBtn; | 
|---|
|  |  |  | [SerializeField] Image heroCardBG; | 
|---|
|  |  |  | [SerializeField] Material glowMaterial; // 流光效果材质 | 
|---|
|  |  |  | [SerializeField] Text lvText; | 
|---|
|  |  |  | [SerializeField] UIHeroController heroModel; | 
|---|
|  |  |  | [SerializeField] List<Image> starImgList; | 
|---|
|  |  |  | [SerializeField] Image countryImg; | 
|---|
|  |  |  | [SerializeField] Image jobImg; | 
|---|
|  |  |  | [SerializeField] UIHeroController heroModel; | 
|---|
|  |  |  | [SerializeField] Image onStateImg; | 
|---|
|  |  |  | [SerializeField] RedpointBehaviour redpoint; | 
|---|
|  |  |  | [SerializeField] Image trainStateImg; | 
|---|
|  |  |  | [SerializeField] Text nameText; | 
|---|
|  |  |  | [SerializeField] Image awakeImg; | 
|---|
|  |  |  | [SerializeField] Text awakeLVText; | 
|---|
|  |  |  | [SerializeField] List<Image> starImgList; | 
|---|
|  |  |  | [SerializeField] Image trainStateImg; | 
|---|
|  |  |  | [SerializeField] RedpointBehaviour redpoint; | 
|---|
|  |  |  | [SerializeField] Button bookLVBtn; | 
|---|
|  |  |  | [SerializeField] GameObject unGetObj; | 
|---|
|  |  |  | [SerializeField] GameObject activeObj; // 可激活带流光效果材质 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string guid; | 
|---|
|  |  |  | public void Display(int index) | 
|---|
|  |  |  | public void Display(int index, int quality) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | guid = HeroUIManager.Instance.heroSortList[index]; | 
|---|
|  |  |  | var hero = HeroManager.Instance.GetHero(guid); | 
|---|
|  |  |  | if (hero == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | this.gameObject.SetActive(false); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.gameObject.SetActive(true); | 
|---|
|  |  |  | heroCardBG.SetSprite("herocardbg" + hero.Quality); | 
|---|
|  |  |  | if (glowMaterial != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | heroCardBG.material = glowMaterial; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | lvText.text = Language.Get("L1094") + hero.heroLevel.ToString(); | 
|---|
|  |  |  | var heroConfig = hero.heroConfig; | 
|---|
|  |  |  | //分为0未获得、1可激活、2常规、3突破升级、4、星升级、5已满级 | 
|---|
|  |  |  | int funcState = HeroUIManager.Instance.GetHeroBookState(heroID, quality); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | activeObj.SetActive(funcState == 1); | 
|---|
|  |  |  | bookLVBtn.SetActive(funcState > 1); | 
|---|
|  |  |  | unGetObj.SetActive(funcState == 0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); | 
|---|
|  |  |  | jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class)); | 
|---|
|  |  |  | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale); | 
|---|
|  |  |  | onStateImg.SetActive(hero.IsInTeamByTeamType(TeamType.Story)); | 
|---|
|  |  |  | heroModel.Create(heroConfig.SkinIDList[0], heroConfig.UIScale); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | redpoint.redpointId = MainRedDot.HeroCardRedpoint * 1000 + hero.itemHero.gridIndex; | 
|---|
|  |  |  | var funcState = hero.funcState; | 
|---|
|  |  |  | if (funcState > 0) | 
|---|
|  |  |  | redpoint.redpointId = MainRedDot.HeroCardCollectRedpoint * 10000000 + heroID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (funcState == 3 || funcState == 4) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | trainStateImg.SetActive(true); | 
|---|
|  |  |  | trainStateImg.SetSprite("herofuncstate" + hero.funcState); | 
|---|
|  |  |  | trainStateImg.SetSprite("herofuncstate4"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | trainStateImg.SetActive(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel); | 
|---|
|  |  |  | awakeImg.SetActive(hero.awakeLevel > 0); | 
|---|
|  |  |  | awakeLVText.text = hero.awakeLevel.ToString(); | 
|---|
|  |  |  | nameText.text = colData.BookBreakLV == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, colData.BookBreakLV); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (int i = 0; i < starImgList.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (hero.heroStar == 0 && i == 0) | 
|---|
|  |  |  | if (colData.BookStarLV == 0 && i == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // 无星级 特殊处理 | 
|---|
|  |  |  | starImgList[i].SetActive(true); | 
|---|
|  |  |  | starImgList[i].SetSprite("herostar" + hero.heroStar); | 
|---|
|  |  |  | starImgList[i].SetSprite("herostar" + colData.BookStarLV); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if ((hero.heroStar - 1) % starImgList.Count >= i) | 
|---|
|  |  |  | else if ((colData.BookStarLV - 1) % starImgList.Count >= i) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | starImgList[i].SetActive(true); | 
|---|
|  |  |  | starImgList[i].SetSprite("herostar" + (((hero.heroStar - 1) / starImgList.Count) + 1) * starImgList.Count); | 
|---|
|  |  |  | starImgList[i].SetSprite("herostar" + (((colData.BookStarLV - 1) / starImgList.Count) + 1) * starImgList.Count); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | heroCardBtn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | HeroUIManager.Instance.selectHeroGuid = guid; | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<HeroTrainWin>(); | 
|---|
|  |  |  | HeroUIManager.Instance.selectCollectHeroID = heroID; | 
|---|
|  |  |  | var state = HeroUIManager.Instance.GetHeroBookState(heroID, quality); | 
|---|
|  |  |  | if (state == 1 || state == 3 || state == 4) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | HeroUIManager.Instance.selectForPreviewHeroID = heroID; | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<HeroBestWin>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bookLVBtn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | HeroUIManager.Instance.selectCollectHeroID = heroID; | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<HeroCollectionLvUpWin>(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|