From cad87129e5ea2fd23cc195ed0444bd38f1117aa7 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期二, 05 八月 2025 15:51:54 +0800 Subject: [PATCH] 79 【常规】背包 - 随机宝箱界面,自选宝箱界面,获得物品奖励界面 --- Main/System/KnapSack/PackManager.cs | 153 ++++++++++++++++----------------------------------- 1 files changed, 48 insertions(+), 105 deletions(-) diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs index ae9f4fb..b307a4e 100644 --- a/Main/System/KnapSack/PackManager.cs +++ b/Main/System/KnapSack/PackManager.cs @@ -26,7 +26,7 @@ //AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } } //ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } - List<string> commonShowAwardEvents = new List<string>(); + public int[] autoUseItemIDs; public override void Init() @@ -480,10 +480,9 @@ #region 鐜╁瑁呭鐗规畩閫昏緫 void ParseConfig() { - var config = FuncConfigConfig.Get("CommonShowAwards"); - commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1); - config= FuncConfigConfig.Get("InitBagCellCount"); + + var config= FuncConfigConfig.Get("InitBagCellCount"); initBagGridCount = int.Parse(config.Numerical1); PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2); @@ -786,17 +785,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); } @@ -972,44 +971,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 +1027,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