Esempio n. 1
0
        public bool Initialize()
        {
            Logger.Info("Initializing theater of type {0}", _theaterType);

            if (!ModConfig.SetActiveTheater(_theaterType))
            {
                return(false);
            }
            Active = this;

            // load palettes and additional mix files for this theater
            _palettes             = new PaletteCollection();
            _palettes.IsoPalette  = new Palette(VFS.Open <PalFile>(ModConfig.ActiveTheater.IsoPaletteName));
            _palettes.OvlPalette  = new Palette(VFS.Open <PalFile>(ModConfig.ActiveTheater.OverlayPaletteName));
            _palettes.UnitPalette = new Palette(VFS.Open <PalFile>(ModConfig.ActiveTheater.UnitPaletteName), ModConfig.ActiveTheater.UnitPaletteName, true);

            foreach (string mix in ModConfig.ActiveTheater.Mixes)
            {
                VFS.Add(mix, CacheMethod.Cache);                 // we wish for these to be cached as they're gonna be hit often
            }
            _palettes.AnimPalette = new Palette(VFS.Open <PalFile>("anim.pal"));

            _animations = new ObjectCollection(CollectionType.Animation, _theaterType, _engine, _rules, _art,
                                               _rules.GetSection("Animations"), _palettes);

            _tileTypes = new TileCollection(CollectionType.Tiles, _theaterType, _engine, _rules, _art, ModConfig.ActiveTheater);

            _buildingTypes = new ObjectCollection(CollectionType.Building, _theaterType, _engine, _rules, _art,
                                                  _rules.GetSection("BuildingTypes"), _palettes);

            _aircraftTypes = new ObjectCollection(CollectionType.Aircraft, _theaterType, _engine, _rules, _art,
                                                  _rules.GetSection("AircraftTypes"), _palettes);

            _infantryTypes = new ObjectCollection(CollectionType.Infantry, _theaterType, _engine, _rules, _art,
                                                  _rules.GetSection("InfantryTypes"), _palettes);

            _overlayTypes = new ObjectCollection(CollectionType.Overlay, _theaterType, _engine, _rules, _art,
                                                 _rules.GetSection("OverlayTypes"), _palettes);

            _terrainTypes = new ObjectCollection(CollectionType.Terrain, _theaterType, _engine, _rules, _art,
                                                 _rules.GetSection("TerrainTypes"), _palettes);

            _smudgeTypes = new ObjectCollection(CollectionType.Smudge, _theaterType, _engine, _rules, _art,
                                                _rules.GetSection("SmudgeTypes"), _palettes);

            _vehicleTypes = new ObjectCollection(CollectionType.Vehicle, _theaterType, _engine, _rules, _art,
                                                 _rules.GetSection("VehicleTypes"), _palettes);

            _tileTypes.InitTilesets();
            _tileTypes.InitAnimations(_animations);

            return(true);
        }
Esempio n. 2
0
		public bool Initialize() {
			Logger.Info("Initializing theater of type {0}", _theaterType);

			if (!ModConfig.SetActiveTheater(_theaterType))
				return false;
			Active = this;

			// load palettes and additional mix files for this theater
			_palettes = new PaletteCollection();
			_palettes.IsoPalette = new Palette(VFS.Open<PalFile>(ModConfig.ActiveTheater.IsoPaletteName));
			_palettes.OvlPalette = new Palette(VFS.Open<PalFile>(ModConfig.ActiveTheater.OverlayPaletteName));
            _palettes.UnitPalette = new Palette(VFS.Open<PalFile>(ModConfig.ActiveTheater.UnitPaletteName), ModConfig.ActiveTheater.UnitPaletteName, true);

			foreach (string mix in ModConfig.ActiveTheater.Mixes)
				VFS.Add(mix, CacheMethod.Cache); // we wish for these to be cached as they're gonna be hit often

			_palettes.AnimPalette = new Palette(VFS.Open<PalFile>("anim.pal"));

			_animations = new ObjectCollection(CollectionType.Animation, _theaterType, _engine, _rules, _art,
				_rules.GetSection("Animations"), _palettes);

			_tileTypes = new TileCollection(CollectionType.Tiles, _theaterType, _engine, _rules, _art, ModConfig.ActiveTheater);

			_buildingTypes = new ObjectCollection(CollectionType.Building, _theaterType, _engine, _rules, _art,
				_rules.GetSection("BuildingTypes"), _palettes);

			_aircraftTypes = new ObjectCollection(CollectionType.Aircraft, _theaterType, _engine, _rules, _art,
				_rules.GetSection("AircraftTypes"), _palettes);

			_infantryTypes = new ObjectCollection(CollectionType.Infantry, _theaterType, _engine, _rules, _art,
				_rules.GetSection("InfantryTypes"), _palettes);

			_overlayTypes = new ObjectCollection(CollectionType.Overlay, _theaterType, _engine, _rules, _art,
				_rules.GetSection("OverlayTypes"), _palettes);

			_terrainTypes = new ObjectCollection(CollectionType.Terrain, _theaterType, _engine, _rules, _art,
				_rules.GetSection("TerrainTypes"), _palettes);

			_smudgeTypes = new ObjectCollection(CollectionType.Smudge, _theaterType, _engine, _rules, _art,
				_rules.GetSection("SmudgeTypes"), _palettes);

			_vehicleTypes = new ObjectCollection(CollectionType.Vehicle, _theaterType, _engine, _rules, _art,
				_rules.GetSection("VehicleTypes"), _palettes);

			_tileTypes.InitTilesets();
			_tileTypes.InitAnimations(_animations);

			return true;
		}