Exemplo n.º 1
0
    public int GetNumberOfRegisteredItems()
    {
        if (idToItemType == null)
        {
            idToItemType = new ItemTypeIDMapType();
            instance     = this;
        }


        return(idToItemType.Count);
    }
Exemplo n.º 2
0
    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);
    }