AssetGroup
A class for managing a group of assets together, such that they can be loaded or unloaded en masse. AssetGroup should be subclassed and the assets should be defined by properties in the subclass by using asset or, delayedAsset, which can be used as delegates. If not using delegates, it is possible to selectively load and unload them, in which case it is not advised to use loadAll and unloadAll, because AssetManager's reference counts may be thrown off.
If fine control over individual assets of this group is not needed, a strategy to avoid the complexity of AssetManager's reference counting is to:
Use asset/delayedAsset exclusively as delegates.
Do not mix and match use of asset and delayedAsset.
Never access any of the asset properties until the group is finished loading.
Do not initially call loadAll if using asset (as opposed to delayedAsset).
Parameters
The AssetManager that will handle loading and unloading of this group.
A string that will be prefixed to any file path parameter passed to asset or delayedAsset.
Functions
Blocks until all members of this group are loaded. This does not prioritize this group's members, so assets from outside this group may be loaded as well.
Queues all assets of this group for loading by the associated AssetManager. If any assets of this group are already loaded, their load counts in the AssetManager will still be incremented.
Unloads all of the assets in this group. If any of the assets are dependencies of assets outside this group, or if they were loaded more than once, their load counts will only be decremented by one and the associated AssetManager will retain them.
Unloads all of the assets in this group, catching any exceptions. If any of the assets are dependencies of assets outside this group, or if they were loaded more than once, their load counts will only be decremented by one and the associated AssetManager will retain them.
Updates the associated AssetManager if the members of this group are not finished loading. This does not prioritize this group's assets, but it might provide early feedback that the members of this specific group are ready.