AGS Development > Other Engine & Editor Development

MonoAGS components system and FileSystem.

(1/2) > >>

Monsieur OUXX:
I'm fiddling with the ResourceSelector branch and I've noticed how FilesView has a private IFileSystem. It's supposed to be populated by FileView's constructor : FilesView(IFileSystem files, ...).
However I can't seem to understand where and how this constructor gets called. Is it with _filesView = rightPanel.AddComponent<FilesView>();?

The reason why I want to know this is because I want to know how the FileSystem is decided. In the master branch, the Resources system has stuff like this :
game.Factory.Resources.ResourcePacks.Add(new ResourcePack(new FileSystemResourcePack(AGSGame.Device.FileSystem, AGSGame.Device.Assemblies.EntryAssembly), 0));
There, the FileSystem is passed explicitly. It's done twice: One for the mobile file system, and one for the Desktop file system.

But then how does it work with FilesView? Why and how is the FileSystem chosen implicitly there?

tzachs:
When you call AddComponent<> the engine uses the Resolver class to resolve all the dependencies that the component has in its constructor.
The resolver itself it is tied to the device's file system by default. You can, however, override it with your own file system implementation if you want. To do that, you'll create your own implementation of the IFileSystem interface and then tell the resolver to use your implementation instead. Here's an example of how you'd do something like that.

If you want, you can also create the component yourself and pass a file system explicitly, and then call AddComponent with your component:

--- Code: C# ---var view = new FilesView(AGSGame.Device.FileSystem, ...);_filesView = rightPanel.AddComponent(view);
p.s The files view is not a complete implementation (I stopped mid-development as I started questioning some design choices I made- so this goes to the back-burner until I figure out what's the next step for the editor).


--- Quote from: Monsieur OUXX on 20 Mar 2019, 12:37 ---It's done twice: One for the mobile file system, and one for the Desktop file system.

--- End quote ---
Not sure what you mean here. The file system is passed once afaik.

Monsieur OUXX:

--- Quote from: tzachs on 20 Mar 2019, 13:18 ---
--- Quote from: Monsieur OUXX on 20 Mar 2019, 12:37 ---It's done twice: One for the mobile file system, and one for the Desktop file system.

--- End quote ---
Not sure what you mean here. The file system is passed once afaik.

--- End quote ---

game.Factory.Resources.ResourcePacks.Ad d(new ResourcePack(new FileSystemResourcePack(AGSGame.Device.FileSystem, AGSGame.Device.Assemblies.EntryAssembly), 0));
game.Factory.Resources.ResourcePacks.Ad d(new ResourcePack(new EmbeddedResourcesPack(AGSGame.Device.Assemblies.EntryAssembly, CustomAssemblyName), 1));

tzachs:
Ah, well, that's not "one for mobile, one for desktop". That's one for loading from the file system and one for loading resources embedded in the project (which is not necessarily for mobile -> most developers would probably prefer to embed their assets on desktop too, so they won't need to distribute all of their assets in separate files).

Crimson Wizard:

--- Quote from: tzachs on 21 Mar 2019, 18:34 ---most developers would probably prefer to embed their assets on desktop too, so they won't need to distribute all of their assets in separate files.

--- End quote ---

In regards to AGS developers were constantly complaining that they have to distribute it as one big file, because it forces users to redownload gygabytes of data to fix 1 bug.

(On other hand AGS supports reading smaller files from disk, but they ignore this for years, so idk.)

If there were a tool for automated repacking of the embedded main file that could solve the issue partially (not sure if that would work with Steam's auto updates).

Navigation

[0] Message Index

[#] Next page

Go to full version