hch
5 天以前 8f006f426334f5ca733bfe4be2aa91007e232f55
Main/System/Team/TeamBase.cs
@@ -248,6 +248,21 @@
        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))
@@ -329,8 +344,8 @@
        }
    }
    
    public void AddHero(HeroInfo heroInfo, int targetPosition)
    //checkLock :是否验证上阵人数限制
    public void AddHero(HeroInfo heroInfo, int targetPosition, bool checkLock)
    {
        if (targetPosition < 0 || targetPosition >= tempHeroes.Length)
        {
@@ -338,22 +353,43 @@
            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)
        {
            SysNotifyMgr.Instance.ShowTip("HeroFunc2");
            return false;
            return false;
        }
        else
        {