Run "CombineAssets [path to wwwroot]" to create a file named images.json in that folder. This file will contain all the images for that folder and subfolders.
The Part class will now be able to make just one round trip to the server to load all images.
The ImageManager class is the one that actually does the loading. For simplicity, I've created it as a static class but it really should be an instantiable class that is passed to Part. This way, each game can have its own images.json file and only the file for the game would be loaded when needed.
There aren't as many audio files so I didn't include those but it's easy to modify the code to support audio if needed.
NOTE:
There are a lot of source files that are being transferred. Using a bundler should significantly speed up that process as well. I suspect the load time of the app would be reduced by at least 80% with both improvements.
Improves image loading performance.
Run "CombineAssets [path to wwwroot]" to create a file named images.json in that folder. This file will contain all the images for that folder and subfolders.
The Part class will now be able to make just one round trip to the server to load all images.
The ImageManager class is the one that actually does the loading. For simplicity, I've created it as a static class but it really should be an instantiable class that is passed to Part. This way, each game can have its own images.json file and only the file for the game would be loaded when needed.
There aren't as many audio files so I didn't include those but it's easy to modify the code to support audio if needed.
NOTE:
There are a lot of source files that are being transferred. Using a bundler should significantly speed up that process as well. I suspect the load time of the app would be reduced by at least 80% with both improvements.