Beispiel #1
0
        /// <summary>
        /// Adds an AnimationDescriptor directly into the dictionary, and assign a key to it
        /// </summary>
        /// <param name="desc">The AnimationDescriptor object</param>
        /// <param name="keyName">The key used to refere to the item</param>
        public static AnimationDescriptor Add(AnimationDescriptor desc, string keyName)
        {
            // Check if the key already exists
            if (Content.ContainsKey(keyName))
            {
                throw new ArgumentException("The given key name " + keyName + " already exists in the dictionary", "keyName");
            }

            desc.Name        = keyName;
            Content[keyName] = new GDAnimStorageItem(desc, keyName);

            return(desc);
        }
Beispiel #2
0
        /// <summary>
        /// Returns a list of all the items currently stored in the GDAnimStorage class
        /// </summary>
        /// <returns>A list of all the items currently stored in the GDAnimStorage class</returns>
        public static GDAnimStorageItem[] GetAllItems()
        {
            GDAnimStorageItem[] items = new GDAnimStorageItem[Content.Count];
            int i = 0;

            // Traverse the Dictionary that holds all the animation descriptors
            foreach (KeyValuePair <string, GDAnimStorageItem> k in Content)
            {
                items[i++] = k.Value;
            }

            return(items);
        }