| | |
| | | |
| | | public Dictionary<int, List<int>> heroCollectDict { get; private set; } = new Dictionary<int, List<int>>(); //武将图鉴按品质列表 |
| | | public List<int> heroCollectList = new List<int>(); //武将图鉴列表 |
| | | public int selectHeroCollectListJob = 0; //武将列表界面 筛选职业 |
| | | public int selectHeroCollectListCountry = 0; //武将列表界面筛选国家 |
| | | public List<int> selectHeroCollectList = new List<int>(); //武将列表界面 筛选 |
| | | public int selectCollectHeroID; //选中的武将id 用于升级 |
| | | |
| | | public int selectForPreviewHeroID; //选中的武将id 用于预览 |
| | |
| | | //图鉴和皮肤的激活情况 |
| | | Dictionary<int, HB122_tagSCHeroInfo.tagSCHero> heroCollectInfoDic = new Dictionary<int, HB122_tagSCHeroInfo.tagSCHero>(); |
| | | |
| | | public int allHeroBookPer; //全体武将的图鉴激活百分比 |
| | | // public int allHeroBookPer; //全体武将的图鉴激活百分比 |
| | | public event Action OnHeroCollectEvent; |
| | | |
| | | public void UpdateHeroCollectInfo(HB122_tagSCHeroInfo netPack) |
| | |
| | | { |
| | | heroCollectInfoDic[(int)netPack.HeroInfoList[i].HeroID] = netPack.HeroInfoList[i]; |
| | | } |
| | | allHeroBookPer = GetHeroCollectBookPer(); |
| | | // allHeroBookPer = GetHeroCollectBookPer(); |
| | | OnHeroCollectEvent?.Invoke(); |
| | | UpdateHeroBookRedpoint(); |
| | | } |
| | | |
| | | |
| | | public int GetHeroCollectBookPer() |
| | | { |
| | | int per = 0; |
| | | foreach (var kv in heroCollectInfoDic) |
| | | { |
| | | var config = HeroQualityConfig.Get(HeroConfig.Get(kv.Key).Quality); |
| | | if (kv.Value.BookInitState != 2) |
| | | continue; |
| | | per += config.BookInitAddPer; |
| | | per += kv.Value.BookStarLV * config.BookStarAddPer; |
| | | per += kv.Value.BookBreakLV * config.BookBreakLVAddPer; |
| | | } |
| | | return per; |
| | | } |
| | | // public int GetHeroCollectBookPer() |
| | | // { |
| | | // int per = 0; |
| | | // foreach (var kv in heroCollectInfoDic) |
| | | // { |
| | | // var config = HeroQualityConfig.Get(HeroConfig.Get(kv.Key).Quality); |
| | | // if (kv.Value.BookInitState != 2) |
| | | // continue; |
| | | // per += config.BookInitAddPer; |
| | | // per += kv.Value.BookStarLV * config.BookStarAddPer; |
| | | // per += kv.Value.BookBreakLV * config.BookBreakLVAddPer; |
| | | // } |
| | | // return per; |
| | | // } |
| | | |
| | | public bool TryGetHeroBookInfo(int heroID, out HB122_tagSCHeroInfo.tagSCHero heroData) |
| | | { |
| | |
| | | |
| | | public void SortHeroCollectList() |
| | | { |
| | | |
| | | var heroIDs = HeroConfig.GetKeys().ToList(); |
| | | |
| | | int job = 0; |
| | | int country = 0; |
| | | int hurtType = 0; |
| | | int fightAttrType = 0; |
| | | int specialAttrType = 0; |
| | | if (!selectHeroCollectList.IsNullOrEmpty()) |
| | | { |
| | | job = selectHeroCollectList[0]; |
| | | country = selectHeroCollectList[1]; |
| | | hurtType = selectHeroCollectList[2]; |
| | | fightAttrType = selectHeroCollectList[3]; |
| | | specialAttrType = selectHeroCollectList[4]; |
| | | } |
| | | |
| | | heroCollectDict.Clear(); |
| | | foreach (var heroID in heroIDs) |
| | |
| | | { |
| | | heroCollectDict[heroConfig.Quality] = new List<int>(); |
| | | } |
| | | //过滤职业国家 |
| | | if (selectHeroCollectListJob != 0 && selectHeroCollectListJob != heroConfig.Class) |
| | | |
| | | //0代表全部, 同级别是可复选,不同级别为且的关系 |
| | | bool isMatch = true; |
| | | if (job != 0) |
| | | { |
| | | continue; |
| | | isMatch = isMatch && (job & (1 << heroConfig.Class)) > 0; |
| | | } |
| | | if (selectHeroCollectListCountry != 0 && selectHeroCollectListCountry != heroConfig.Country) |
| | | if (country != 0) |
| | | { |
| | | isMatch = isMatch && (country & (1 << heroConfig.Country)) > 0; |
| | | } |
| | | if (hurtType != 0) |
| | | { |
| | | isMatch = isMatch && (hurtType & (1 << heroConfig.HurtType)) > 0; |
| | | } |
| | | if (fightAttrType != 0) |
| | | { |
| | | isMatch = isMatch && (fightAttrType & (1 << heroConfig.Specialty)) > 0; |
| | | } |
| | | if (specialAttrType != 0) |
| | | { |
| | | bool isMatch2 = false; |
| | | for (int i = 0; i < heroConfig.Specialty2.Length; i++) |
| | | { |
| | | isMatch2 = (specialAttrType & (1 << heroConfig.Specialty2[i])) > 0; |
| | | if (isMatch2) |
| | | break; |
| | | } |
| | | isMatch = isMatch && isMatch2; |
| | | } |
| | | if (!isMatch) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | |
| | | HB122_tagSCHeroInfo.tagSCHero colData; |
| | | TryGetHeroBookInfo(heroID, out colData); |
| | | int maxBreakLV = colData.BookBreakLVH; //历史最高突破等级 |
| | | int maxStarLV = colData.BookStarLVH; //历史最高星级 |
| | | // int maxBreakLV = colData.BookBreakLVH; //历史最高突破等级 |
| | | // int maxStarLV = colData.BookStarLVH; //历史最高星级 |
| | | |
| | | if (colData.BookInitState == 0) |
| | | { |
| | |
| | | { |
| | | funcState = 1; |
| | | } |
| | | else if (colData.BookInitState == 2) |
| | | else |
| | | { |
| | | if (GetHeroBookMaxLevel(heroID, quality) == colData.BookBreakLV + colData.BookStarLV) |
| | | { |
| | | funcState = 5; |
| | | } |
| | | else if (maxBreakLV + maxStarLV == colData.BookBreakLV + colData.BookStarLV) |
| | | { |
| | | funcState = 2; |
| | | } |
| | | else |
| | | { |
| | | //优先突破升级 |
| | | if (colData.BookBreakLV < colData.BookBreakLVH) |
| | | { |
| | | funcState = 3; |
| | | } |
| | | else |
| | | { |
| | | funcState = 4; |
| | | } |
| | | } |
| | | |
| | | funcState = 2; |
| | | } |
| | | |
| | | // else if (colData.BookInitState == 2) |
| | | // { |
| | | // if (GetHeroBookMaxLevel(heroID, quality) == colData.BookBreakLV + colData.BookStarLV) |
| | | // { |
| | | // funcState = 5; |
| | | // } |
| | | // else if (maxBreakLV + maxStarLV == colData.BookBreakLV + colData.BookStarLV) |
| | | // { |
| | | // funcState = 2; |
| | | // } |
| | | // else |
| | | // { |
| | | // //优先突破升级 |
| | | // if (colData.BookBreakLV < colData.BookBreakLVH) |
| | | // { |
| | | // funcState = 3; |
| | | // } |
| | | // else |
| | | // { |
| | | // funcState = 4; |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | return funcState; |
| | | } |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | public int GetHeroBookPer(int heroID) |
| | | { |
| | | var config = HeroQualityConfig.Get(HeroConfig.Get(heroID).Quality); |
| | | HB122_tagSCHeroInfo.tagSCHero heroData; |
| | | TryGetHeroBookInfo(heroID, out heroData); |
| | | if (heroData.BookInitState < 2) |
| | | { |
| | | return 0; |
| | | } |
| | | return config.BookInitAddPer + heroData.BookStarLV * config.BookStarAddPer + heroData.BookBreakLV * config.BookBreakLVAddPer; |
| | | } |
| | | // public int GetHeroBookPer(int heroID) |
| | | // { |
| | | // var config = HeroQualityConfig.Get(HeroConfig.Get(heroID).Quality); |
| | | // HB122_tagSCHeroInfo.tagSCHero heroData; |
| | | // TryGetHeroBookInfo(heroID, out heroData); |
| | | // if (heroData.BookInitState < 2) |
| | | // { |
| | | // return 0; |
| | | // } |
| | | // return config.BookInitAddPer + heroData.BookStarLV * config.BookStarAddPer + heroData.BookBreakLV * config.BookBreakLVAddPer; |
| | | // } |
| | | } |
| | | |