Example #1
0
        /// <summary>
        /// Load all tilesets
        /// </summary>
        internal static void LoadAllTilesets()
        {
            // TODO: FIXME with new WarFile resource loading strategy

            WarResource     tileset  = ((RawResource)WarFile.GetResourceByName("Barrens 1")).Resource;
            WarResource     tiles    = ((RawResource)WarFile.GetResourceByName("Barrens 2")).Resource;
            PaletteResource tilesPAL = WarFile.GetResourceByName("Barrens 3") as PaletteResource;
            MapTileset      swamp    = new MapTileset(Tileset.Swamp, tileset, tiles, tilesPAL);

            knownTilesets.Add(swamp);

            tileset  = ((RawResource)WarFile.GetResourceByName("Summer 1")).Resource;
            tiles    = ((RawResource)WarFile.GetResourceByName("Summer 2")).Resource;
            tilesPAL = WarFile.GetResourceByName("Summer 3") as PaletteResource;
            MapTileset summer = new MapTileset(Tileset.Summer, tileset, tiles, tilesPAL);

            knownTilesets.Add(summer);

            if (WarFile.IsDemo == false)
            {
                tileset  = ((RawResource)WarFile.GetResourceByName("Dungeon 1")).Resource;
                tiles    = ((RawResource)WarFile.GetResourceByName("Dungeon 2")).Resource;
                tilesPAL = WarFile.GetResourceByName("Dungeon 3") as PaletteResource;
                MapTileset dungeon = new MapTileset(Tileset.Dungeon, tileset, tiles, tilesPAL);
                knownTilesets.Add(dungeon);
            }
        }
Example #2
0
        internal void LoadCampaignLevel(Race race, int level)
        {
            string basenameInfo = race + " " + level;

            LevelInfoResource     levelInfo     = WarFile.GetResourceByName(basenameInfo) as LevelInfoResource;
            LevelPassableResource levelPassable = WarFile.GetResource(levelInfo.PassableResourceIndex) as LevelPassableResource;
            LevelVisualResource   levelVisual   = WarFile.GetResource(levelInfo.VisualResourceIndex) as LevelVisualResource;

            if (InputHandler != null)
            {
                InputHandler.SetMapUnitOrder(MapUnitOrder.None);
            }

            CurrentMap = new Map(levelInfo, levelVisual, levelPassable);
            SetCameraOffset(levelInfo.StartCameraX * CurrentMap.TileWidth, levelInfo.StartCameraY * CurrentMap.TileHeight);

            CurrentMap.OnSelectedEntitiesChanged += HandleOnSelectedEntitiesChanged;
        }