using System.Collections.Generic; namespace Cyber.Items { /// /// ItemDB containing 'templates' for all items. /// public class ItemDB { private Dictionary Items = new Dictionary(); private int Counter = 0; /// /// /// public static ItemDB Singleton = new ItemDB(); /// /// Creates the ItemDB. Should not be externally called. See . /// public ItemDB() { AddItem(new Item(Counter++, 0, "Very Long Item Name", 1.5f, "This item is a rare piece of the \"way too long of a name\" technology, invented by space goblins in ancient times.")); } /// /// If there is an item at the given ID, return a clone of it. Otherwise return null. /// /// The id of the desired item. /// public Item Get(int itemId) { if (Items.ContainsKey(itemId)) { return Items[itemId].Clone(); } return null; } private void AddItem(Item item) { Items.Add(item.ID, item); } } }