| | |
| | | return serverHeroes[index]; |
| | | } |
| | | |
| | | |
| | | //获取所有上阵的武将 |
| | | public List<TeamHero> GetHerosOnTeam() |
| | | { |
| | | List<TeamHero> tmpHeros = new List<TeamHero>(); |
| | | foreach (var hero in tempHeroes) |
| | | { |
| | | if (hero != null) |
| | | { |
| | | tmpHeros.Add(hero); |
| | | } |
| | | } |
| | | return tmpHeros; |
| | | } |
| | | |
| | | public TeamHero GetNextServerHero(string guid) |
| | | { |
| | | if (string.IsNullOrEmpty(guid)) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void AddHero(HeroInfo heroInfo, int targetPosition) |
| | | //checkLock :是否验证上阵人数限制 |
| | | public void AddHero(HeroInfo heroInfo, int targetPosition, bool checkLock) |
| | | { |
| | | if (targetPosition < 0 || targetPosition >= tempHeroes.Length) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (checkLock) |
| | | { |
| | | var lockCnt = HeroUIManager.Instance.lockIndexList.Count; |
| | | if (lockCnt > 0 && TeamConst.MaxTeamHeroCount - GetHerosOnTeam().Count <= lockCnt) |
| | | { |
| | | HeroUIManager.Instance.ShowUnLockTip(HeroUIManager.Instance.lockIndexList[0]); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | SetTeamHero(targetPosition, new TeamHero(heroInfo, targetPosition, this)); |
| | | } |
| | | |
| | | |
| | | |
| | | //checkLock :是否验证上阵人数限制 |
| | | // add只可能是点下面卡牌 |
| | | public bool AddHero(HeroInfo heroInfo, out int pos) |
| | | public bool AddHero(HeroInfo heroInfo, out int pos, bool checkLock) |
| | | { |
| | | pos = -1; |
| | | if (heroInfo == null || heroInfo.itemHero == null) return false; |
| | | |
| | | if (checkLock) |
| | | { |
| | | var lockCnt = HeroUIManager.Instance.lockIndexList.Count; |
| | | if (lockCnt > 0 && TeamConst.MaxTeamHeroCount - GetHerosOnTeam().Count <= lockCnt) |
| | | { |
| | | HeroUIManager.Instance.ShowUnLockTip(HeroUIManager.Instance.lockIndexList[0]); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 同一英雄 只能上阵一个 |
| | | if (GetHeroByHeroID(heroInfo.heroId) != null) |
| | | { |