| | |
| | | [SerializeField] HeroShowBaseCell addHeroShow; |
| | | [SerializeField] GiftBaseCell[] addGiftCells; |
| | | [SerializeField] Image onTeamImg; |
| | | [SerializeField] Toggle selectToggle; |
| | | |
| | | public void Display(int index) |
| | | { |
| | |
| | | HeroUIManager.Instance.RefreshGiftCell(addGiftCells, hero); |
| | | |
| | | onTeamImg.SetActive(hero.IsInAnyTeam()); |
| | | int girdIndex = hero.itemHero.gridIndex; |
| | | selectToggle.isOn = HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex); |
| | | |
| | | } |
| | | |
| | | void AddHero(int index) |
| | |
| | | return; |
| | | } |
| | | |
| | | if (hero.heroStar > 0) |
| | | { |
| | | if (hero.heroLevel > 1) |
| | | { |
| | | HeroUIManager.Instance.ResetBtnClick(hero); |
| | | return; |
| | | } |
| | | |
| | | int maxStarCnt = HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality); |
| | | int girdIndex = hero.itemHero.gridIndex; |
| | | if (hero.heroStar > 0 && !selectToggle.isOn) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("HeroGift13"), (bool isOK) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index]; |
| | | UIManager.Instance.CloseWindow<HeroGiftRoleListWin>(); |
| | | SelectHero(girdIndex, maxStarCnt); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index]; |
| | | UIManager.Instance.CloseWindow<HeroGiftRoleListWin>(); |
| | | SelectHero(girdIndex, maxStarCnt); |
| | | |
| | | } |
| | | |
| | | void SelectHero(int girdIndex, int maxStarCnt) |
| | | { |
| | | if (!selectToggle.isOn) |
| | | { |
| | | |
| | | //需要统计被吞噬的武将星数 |
| | | int eatStar = 0; |
| | | for (int i = 0; i < HeroUIManager.Instance.selectEatHeroIndexList.Count; i++) |
| | | { |
| | | var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.heroEatList[i]); |
| | | if (hero == null) |
| | | continue; |
| | | eatStar += hero.heroStar + 1; //本体也算可增加1星 |
| | | } |
| | | // 需增加待选这只的星级 |
| | | var selectStar = HeroManager.Instance.GetHeroByIndex(girdIndex).heroStar + 1; //本体也算可增加1星 |
| | | |
| | | // 主武将星级 |
| | | var star = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectHeroGuidForGiftFunc)?.heroStar; |
| | | |
| | | // 只选1只的情况下,如果 39星 + 5星超过了也让可选,其他情况的话需判断星上限 |
| | | if (!(HeroUIManager.Instance.selectEatHeroIndexList.Count == 0 && selectStar > 1)) |
| | | { |
| | | if (eatStar + selectStar + star > maxStarCnt) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroGiftEat1"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (!HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex)) |
| | | { |
| | | HeroUIManager.Instance.selectEatHeroIndexList.Add(girdIndex); |
| | | selectToggle.isOn = true; |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex)) |
| | | { |
| | | HeroUIManager.Instance.selectEatHeroIndexList.Remove(girdIndex); |
| | | selectToggle.isOn = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |