Пример #1
0
        public static Type ToFactoryType(this ItemFactory.ItemSlotInfo.ItemType type)
        {
            Type result;

            TypeMapping.TryGetValue(type, out result);
            return(result);
        }
Пример #2
0
        /// <summary>
        /// Gets the factory names of all items known of the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>All items of that type.</returns>
        public static IEnumerable <IFactory> GetAllItemsOfType(ItemFactory.ItemSlotInfo.ItemType type)
        {
            var factoryType = type.ToFactoryType();

            foreach (var factoryByType in FactoriesByType)
            {
                if (factoryByType.Key != factoryType)
                {
                    continue;
                }
                foreach (var factory in factoryByType.Value)
                {
                    yield return(factory);
                }
            }
        }