| | |
| | | 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 |
| | | |