Exemple #1
0
        public static IElementType GetElementFromType(string elementType)
        {
            IElementType newElement = null;

            switch (elementType)
            {
            case "RESSOURCE_FOREST":
                newElement = new ForestElementType();
                break;

            case "RESSOURCE_STONE":
                newElement = new StoneElementType();
                break;

            case "RESSOURCE_IRON":
                newElement = new IronElementType();
                break;

            case "RESSOURCE_WATER":
                newElement = new LakeElementType();
                break;

            case "RESSOURCE_FIELDS":
                newElement = new FieldsElementType();
                break;

            case "BUILDING_WOODCUTTER":
                newElement = new WoodcutterElementType();
                break;

            case "BUILDING_SAWMILL":
                newElement = new SawmillElementType();
                break;

            case "BUILDING_QUARRY":
                newElement = new QuarryElementType();
                break;

            case "BUILDING_STONEMASON":
                newElement = new StoneMasonElementType();
                break;

            case "BUILDING_IRONMINE":
                newElement = new IronMineElementType();
                break;

            case "BUILDING_FOUNDRY":
                newElement = new FoundryElementType();
                break;

            case "BUILDING_TOWNHALL":
                newElement = new TownHallElementType();
                break;

            case "BUILDING_FARM":
                newElement = new FarmElementType();
                break;

            case "BUILDING_MILL":
                newElement = new MillElementType();
                break;

            case "BUILDING_TOWNHOUSE":
                newElement = new TownhouseElementType();
                break;

            case "BUILDING_MARKETPLACE":
                newElement = new MarketplaceElementType();
                break;

            case "BUILDING_RESEARCH_CENTER":
                newElement = new ResearchCenterElementType();
                break;

            case "BUILDING_WAREHOUSE":
                newElement = new WarehouseElementType();
                break;

            case "BUILDING_BARRACK":
                newElement = new BarrackBuilding();
                break;

            case "BUILDING_CITYGUARD_HOUSE":
                newElement = new CityguardBuilding();
                break;

            case "BUILDING_TRAINING_GROUND":
                newElement = new TrainingGroundBuilding();
                break;

            case "BUILDING_STABLE":
                newElement = new StableBuilding();
                break;

            case "BUILDING_MOONGLOW_TOWER":
                newElement = new MoonglowTowerBuilding();
                break;
            }

            return(newElement);
        }
        public static IElementType GetElementFromType(string elementType)
        {
            IElementType newElement = null;
            switch(elementType)
            {
                case "RESSOURCE_FOREST":
                    newElement = new ForestElementType();
                    break;
                case "RESSOURCE_STONE":
                    newElement = new StoneElementType();
                    break;
                case "RESSOURCE_IRON":
                    newElement = new IronElementType();
                    break;
                case "RESSOURCE_WATER":
                    newElement = new LakeElementType();
                    break;
                case "RESSOURCE_FIELDS":
                    newElement = new FieldsElementType();
                    break;
                case "BUILDING_WOODCUTTER":
                    newElement = new WoodcutterElementType();
                    break;
                case "BUILDING_SAWMILL":
                    newElement = new SawmillElementType();
                    break;
                case "BUILDING_QUARRY":
                    newElement = new QuarryElementType();
                    break;
                case "BUILDING_STONEMASON":
                    newElement = new StoneMasonElementType();
                    break;
                case "BUILDING_IRONMINE":
                    newElement = new IronMineElementType();
                    break;
                case "BUILDING_FOUNDRY":
                    newElement = new FoundryElementType();
                    break;
                case "BUILDING_TOWNHALL":
                    newElement = new TownHallElementType();
                    break;
                case "BUILDING_FARM":
                    newElement = new FarmElementType();
                    break;
                case "BUILDING_MILL":
                    newElement = new MillElementType();
                    break;
                case "BUILDING_TOWNHOUSE":
                    newElement = new TownhouseElementType();
                    break;
                case "BUILDING_MARKETPLACE":
                    newElement = new MarketplaceElementType();
                    break;
                case "BUILDING_RESEARCH_CENTER":
                    newElement = new ResearchCenterElementType();
                    break;
                case "BUILDING_WAREHOUSE":
                    newElement = new WarehouseElementType();
                    break;
                case "BUILDING_BARRACK":
                    newElement = new BarrackBuilding();
                    break;
                case "BUILDING_CITYGUARD_HOUSE":
                    newElement = new CityguardBuilding();
                    break;
                case "BUILDING_TRAINING_GROUND":
                    newElement = new TrainingGroundBuilding();
                    break;
                case "BUILDING_STABLE":
                    newElement = new StableBuilding();
                    break;
                case "BUILDING_MOONGLOW_TOWER":
                    newElement = new MoonglowTowerBuilding();
                    break;
            }

            return newElement;
        }