Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use extension to find the suitable sprite loader to load a sprite #17152

Open
cookgreen opened this issue Sep 27, 2019 · 2 comments

Comments

@cookgreen
Copy link

commented Sep 27, 2019

For now, openra traverse all the sprite loaders defined in mod.yaml to load a sprite, it is not a good idea, I think we should use extension to find a suitable sprite loader to load a sprite.
We can add extension property to ISpriteLoader, and when load a sprite, check the extension and we will load it
And the loader order defined in the mod.yaml also effect the load result, such as:
if I change SpriteFormats: ShpTS, TmpTS, ShpTD, PngSheet to SpriteFormats: ShpD2, ShpTD, TmpRA, TmpTD, ShpTS, PngSheet
the the engine notice an error: xxx.des is not a valid sprite

@GraionDilach

This comment has been minimized.

Copy link
Contributor

commented Sep 27, 2019

Are you fully aware that your own YR project uses multiple extensions for SHPs? (default shp, terrains tem, des, urb, ubn, sno, lun and finally sha for mouse?
Are you fully aware that such a case would cause conflict between different SHP parsers?

@cookgreen

This comment has been minimized.

Copy link
Author

commented Sep 27, 2019

Are you fully aware that your own YR project uses multiple extensions for SHPs? (default shp, terrains tem, des, urb, ubn, sno, lun and finally sha for mouse?
Are you fully aware that such a case would cause conflict between different SHP parsers?

We can define extension as a string array and check the target extension whether in the sprite loader's Extension property

such like:

public interface ISpriteLoader
{
       string[] Extension{get;}
       ...
}
@abcdefg30 abcdefg30 added the Refactor label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.