2024-04-28 13:55:19 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ColdMint.scripts.inventory;
|
|
|
|
|
|
2024-04-29 15:25:03 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>Item manager</para>
|
|
|
|
|
/// <para>物品管理器</para>
|
|
|
|
|
/// </summary>
|
2024-04-28 13:55:19 +00:00
|
|
|
|
public static class ItemManager
|
|
|
|
|
{
|
|
|
|
|
private static Dictionary<string, IItem> _dictionary = new Dictionary<string, IItem>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>Add items to Item Manager</para>
|
|
|
|
|
/// <para>在物品管理器内添加物品</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item"></param>
|
|
|
|
|
public static void AddItem(IItem item)
|
|
|
|
|
{
|
2024-04-29 15:25:03 +00:00
|
|
|
|
if (_dictionary.ContainsKey(item.Id))
|
2024-04-28 13:55:19 +00:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-29 15:25:03 +00:00
|
|
|
|
_dictionary.Add(item.Id, item);
|
2024-04-28 13:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|