Esempio n. 1
0
        public ModData( params string[] mods )
        {
            Manifest = new Manifest( mods );
            ObjectCreator = new ObjectCreator( Manifest );
            LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen);
            LoadScreen.Init();
            LoadScreen.Display();

            FileSystem.LoadFromManifest( Manifest );
            ChromeProvider.Initialize( Manifest.Chrome );
            SheetBuilder = new SheetBuilder( TextureChannel.Red );
            CursorSheetBuilder = new CursorSheetBuilder( this );
            AvailableMaps = FindMaps( mods );
            WidgetLoader = new WidgetLoader( this );
        }
Esempio n. 2
0
        public ModData( params string[] mods )
        {
            Manifest = new Manifest( mods );
            ObjectCreator = new ObjectCreator( Manifest );
            LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen);
            LoadScreen.Init();
            LoadScreen.Display();

            // all this manipulation of static crap here is nasty and breaks
            // horribly when you use ModData in unexpected ways.

            FileSystem.LoadFromManifest( Manifest );
            ChromeProvider.Initialize( Manifest.Chrome );
            SheetBuilder = new SheetBuilder( TextureChannel.Red );
            CursorSheetBuilder = new CursorSheetBuilder( this );
            AvailableMaps = FindMaps( mods );
            WidgetLoader = new WidgetLoader( this );
        }
Esempio n. 3
0
        public Map PrepareMap(string uid)
        {
            LoadScreen.Display();

            if (!AvailableMaps.ContainsKey(uid))
                throw new InvalidDataException("Invalid map uid: {0}".F(uid));

            var map = new Map(AvailableMaps[uid].Path);

            // unload the previous map mount if we have one
            if (previousMapMount != null) FileSystem.Unmount(previousMapMount);

            // Adds the map its container to the FileSystem
            // allowing the map to use custom assets
            // Container should have the lowest priority of all (ie int max)
            // Store a reference so we can unload it next time
            previousMapMount = FileSystem.OpenPackage(map.Path, int.MaxValue);
            FileSystem.Mount(previousMapMount);
            Rules.LoadRules(Manifest, map);

            if (map.Tileset != cachedTileset
                || previousMapHadSequences || map.Sequences.Count > 0)
            {
                SheetBuilder = new SheetBuilder( TextureChannel.Red );
                SpriteSheetBuilder.Initialize( Rules.TileSets[map.Tileset] );
                CursorSheetBuilder = new CursorSheetBuilder( this );
                CursorProvider.Initialize(Manifest.Cursors);
                SequenceProvider.Initialize(Manifest.Sequences, map.Sequences);
                cachedTileset = map.Tileset;
            }

            previousMapHadSequences = map.Sequences.Count > 0;

            return map;
        }
Esempio n. 4
0
        public void LoadInitialAssets()
        {
            // all this manipulation of static crap here is nasty and breaks
            // horribly when you use ModData in unexpected ways.
            FileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
                FileSystem.Mount(dir);

            ReloadMaps();
            Palette = new HardwarePalette();
            ChromeProvider.Initialize( Manifest.Chrome );
            SheetBuilder = new SheetBuilder( TextureChannel.Red );
            CursorSheetBuilder = new CursorSheetBuilder( this );
            CursorProvider.Initialize(Manifest.Cursors);
            Palette.Update(new IPaletteModifier[]{});
        }