Ejemplo n.º 1
0
 void HandleLoadingProgress(object sender, EventArgs e)
 {
     if (LoadScreen != null && System.Threading.Thread.CurrentThread.ManagedThreadId == initialThreadId)
     {
         LoadScreen.Display();
     }
 }
Ejemplo n.º 2
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);

            // Reinit all our assets
            LoadInitialAssets();
            foreach (var pkg in Manifest.Packages)
            {
                FileSystem.Mount(pkg);
            }

            // Mount map package so custom assets can be used. TODO: check priority.
            FileSystem.Mount(FileSystem.OpenPackage(map.Path, int.MaxValue));

            Rules.LoadRules(Manifest, map);
            SpriteLoader = new SpriteLoader(Rules.TileSets[map.Tileset].Extensions, SheetBuilder);
            SequenceProvider.Initialize(Manifest.Sequences, map.Sequences);

            return(map);
        }
Ejemplo 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);

            LoadTranslations(map);

            // Reinit all our assets
            InitializeLoaders();
            FileSystem.LoadFromManifest(Manifest);

            // Mount map package so custom assets can be used. TODO: check priority.
            FileSystem.Mount(FileSystem.OpenPackage(map.Path, null, int.MaxValue));

            Rules.LoadRules(Manifest, map);
            SpriteLoader = new SpriteLoader(Rules.TileSets[map.Tileset].Extensions, SheetBuilder);

            // TODO: Don't load the sequences for assets that are not used in this tileset. Maybe use the existing EditorTilesetFilters.
            SequenceProvider.Initialize(Manifest.Sequences, map.Sequences);
            VoxelProvider.Initialize(Manifest.VoxelSequences, map.VoxelSequences);
            return(map);
        }
Ejemplo n.º 4
0
 public ModData(params string[] mods)
 {
     Manifest      = new Manifest(mods);
     ObjectCreator = new ObjectCreator(Manifest);
     LoadScreen    = ObjectCreator.CreateObject <ILoadScreen>(Manifest.LoadScreen.Value);
     LoadScreen.Init(Manifest.LoadScreen.NodesDict.ToDictionary(x => x.Key, x => x.Value.Value));
     LoadScreen.Display();
     WidgetLoader = new WidgetLoader(this);
 }
Ejemplo n.º 5
0
 public ModData( params string[] mods )
 {
     Manifest = new Manifest( mods );
     ObjectCreator = new ObjectCreator( Manifest );
     LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen.Value);
     LoadScreen.Init(Manifest.LoadScreen.NodesDict.ToDictionary(x => x.Key, x => x.Value.Value));
     LoadScreen.Display();
     WidgetLoader = new WidgetLoader( this );
 }
Ejemplo n.º 6
0
 public ModData( params string[] mods )
 {
     Manifest = new Manifest( mods );
     ObjectCreator = new ObjectCreator( Manifest );
     LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen);
     LoadScreen.Init();
     LoadScreen.Display();
     WidgetLoader = new WidgetLoader( this );
 }
Ejemplo n.º 7
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 );
        }
Ejemplo n.º 8
0
        public ModData(string mod)
        {
            Languages = new string[0];
            Manifest = new Manifest(mod);
            ObjectCreator = new ObjectCreator(Manifest);
            LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen.Value);
            LoadScreen.Init(Manifest, Manifest.LoadScreen.NodesDict.ToDictionary(x => x.Key, x => x.Value.Value));
            LoadScreen.Display();
            WidgetLoader = new WidgetLoader(this);

            // HACK: Mount only local folders so we have a half-working environment for the asset installer
            FileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
                FileSystem.Mount(dir);
        }
Ejemplo n.º 9
0
        public ModData(string mod)
        {
            Languages     = new string[0];
            Manifest      = new Manifest(mod);
            ObjectCreator = new ObjectCreator(Manifest);
            LoadScreen    = ObjectCreator.CreateObject <ILoadScreen>(Manifest.LoadScreen.Value);
            LoadScreen.Init(Manifest, Manifest.LoadScreen.NodesDict.ToDictionary(x => x.Key, x => x.Value.Value));
            LoadScreen.Display();
            WidgetLoader = new WidgetLoader(this);

            // HACK: Mount only local folders so we have a half-working environment for the asset installer
            FileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
            {
                FileSystem.Mount(dir);
            }
        }
Ejemplo n.º 10
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 );
        }
Ejemplo n.º 11
0
        public ModData(string mod)
        {
            Languages     = new string[0];
            Manifest      = new Manifest(mod);
            ObjectCreator = new ObjectCreator(Manifest);
            LoadScreen    = ObjectCreator.CreateObject <ILoadScreen>(Manifest.LoadScreen.Value);
            LoadScreen.Init(Manifest, Manifest.LoadScreen.ToDictionary(my => my.Value));
            LoadScreen.Display();
            WidgetLoader = new WidgetLoader(this);
            RulesetCache = new RulesetCache(this);
            RulesetCache.LoadingProgress += HandleLoadingProgress;
            MapCache = new MapCache(this);

            var loaders = new List <ISpriteLoader>();

            foreach (var format in Manifest.SpriteFormats)
            {
                var loader = ObjectCreator.FindType(format + "Loader");
                if (loader == null || !loader.GetInterfaces().Contains(typeof(ISpriteLoader)))
                {
                    throw new InvalidOperationException("Unable to find a sprite loader for type '{0}'.".F(format));
                }

                loaders.Add((ISpriteLoader)ObjectCreator.CreateBasic(loader));
            }

            SpriteLoaders = loaders.ToArray();

            // HACK: Mount only local folders so we have a half-working environment for the asset installer
            GlobalFileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
            {
                GlobalFileSystem.Mount(dir);
            }

            defaultRules = Exts.Lazy(() => RulesetCache.LoadDefaultRules());

            initialThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
        }
Ejemplo n.º 12
0
        public ModData(string mod)
        {
            Languages = new string[0];
            Manifest = new Manifest(mod);
            ObjectCreator = new ObjectCreator(Manifest);
            LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen.Value);
            LoadScreen.Init(Manifest, Manifest.LoadScreen.NodesDict.ToDictionary(x => x.Key, x => x.Value.Value));
            LoadScreen.Display();
            WidgetLoader = new WidgetLoader(this);
            RulesetCache = new RulesetCache(this);
            RulesetCache.LoadingProgress += HandleLoadingProgress;
            MapCache = new MapCache(this);

            // HACK: Mount only local folders so we have a half-working environment for the asset installer
            GlobalFileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
                GlobalFileSystem.Mount(dir);

            defaultRules = Exts.Lazy(() => RulesetCache.LoadDefaultRules());

            initialThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
        }
Ejemplo n.º 13
0
        public ModData(string mod)
        {
            Languages     = new string[0];
            Manifest      = new Manifest(mod);
            ObjectCreator = new ObjectCreator(Manifest);
            LoadScreen    = ObjectCreator.CreateObject <ILoadScreen>(Manifest.LoadScreen.Value);
            LoadScreen.Init(Manifest, Manifest.LoadScreen.ToDictionary(my => my.Value));
            LoadScreen.Display();
            WidgetLoader = new WidgetLoader(this);
            RulesetCache = new RulesetCache(this);
            RulesetCache.LoadingProgress += HandleLoadingProgress;
            MapCache = new MapCache(this);

            // HACK: Mount only local folders so we have a half-working environment for the asset installer
            GlobalFileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
            {
                GlobalFileSystem.Mount(dir);
            }

            defaultRules = Exts.Lazy(() => RulesetCache.LoadDefaultRules());

            initialThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
        }