| | |
| | |
|
| | | int startLockIndex = singlePack.unlockedGridCount - PackManager.Instance.initBagGridCount;
|
| | | FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem");
|
| | | int haveCount = packModel.GetItemCountByID(PackType.Item, itemId);
|
| | | var haveCount = packModel.GetItemCountByID(PackType.Item, itemId);
|
| | | Equation.Instance.Clear();
|
| | | Equation.Instance.AddKeyValue("index", startLockIndex + 1);
|
| | | int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2);
|
| | | if (haveCount >= needTool)
|
| | | if (haveCount >= (ulong)needTool)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
| | | /// <param name="packType 背包类型"></param>
|
| | | /// <param name="itemId 物品ID"></param>
|
| | | /// <param name="needCount 需要数量"></param>
|
| | | /// <param name="needTips 是否需要提示"></param>
|
| | | /// <param name="needTips">0 不响应 1 弹提示 2 弹获取途径tips</param>
|
| | | /// <returns></returns>
|
| | | public static bool CheckItemCount(PackType packType, int itemId, int needCount, bool needTips = false)
|
| | | public static bool CheckItemCount(PackType packType, int itemId, ulong needCount, int needTips = 0)
|
| | | {
|
| | | if (needCount <= 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | int haveCount = PackManager.Instance.GetItemCountByID(packType, itemId);
|
| | | var haveCount = PackManager.Instance.GetItemCountByID(packType, itemId);
|
| | |
|
| | | bool isEnough = haveCount >= needCount;
|
| | |
|
| | | if (!isEnough && needTips)
|
| | | if (!isEnough)
|
| | | {
|
| | | var itemConfig = ItemConfig.Get(itemId);
|
| | |
|
| | | if (null != itemConfig)
|
| | | if (needTips == 1)
|
| | | {
|
| | | // 是否有获取途径
|
| | | // 是 弹出获取途径
|
| | | // 否 显示物品数量不足
|
| | | // SysNotifyMgr.Instance.ShowTip();
|
| | | // YYL TODO
|
| | | SysNotifyMgr.Instance.ShowTip("ItemNotEnough", itemId);
|
| | | }
|
| | | else if (needTips == 2)
|
| | | {
|
| | | ItemTipUtility.Show(itemId, true);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | if (!isEnough && needTips)
|
| | | {
|
| | | // 是否有获取途径
|
| | | // 是 弹出获取途径
|
| | | // 否 显示物品数量不足
|
| | | // SysNotifyMgr.Instance.ShowTip();
|
| | | // YYL TODO
|
| | | Debug.LogError("货币不足 " + moneyType);
|
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
|
| | | }
|
| | |
|
| | | return isEnough;
|