Example #1
0
        protected override Drawable MakeDrawable(string objName)
        {
            Drawable drawable;
            var      rulesSection   = Rules.GetOrCreateSection(objName);
            string   artSectionName = rulesSection.ReadString("Image", objName);
            var      artSection     = Art.GetOrCreateSection(artSectionName);

            switch (Type)
            {
            case CollectionType.Aircraft:
            case CollectionType.Vehicle:
                drawable = new UnitDrawable(_config, _vfs, rulesSection, artSection);
                break;

            case CollectionType.Building:
                drawable = new BuildingDrawable(_config, _vfs, rulesSection, artSection);
                break;

            case CollectionType.Infantry:
            case CollectionType.Overlay:
            case CollectionType.Smudge:
                drawable = new ShpDrawable(_config, _vfs, rulesSection, artSection);
                break;

            case CollectionType.Terrain:
                drawable = new TerrainDrawable(_config, _vfs, rulesSection, artSection);
                break;

            case CollectionType.Animation:
                drawable = new AnimDrawable(_config, _vfs, rulesSection, artSection);
                break;

            default:
                throw new InvalidEnumArgumentException();
            }
            return(drawable);
        }
Example #2
0
 private void LoadTerrainDrawable(TerrainDrawable drawable)
 {
     InitDrawableDefaults(drawable);
     drawable.LoadFromRules();
 }