| | |
| | | //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() |
| | |
| | | #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); |
| | | |
| | |
| | | { |
| | | 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); |
| | | } |
| | |
| | | #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 |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | 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); |
| | | } |
| | | } |