From f3ae8542aee4b5de78fc20d9543bb424b315708f Mon Sep 17 00:00:00 2001 From: yyl <yyl> Date: 星期三, 10 九月 2025 14:23:47 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts --- Main/System/HeroUI/HeroUIManager.Collect.cs | 143 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 134 insertions(+), 9 deletions(-) diff --git a/Main/System/HeroUI/HeroUIManager.Collect.cs b/Main/System/HeroUI/HeroUIManager.Collect.cs index 93932c5..884f986 100644 --- a/Main/System/HeroUI/HeroUIManager.Collect.cs +++ b/Main/System/HeroUI/HeroUIManager.Collect.cs @@ -1,18 +1,28 @@ 锘縰sing System; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; +//鍥鹃壌鍜岀毊鑲� public partial class HeroUIManager : GameSystemManager<HeroUIManager> { - #region 鍥鹃壌鍜岀毊鑲� + + public Dictionary<int, List<int>> heroCollectDict { get; private set; } = new Dictionary<int, List<int>>(); //姝﹀皢鍥鹃壌鎸夊搧璐ㄥ垪琛� + public int selectHeroCollectListJob = 0; //姝﹀皢鍒楄〃鐣岄潰 绛涢�夎亴涓� + public int selectHeroCollectListCountry = 0; //姝﹀皢鍒楄〃鐣岄潰绛涢�夊浗瀹� + public int selectCollectHeroID; //閫変腑鐨勬灏唅d + + public int bookMoneyType; //鍥鹃壌濂栧姳璐у竵绫诲瀷 + public int bookMoneyValue;//鍥鹃壌濂栧姳璐у竵鏁伴噺 + //鍥鹃壌鍜岀毊鑲ょ殑婵�娲绘儏鍐� - public Dictionary<int, HB122_tagSCHeroInfo.tagSCHero> heroCollectInfoDic { get; private set; } = new Dictionary<int, HB122_tagSCHeroInfo.tagSCHero>(); + Dictionary<int, HB122_tagSCHeroInfo.tagSCHero> heroCollectInfoDic = new Dictionary<int, HB122_tagSCHeroInfo.tagSCHero>(); - public int bookPer; + public int allHeroBookPer; //鍏ㄤ綋姝﹀皢鐨勫浘閴存縺娲荤櫨鍒嗘瘮 public event Action OnHeroCollectEvent; public void UpdateHeroCollectInfo(HB122_tagSCHeroInfo netPack) @@ -21,7 +31,7 @@ { heroCollectInfoDic[(int)netPack.HeroInfoList[i].HeroID] = netPack.HeroInfoList[i]; } - bookPer = GetHeroCollectBookPer(); + allHeroBookPer = GetHeroCollectBookPer(); OnHeroCollectEvent?.Invoke(); } @@ -41,15 +51,130 @@ return per; } - public HB122_tagSCHeroInfo.tagSCHero GetHeroBookInfo(int heroID) - { + public bool TryGetHeroBookInfo(int heroID, out HB122_tagSCHeroInfo.tagSCHero heroData) + { if (heroCollectInfoDic.ContainsKey(heroID)) { - return heroCollectInfoDic[heroID]; + heroData = heroCollectInfoDic[heroID]; + return true; } - return null; + heroData = new HB122_tagSCHeroInfo.tagSCHero(); + return false; } - #endregion + + public void SortHeroCollectList() + { + var heroIDs = HeroConfig.GetKeys().ToList(); + + heroCollectDict.Clear(); + foreach (var heroID in heroIDs) + { + HeroConfig heroConfig = HeroConfig.Get(heroID); + if (!heroCollectDict.ContainsKey(heroConfig.Quality)) + { + heroCollectDict[heroConfig.Quality] = new List<int>(); + } + //杩囨护鑱屼笟鍥藉 + if (selectHeroCollectListJob != 0 && selectHeroCollectListJob != heroConfig.Class) + { + continue; + } + if (selectHeroCollectListCountry != 0 && selectHeroCollectListCountry != heroConfig.Country) + { + continue; + } + + heroCollectDict[heroConfig.Quality].Add(heroID); + } + } + + //鍥鹃壌鎬讳笂闄愮瓑绾� = 鍥鹃壌鏄熺骇涓婇檺 + 鍥鹃壌绐佺牬涓婇檺 + public int GetHeroBookMaxLevel(int heroID, int quality) + { + return GetMaxStarCount(heroID, quality) + HeroBreakConfig.GetMaxBreakLv(heroID); + } + + public int GetHeroBookLevel(int heroID) + { + if (heroCollectInfoDic.ContainsKey(heroID)) + { + return heroCollectInfoDic[heroID].BookStarLV + heroCollectInfoDic[heroID].BookBreakLV; + } + return 0; + } + + //鍒嗕负0鏈幏寰椼��1鍙縺娲汇��2甯歌銆�3绐佺牬鍗囩骇銆�4銆佹槦鍗囩骇銆�5宸叉弧绾� + public int GetHeroBookState(int heroID, int quality) + { + int funcState = 0; + + HB122_tagSCHeroInfo.tagSCHero colData; + TryGetHeroBookInfo(heroID, out colData); + int maxBreakLV = colData.BookBreakLVH; //鍘嗗彶鏈�楂樼獊鐮寸瓑绾� + int maxStarLV = colData.BookStarLVH; //鍘嗗彶鏈�楂樻槦绾� + + if (colData.BookInitState == 0) + { + funcState = 0; + } + else if (colData.BookInitState == 1) + { + funcState = 1; + } + 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; + } + + //鎵惧埌鍙互鎿嶄綔鐨勫浘閴存灏� + public int FindHeroIDCanAddCollectAttr(int excludeHeroID = 0) + { + foreach (var kv in heroCollectInfoDic) + { + if (kv.Key == excludeHeroID) + continue; + var state = GetHeroBookState(kv.Key, HeroConfig.Get(kv.Key).Quality); + if (state == 1 || state == 3 || state == 4) + { + return kv.Key; + } + } + 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; + } } -- Gitblit v1.8.0