using UnityEngine;
namespace DuloGames.UI
{
public class UIItemDatabase : ScriptableObject {
#region singleton
private static UIItemDatabase m_Instance;
public static UIItemDatabase Instance
{
get
{
if (m_Instance == null)
m_Instance = Resources.Load("Databases/ItemDatabase") as UIItemDatabase;
return m_Instance;
}
}
#endregion
public UIItemInfo[] items;
///
/// Get the specified ItemInfo by index.
///
/// Index.
public UIItemInfo Get(int index)
{
return (this.items[index]);
}
///
/// Gets the specified ItemInfo by ID.
///
/// The ItemInfo or NULL if not found.
/// The item ID.
public UIItemInfo GetByID(int ID)
{
for (int i = 0; i < this.items.Length; i++)
{
if (this.items[i].ID == ID)
return this.items[i];
}
return null;
}
}
}