| using System.Collections.Generic; | 
| using UnityEngine; | 
| using UnityEngine.UI; | 
|   | 
| public class HeroGiftRoleListCell : CellView | 
| { | 
|     [SerializeField] Button addHeroBtn; | 
|     [SerializeField] HeroShowBaseCell addHeroShow; | 
|     [SerializeField] GiftBaseCell[] addGiftCells; | 
|     [SerializeField] Image onTeamImg; | 
|   | 
|     public void Display(int index) | 
|     { | 
|         addHeroBtn.AddListener(()=> { AddHero(index); }); | 
|   | 
|         var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.heroEatList[index]); | 
|         addHeroShow.Init(hero.heroId, hero.SkinID, hero.breakLevel, hero.heroStar, hero.awakeLevel, hero.heroLevel, hero.isLock); | 
|         HeroUIManager.Instance.RefreshGiftCell(addGiftCells, hero); | 
|   | 
|         onTeamImg.SetActive(hero.IsInAnyTeam()); | 
|     } | 
|   | 
|     void AddHero(int index) | 
|     { | 
|         var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.heroEatList[index]); | 
|         //上阵 锁定 觉醒 的情况 | 
|         if (hero.awakeLevel > 0) | 
|         { | 
|             SysNotifyMgr.Instance.ShowTip("HeroReborn1"); | 
|             return; | 
|         } | 
|   | 
|         if (hero.IsInAnyTeamJustOne()) | 
|         { | 
|             //阵容至少要有一个武将上阵 | 
|             SysNotifyMgr.Instance.ShowTip("HeroFunc3"); | 
|             return; | 
|         } | 
|   | 
|         if (hero.isLock) | 
|         { | 
|             ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), | 
|             Language.Get("herocard66"), (bool isOK) => | 
|                 { | 
|                     if (isOK) | 
|                     { | 
|                         hero.ChangeLockState(); | 
|                     } | 
|                 }); | 
|             return; | 
|         } | 
|   | 
|         if (hero.IsInAnyTeam()) | 
|         { | 
|             ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), | 
|             Language.Get("herocard65"), (bool isOK) => | 
|                 { | 
|                     if (isOK) | 
|                     { | 
|                         hero.LeaveAllTeam(); | 
|                     } | 
|                 }); | 
|             return; | 
|         } | 
|   | 
|         if (hero.heroLevel > 1) | 
|         { | 
|             HeroUIManager.Instance.ResetBtnClick(hero); | 
|             return; | 
|         } | 
|   | 
|   | 
|         if (hero.heroStar > 0) | 
|         { | 
|             ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), | 
|             Language.Get("HeroGift13"), (bool isOK) => | 
|                 { | 
|                     if (isOK) | 
|                     { | 
|                         HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index]; | 
|                         UIManager.Instance.CloseWindow<HeroGiftRoleListWin>(); | 
|                     } | 
|                 }); | 
|             return; | 
|         } | 
|      | 
|   | 
|         HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index]; | 
|         UIManager.Instance.CloseWindow<HeroGiftRoleListWin>(); | 
|     } | 
| } |