Main/System/Hero/HeroManager.cs
@@ -83,29 +83,57 @@
        return heroInfoDict.Values.ToList();
    }
    public List<string> GetHeroGuidList(int job = 0, int country = 0)
    /// 参数: 职业,国家,伤害类型,6大战斗属性,特殊属性
    public List<string> GetHeroGuidList(List<int> selectList = null)
    {
        if (job == 0 && country == 0)
        if (selectList.IsNullOrEmpty())
            return heroInfoDict.Keys.ToList();
        int job = selectList[0];
        int country = selectList[1];
        int hurtType = selectList[2];
        int fightAttrType = selectList[3];
        int specialAttrType = selectList[4];
        List<string> retGuidList = new List<string>();
        foreach (string guid in heroInfoDict.Keys)
        {
            HeroInfo heroInfo = heroInfoDict[guid];
            //0代表全部
            if (job == 0 || country == 0)
            //0代表全部, 同级别是可复选,不同级别为且的关系
            bool isMatch = true;
            if (job != 0)
            {
                if (job != 0 && job == heroInfo.heroConfig.Class)
                    retGuidList.Add(guid);
                if (country != 0 && country == heroInfo.heroConfig.Country)
                isMatch = isMatch && (job & (1 << heroInfo.heroConfig.Class)) > 0;
            }
            if (country != 0)
            {
                isMatch = isMatch && (country & (1 << heroInfo.heroConfig.Country)) > 0;
            }
            if (hurtType != 0)
            {
                isMatch = isMatch && (hurtType & (1 << heroInfo.heroConfig.HurtType)) > 0;
            }
            if (fightAttrType != 0)
            {
                isMatch = isMatch && (fightAttrType & (1 << heroInfo.heroConfig.Specialty)) > 0;
            }
            if (specialAttrType != 0)
            {
                bool isMatch2 = false;
                for (int i = 0; i < heroInfo.heroConfig.Specialty2.Length; i++)
                {
                    isMatch2 = (specialAttrType & (1 << heroInfo.heroConfig.Specialty2[i])) > 0;
                    if (isMatch2)
                        break;
                }
                isMatch = isMatch && isMatch2;
            }
            if (isMatch)
            {
                    retGuidList.Add(guid);
            }
            else
            {
                if (job == heroInfo.heroConfig.Class && country == heroInfo.heroConfig.Country)
                    retGuidList.Add(guid);
            }
        }
        return retGuidList;
    }
@@ -152,4 +180,46 @@
    {
        return (int)PackManager.Instance.GetSinglePack(PackType.Hero).GetCountById(heroID);
    }
    //获得生效的武将数量
    public int GetAttrActiveHeroCount()
    {
        int count = 0;
        foreach (HeroInfo heroInfo in heroInfoDict.Values)
        {
            if (heroInfo.isAttrActive)
            {
                count++;
            }
        }
        return count;
    }
    //获得未生效的武将数量
    public int GetNotActiveHeroCount()
    {
        int count = 0;
        foreach (HeroInfo heroInfo in heroInfoDict.Values)
        {
            if (!heroInfo.isAttrActive)
            {
                count++;
            }
        }
        return count;
    }
    //获得指定ID且属性生效的武将
    public HeroInfo GetHeroByID(int heroID)
    {
        foreach (HeroInfo heroInfo in heroInfoDict.Values)
        {
            if (heroInfo.heroId == heroID && heroInfo.isAttrActive)
            {
                return heroInfo;
            }
        }
        return null;
    }
}