From 06da72770c641fabf980816ed466a2280dac2be7 Mon Sep 17 00:00:00 2001 From: yyl <yyl> Date: 星期二, 05 八月 2025 19:25:14 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts --- Main/System/KnapSack/PackManager.cs | 276 ++++++++++++++++++++++--------------------------------- 1 files changed, 111 insertions(+), 165 deletions(-) diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs index ae9f4fb..dcd15ab 100644 --- a/Main/System/KnapSack/PackManager.cs +++ b/Main/System/KnapSack/PackManager.cs @@ -8,12 +8,42 @@ public class PackManager : GameSystemManager<PackManager> { + public event Action<PackType> refrechPackEvent; //鍒锋柊鏁翠釜鑳屽寘鏁版嵁 + + //鐗╁搧锛堝垱寤猴級鍒锋柊锛屽彲鑳芥壒閲忓垱寤烘敞鎰忔晥鐜�; bool锛歵rue浠h〃鍒涘缓 false 鍒锋柊; 娉ㄦ剰0707鐗╁搧鏁伴噺鍒锋柊涓嶅寘鍚湪姝や簨浠� + public event Action<PackType, string, bool> ChangeItemEvent; // 鑳屽寘绫诲瀷锛孏UID锛屾槸鍚﹀垱寤� + + //鍒犻櫎鐗╁搧锛屽彲鑳芥壒閲忓垹闄ゆ敞鎰忔晥鐜� + public event Action<PackType, string> DeleteItemEvent; // 鑳屽寘绫诲瀷锛孏UID + + // 鍗曠墿鍝佸埛鏂� 鍦ㄥ緱鍒版柊鐗╁搧銆佺墿鍝佹暟閲忕殑鏀瑰彉锛屾竻鐞嗚鐗╁搧鏃跺潎浼氳Е鍙� ; 浣�0725鏁翠釜鑳屽寘鍒锋柊涓嶈Е鍙戯紝濡傛灉鏈夐渶瑕佸崟鐙暟閲忓埛鏂颁簨浠跺彟澶栧鐞� + // 瑙﹀彂姣旇緝棰戠箒锛岀晫闈娇鐢ㄦ椂鍙互鍋氫釜姹囨�诲悗寤惰繜鍒锋柊 + public event Action<PackType, int, int> RefreshItemEvent; //鑳屽寘绫诲瀷锛屼綅缃储寮曪紝鐗╁搧id + public event Action<PackType> gridRefreshEvent; //鑳屽寘鍙敤鏍煎瓙鏁板埛鏂� + public event Action<int, int> useItemSuccessEvent; //鐗╁搧浣跨敤鎴愬姛 int 浣嶇疆绱㈠紩 int鐗╁搧id + + public event Action<int> refreshItemDayUseCountEvent; //鍒锋柊鐗╁搧姣忔棩浣跨敤鏁伴噺 + public event Action<int> refreshItemSumUseCountEvent; //鍒锋柊鐗╁搧鎬讳娇鐢ㄦ暟閲� + + public bool isPlayBetterEquipEffect { get; set; } //鏁寸悊鑳屽寘鏃舵槸鍚︽挱鏀剧壒鏁� + + + private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>(); + private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>(); + + private Dictionary<int, int> PackGirdServerBuyCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氳喘涔版牸瀛愮殑娆℃暟 + + //璇昏〃鏁版嵁 public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氳儗鍖呮牸瀛愭渶澶ф暟閲� public Dictionary<int, int> PackInitCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氬垵濮嬫暟閲� public int initBagGridCount { get; private set; } //鍒濆鐗╁搧鑳屽寘鏍煎瓙鏁� public int[] itemPackSortTyps { get; private set; } //鑳屽寘鐗╁搧鐨勬寜绫诲瀷鎺掑簭 public List<string> composeItemGuidList = new List<string>(); //鍚堟垚鍒楄〃鐗╁搧guid + //寮�鏍煎瓙 + public Dictionary<int, int> openGirdMoneyDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氭秷鑰楄揣甯佺被鍨� + public Dictionary<int, int[]> openGirdMoneyValueDict = new Dictionary<int, int[]>(); //鑳屽寘绫诲瀷锛氭秷鑰楄揣甯佸��(鎸夋鏁板畾浠�) + public Dictionary<int, int[]> openGirdCountDict = new Dictionary<int, int[]>(); //鑳屽寘绫诲瀷锛氭瘡娆″紑鐨勬牸瀛愭暟閲� public static string StrengthAttrShift_RecordKey = ""; public const string RecordKnapsackTitle = "RecordKnapsackTitle"; @@ -23,11 +53,7 @@ Dictionary<int, List<int>> sharedUseCountItemDict { get; set; } bool isUpdatePlayerLv = false; - //AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } } - //ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } - - List<string> commonShowAwardEvents = new List<string>(); - + public int[] gameCashShow; //浠i噾鍒哥壒娈婃樉绀� 闄や互100 public int[] autoUseItemIDs; public override void Init() { @@ -56,9 +82,8 @@ // } // } - ParseItemCount(); - autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("ItemTipsNum").Numerical2); + } @@ -71,23 +96,7 @@ // SysNotifyMgr.Instance.sysNotifyEvent -= RefreshSysInfo; } - public Dictionary<int, string> textCountShow = new Dictionary<int, string>(); - public int[] textCountShow2; - public List<int> gameCashShow = new List<int>(); - - public void ParseItemCount() - { - var textConfig = FuncConfigConfig.Get("ItemCountShow"); - var json = JsonMapper.ToObject(textConfig.Numerical1); - foreach (var key in json.Keys) - { - var itemID = int.Parse(key); - textCountShow[itemID] = json[key].ToString(); - } - - textCountShow2 = JsonMapper.ToObject<int[]>(textConfig.Numerical2); - gameCashShow = JsonMapper.ToObject<List<int>>(textConfig.Numerical3); - } + private void OnFuncStateChangeEvent(int id) @@ -165,28 +174,7 @@ // } } - public event Action<PackType> refrechPackEvent; //鍒锋柊鏁翠釜鑳屽寘鏁版嵁 - - //鐗╁搧锛堝垱寤猴級鍒锋柊锛屽彲鑳芥壒閲忓垱寤烘敞鎰忔晥鐜�; bool锛歵rue浠h〃鍒涘缓 false 鍒锋柊; 娉ㄦ剰0707鐗╁搧鏁伴噺鍒锋柊涓嶅寘鍚湪姝や簨浠� - public event Action<PackType, string, bool> ChangeItemEvent; // 鑳屽寘绫诲瀷锛孏UID锛屾槸鍚﹀垱寤� - - //鍒犻櫎鐗╁搧锛屽彲鑳芥壒閲忓垹闄ゆ敞鎰忔晥鐜� - public event Action<PackType, string> DeleteItemEvent; // 鑳屽寘绫诲瀷锛孏UID - - // 鍗曠墿鍝佸埛鏂� 鍦ㄥ緱鍒版柊鐗╁搧銆佺墿鍝佹暟閲忕殑鏀瑰彉锛屾竻鐞嗚鐗╁搧鏃跺潎浼氳Е鍙� ; 浣�0725鏁翠釜鑳屽寘鍒锋柊涓嶈Е鍙戯紝濡傛灉鏈夐渶瑕佸崟鐙暟閲忓埛鏂颁簨浠跺彟澶栧鐞� - // 瑙﹀彂姣旇緝棰戠箒锛岀晫闈娇鐢ㄦ椂鍙互鍋氫釜姹囨�诲悗寤惰繜鍒锋柊 - public event Action<PackType, int, int> RefreshItemEvent; //鑳屽寘绫诲瀷锛屼綅缃储寮曪紝鐗╁搧id - public event Action<PackType> gridRefreshEvent; //鑳屽寘鍙敤鏍煎瓙鏁板埛鏂� - public event Action<int, int> useItemSuccessEvent; //鐗╁搧浣跨敤鎴愬姛 int 浣嶇疆绱㈠紩 int鐗╁搧id - - public event Action<int> refreshItemDayUseCountEvent; //鍒锋柊鐗╁搧姣忔棩浣跨敤鏁伴噺 - public event Action<int> refreshItemSumUseCountEvent; //鍒锋柊鐗╁搧鎬讳娇鐢ㄦ暟閲� - - public bool isPlayBetterEquipEffect { get; set; } //鏁寸悊鑳屽寘鏃舵槸鍚︽挱鏀剧壒鏁� - - #region 鎺ユ敹鏈嶅姟绔暟鎹� - private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>(); - private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>(); + public void UpdatePack(H0725_tagRolePackRefreshEx packInfo) { @@ -270,7 +258,18 @@ } + public void UpdateBuyPackGirdCount(HA207_tagSCPackBuyInfo netPack) + { + for (int i = 0; i < netPack.BuyInfoList.Length; i++) + { + PackGirdServerBuyCountDict[netPack.BuyInfoList[i].PackType] = netPack.BuyInfoList[i].BuyCnt; + } + } + public int[] BuyPackGirdNeedData(PackType packType) + { + return null; + } public void UpdateUnlockedGridCount(H0724_tagRolePackCanUseCount useCount) { @@ -475,21 +474,27 @@ // } // } - #endregion #region 鐜╁瑁呭鐗规畩閫昏緫 void ParseConfig() { - var config = FuncConfigConfig.Get("CommonShowAwards"); - commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1); - config= FuncConfigConfig.Get("InitBagCellCount"); + ParsePackConfigIni(); + autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("AutoUseItem").Numerical1); + var config= FuncConfigConfig.Get("InitBagCellCount"); initBagGridCount = int.Parse(config.Numerical1); PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2); config = FuncConfigConfig.Get("PackageSortPriority"); itemPackSortTyps = ConfigParse.GetMultipleStr<int>(config.Numerical1); - ParsePackConfigIni(); + + config = FuncConfigConfig.Get("OpenPack"); + openGirdMoneyDict = ConfigParse.ParseIntDict(config.Numerical1); + openGirdMoneyValueDict = ConfigParse.ParseIntArrayDict(config.Numerical2); + openGirdCountDict = ConfigParse.ParseIntArrayDict(config.Numerical3); + + config = FuncConfigConfig.Get("ItemCountShow"); + gameCashShow = JsonMapper.ToObject<int[]>(config.Numerical1); } void ParsePackConfigIni() @@ -527,6 +532,15 @@ } return File.ReadAllLines(path); + } + + public int GetCanBuyPackGirdCount(PackType type) + { + if (!PackMaxCountDict.ContainsKey((int)type)) + { + return 0; + } + return PackMaxCountDict[(int)type] - GetSinglePack(type).unlockedGridCount; } @@ -786,17 +800,17 @@ { int useCnt = 0; List<int> shareIdlist = null; - bool isShare = TryGetShareNumItem(itemId, out shareIdlist); - if (isShare) - { - foreach (var id in shareIdlist) - { - int singleUseCnt = 0; - itemDayUseCntDict.TryGetValue(id, out singleUseCnt); - useCnt += singleUseCnt; - } - } - else + // bool isShare = TryGetShareNumItem(itemId, out shareIdlist); + // if (isShare) + // { + // foreach (var id in shareIdlist) + // { + // int singleUseCnt = 0; + // itemDayUseCntDict.TryGetValue(id, out singleUseCnt); + // useCnt += singleUseCnt; + // } + // } + // else { itemDayUseCntDict.TryGetValue(itemId, out useCnt); } @@ -843,9 +857,6 @@ const int ITEMPACK_REDKEY = 102011003; Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); - const int LS_REDKEY = 102011015; - Redpoint redpointLS = new Redpoint(MainRedDot.RedPoint_BagFuncKey, LS_REDKEY); - private void UpdatePackRedpoint(PackType type) { @@ -869,16 +880,7 @@ } break; - case PackType.Warehouse: - if (singlePack.GetEmptyGridCount() <= 0) - { - MainRedDot.Instance.redPointDepotFunc.state = RedPointState.Full; - } - else - { - MainRedDot.Instance.redPointDepotFunc.state = RedPointState.None; - } - break; + } } @@ -972,44 +974,44 @@ #endregion #region 鍒ゆ柇鐗╁搧鏄惁杈惧埌浣跨敤涓婇檺 - // public bool IsReachUseLimit(string guid, out ulong count) - // { - // count = 0; - // ItemModel itemModel = GetItemByGuid(guid); - // if (itemModel == null) return false; + public bool IsReachUseLimit(string guid, out ulong count) + { + count = 0; + ItemModel itemModel = GetItemByGuid(guid); + if (itemModel == null) return false; - // AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId); - // int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId); - // int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId); - // count = (ulong)itemModel.count; - // bool isReach = false; - // int remainDayCnt = 0; - // if (itemModel.config.MaxSkillCnt > 0) - // { - // remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt; - // if (itemModel.count > remainDayCnt) - // { - // count = (ulong)remainDayCnt; - // } - // } + // AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId); + int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId); + int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId); + count = (ulong)itemModel.count; + bool isReach = false; + int remainDayCnt = 0; + if (itemModel.config.MaxSkillCnt > 0) + { + remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt; + if (itemModel.count > remainDayCnt) + { + count = (ulong)remainDayCnt; + } + } - // int remainSumCnt = 0; - // if (fruitConfig != null) - // { - // remainSumCnt = fruitConfig.basicUseLimit - sumHaveUseCnt; - // if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt) - // { - // count = (ulong)remainSumCnt; - // } - // } + int remainSumCnt = 0; + // if (fruitConfig != null) + // { + // remainSumCnt = fruitConfig.basicUseLimit - sumHaveUseCnt; + // if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt) + // { + // count = (ulong)remainSumCnt; + // } + // } - // if (count < (ulong)itemModel.count) - // { - // isReach = true; - // } + if (count < (ulong)itemModel.count) + { + isReach = true; + } - // return isReach; - // } + return isReach; + } #endregion @@ -1028,60 +1030,4 @@ } - - - public void ReceiveAwardNotify(HA801_tagMCGiveAwardInfo netPack) - { - var eventName = UIHelper.ServerStringTrim(netPack.EventName); - if (eventName == "BuyItem") - return; - - // 浠欑洘鏀诲煄鎴� - // if (eventName == "FamilyGCZSQGrid" || eventName == "FamilyGCZSQPass" || eventName == "FamilyGCZSQPassAll" || - // eventName == "FamilyGCZContiribution" || eventName == "FamilyGCZAtk") - // { - // ModelCenter.Instance.GetModel<FairySiegeActModel>()?.OnUpdateAwardInfoAction(netPack); - // return; - // } - if (!commonShowAwardEvents.Contains(eventName)) - return; - - List<Item> showItems = new List<Item>(); - - if (netPack.Exp != 0 || netPack.ExpPoint != 0) - { - ulong expValue = netPack.Exp + netPack.ExpPoint * (ulong)Constants.ExpPointValue; - showItems.Add(new Item(GeneralDefine.expDisplayId, expValue)); - } - if (netPack.MoneyList.Length != 0) - { - for (int i = 0; i < netPack.MoneyLen; i++) - { - var moneyType = netPack.MoneyList[i].MoneyType; - if (GeneralDefine.moneyDisplayIds.ContainsKey(moneyType) && netPack.MoneyList[i].MoneyValue != 0) - { - showItems.Add(new Item(GeneralDefine.moneyDisplayIds[moneyType], netPack.MoneyList[i].MoneyValue)); - } - - } - } - - if (netPack.ItemList.Length != 0) - { - for (int i = 0; i < netPack.ItemLen; i++) - { - showItems.Add(new Item((int)netPack.ItemList[i].ItemID, netPack.ItemList[i].Count, netPack.ItemList[i].IsBind)); - } - } - - - string info = string.Empty; - if (LanguageConfig.HasKey("commonShowAwardEvents_" + eventName)) - info = Language.Get("commonShowAwardEvents_" + eventName); - - if (showItems.Count == 0) - return; - - ItemLogicUtility.Instance.ShowGetItem(showItems, info, 0, eventName: eventName); - } } -- Gitblit v1.8.0