public int GetNumberOfRegisteredItems() { if (idToItemType == null) { idToItemType = new ItemTypeIDMapType(); instance = this; } return(idToItemType.Count); }
public IEnumerable <KeyValuePair <uint, ItemType> > GetItemTypeMappings() { if (idToItemType == null) { idToItemType = new ItemTypeIDMapType(); instance = this; } bool remakeDict = false; List <KeyValuePair <uint, ItemType> > mySanitizedEntries = new List <KeyValuePair <uint, ItemType> > (); foreach (var entry in idToItemType) { if (entry.Key != 0 && entry.Value != null) { mySanitizedEntries.Add(entry); } else { remakeDict = true; } } if (remakeDict) { Debug.Log("MetaInformation found a null or 0-id entry."); idToItemType = new ItemTypeIDMapType(); foreach (var entry in mySanitizedEntries) { idToItemType [entry.Key] = entry.Value; } } return(mySanitizedEntries); }