lcy
2 天以前 4b1247636bb04a0f0491537cb9853cd0b2101367
Main/Utility/UIHelper.cs
@@ -1275,6 +1275,34 @@
        return isEnough;
    }
    /// <param name="needTips">0 不响应 1 弹提示 2 弹获取途径tips</param>
    public static bool CheckItemCount(int itemId, long needCount, int needTips = 0)
    {
        if (needCount <= 0)
        {
            return true;
        }
        long haveCount = PackManager.Instance.GetItemCountByID(PackType.Item, itemId);
        bool isEnough = haveCount >= needCount;
        if (!isEnough)
        {
            if (needTips == 1)
            {
                ItemConfig itemConfig = ItemConfig.Get(itemId);
                if (itemConfig != null)
                {
                    SysNotifyMgr.Instance.ShowTip("LackItem", itemConfig.ItemName);
                }
            }
            else if (needTips == 2)
            {
                ItemTipUtility.Show(itemId, true);
            }
        }
        return isEnough;
    }
    #endregion