少年修仙传客户端代码仓库
QD-PangDeRong
2018-08-09 6a371f257088a8f18624b1a12db8bcc1564c9594
【2222】增加乾坤袋使用逻辑
6个文件已修改
109 ■■■■ 已修改文件
System/KnapSack/Logic/ItemTipsModel.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PackModelInterface.cs 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PackSendQuestMgr.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/BagWin.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/DepotWin.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/New/TempKnapSackBasic.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemTipsModel.cs
@@ -649,11 +649,7 @@
                if (attrData.itemConfig.UseTag == 1)
                {
                    if(attrData.itemConfig.ID != 951)
                    {
                        attrData.SetTipsFuncBtn(ItemWinBtnType.makeUse, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendUseItemQuest(ItemWinBtnType.makeUse, attrData.index); });
                    }
                    attrData.SetTipsFuncBtn(ItemWinBtnType.makeUse, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendUseItemQuest(ItemWinBtnType.makeUse, attrData.index); });
                }
            }
System/KnapSack/Logic/PackModelInterface.cs
@@ -458,16 +458,6 @@
                return isReach;
            }
            if(itemModel.itemId == 952)
            {
                int willTime = HangUpSetModel.Instance.offlinePluginTime + itemModel.chinItemModel.EffectValueA1;
                if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime)
                {
                    isReach = false;
                    return isReach;
                }
            }
            bool isBox = false;
            bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(itemModel.itemId,out isBox);
            if(isBox)
@@ -555,7 +545,47 @@
                    break;
            }
            switch(itemModel.itemId)
            {
                case 951:
                    if(!CheckIsExtendGrid(itemModel.itemId))
                    {
                        isReach = false;
                        return isReach;
                    }
                    break;
                case 952:
                    int willTime = HangUpSetModel.Instance.offlinePluginTime + itemModel.chinItemModel.EffectValueA1;
                    if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime)
                    {
                        isReach = false;
                        return isReach;
                    }
                    break;
            }
            return isReach;
        }
        private bool CheckIsExtendGrid(int itemId)
        {
            SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
            if (singlePack == null) return false;
            int startLockIndex = singlePack.openGridCount - GetInitGridCount(PackType.rptItem);
            FuncConfigConfig _tagFuncModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("OpenBagItem");
            int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId);
            Equation.Instance.Clear();
            Equation.Instance.AddKeyValue("index", startLockIndex + 1);
            int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2);
            if (haveCount >= needTool)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public event Action<string> RefreshGetBetterEquipEvent; //得到更好的装备 value 物品的实例ID
@@ -700,7 +730,7 @@
        #region 解锁格子
        private int GetInitGridCount(PackType type)
        public int GetInitGridCount(PackType type)
        {
            FuncConfigConfig initGridCount = null;
            if (type == PackType.rptItem)
System/KnapSack/Logic/PackSendQuestMgr.cs
@@ -677,7 +677,15 @@
                return;
            }
            if(useItemModel.itemInfo.ItemID == fairyModel.changeFairyNameItem)
            if (useItemModel.itemId == 951)
            {
                int startLockIndex = singlePack.openGridCount - modelInterface.GetInitGridCount(PackType.rptItem);
                int chooseGridCnt = singlePack.openGridCount + GetExtendGridCnt(startLockIndex);
                modelInterface.OpenGrid(chooseGridCnt, PackType.rptItem);
                return;
            }
            if (useItemModel.itemInfo.ItemID == fairyModel.changeFairyNameItem)
            {
                if(PlayerDatas.Instance.fairyData.HasFairy)
                {
@@ -741,6 +749,36 @@
            }
        }
        /// <summary>
        /// 获取当前道具可以开启的格子数
        /// </summary>
        /// <param name="startLockIndex"></param>
        /// <param name="needTool"></param>
        /// <param name="extendCnt"></param>
        /// <returns></returns>
        private int GetExtendGridCnt(int startLockIndex, int needTool = 0, int extendCnt = 0)
        {
            FuncConfigConfig _tagFuncModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("OpenBagItem");
            int haveCount = playerPack.GetItemCountByID(PackType.rptItem, useItemModel.itemId);
            startLockIndex += 1;
            Equation.Instance.Clear();
            Equation.Instance.AddKeyValue("index", startLockIndex);
            needTool += Equation.Instance.Eval<int>(_tagFuncModel.Numerical2);
            if (haveCount >= needTool)
            {
                extendCnt += 1;
                return GetExtendGridCnt(startLockIndex, needTool, extendCnt);
            }
            else
            {
                if (extendCnt <= 0)
                {
                    extendCnt = 1;
                }
                return extendCnt;
            }
        }
        public bool CheckItemUselimit(ItemConfig config)
        {
            int[] uselimits = config.UseCondiType;
System/KnapSack/New/BagWin.cs
@@ -306,7 +306,8 @@
          
                gridCell.lockBtn.onClick.RemoveAllListeners();
                gridCell.lockBtn.onClick.AddListener(() => {
                    OnClickLockBtn(cell.index, gridCell.gameObject,packModel);
                    int selectGridIndex = cell.index * 5 + int.Parse(gridCell.gameObject.name.Substring(gridCell.gameObject.name.Length - 1, 1));
                    OnClickLockBtn(selectGridIndex,packModel);
                });
            }
System/KnapSack/New/DepotWin.cs
@@ -203,7 +203,8 @@
                gridCell.lockBtn.onClick.RemoveAllListeners();
                gridCell.lockBtn.onClick.AddListener(() =>
                {
                    OnClickLockBtn(cell.index, gridCell.gameObject, packModel);
                    int selectGridIndex = cell.index * 5 + int.Parse(gridCell.gameObject.name.Substring(gridCell.gameObject.name.Length - 1, 1));
                    OnClickLockBtn(selectGridIndex, packModel);
                });
            }
System/KnapSack/New/TempKnapSackBasic.cs
@@ -98,10 +98,9 @@
        #endregion
        protected virtual void OnClickLockBtn(int gridLine,GameObject itemCell,SinglePackModel packModel)
        protected virtual void OnClickLockBtn(int selectGridIndex,SinglePackModel packModel)
        {
            int gridCount = gridLine*5 + int.Parse(itemCell.name.Substring(itemCell.name.Length-1,1));
            modelInterface.OpenGrid(gridCount,packModel.packType);
            modelInterface.OpenGrid(selectGridIndex,packModel.packType);
        }
    }