Inheritance: IItemFactoryManager
コード例 #1
0
ファイル: ItemFactory.cs プロジェクト: Haedrian/Divine-Right
        /// <summary>
        /// Creates an item from its category and its internal name
        /// </summary>
        /// <param name="category"></param>
        /// <param name="internalName"></param>
        /// <returns></returns>
        public MapItem CreateItem(string category, int itemID)
        {
            IItemFactoryManager mgr = null;
            switch (category.ToLower())
            {
                case "mundaneitem":
                    mgr = new MundaneItemsManager();
                    break;
                case "mundaneitems":
                    mgr = new MundaneItemsManager();
                    break;
                case "tile":
                    mgr = new TilesManager();
                    break;
                case "tiles":
                    mgr = new TilesManager();
                    break;
                case "toggleitems":
                    mgr = new ToggleItemsManager();
                    break;
                case "toggleitem":
                    mgr = new ToggleItemsManager();
                    break;
                case "enemies":
                    mgr = new EnemyManager();
                    break;
                case "inventoryitems":
                    mgr = new InventoryItemManager();
                    break;
                default:
                    throw new NotImplementedException("The category : " + category + " could not be found");
            }

            return mgr.CreateItem(itemID);
        }
コード例 #2
0
ファイル: ItemFactory.cs プロジェクト: Haedrian/Divine-Right
        public MapItem CreateItem(string category, List<string> parameters)
        {
            IItemFactoryManager mgr = null;
            switch (category)
            {
                case "mundaneitem":
                    mgr = new MundaneItemsManager();
                    break;
                case "tile":
                    mgr = new TilesManager();
                    break;
                case "toggleitem":
                    mgr = new ToggleItemsManager();
                    break;
                case "enemies":
                    mgr = new EnemyManager();
                    break;
                default: throw new NotImplementedException("The category : " + category + " could not be found");
            }

            return mgr.CreateItem(parameters);
        }