|
WKLib 0.0.1
A modding library for White Knuckle
|
Loads and caches AssetBundles and assets, scoped by ModContext to avoid collisions. More...
Public Member Functions | |
| AssetService (WKLibAPI API) | |
| async Task< AssetBundle > | LoadBundleRelativeAsync (string relativePath, IProgress< float > progress=null) |
| Loads an AssetBundle given a path relative to the mod assembly folder. Caches under a key combining ModID and bundle name.
| |
| void | UnloadBundleRelative (string relativePath, bool unloadAllLoadedObjects=false) |
| Unloads a specific bundle for this mod. | |
| void | UnloadAllBundles (bool unloadAllLoadedObjects=false) |
| Unloads all bundles loaded by this mod. | |
| async Task< Dictionary< string, M_Level > > | LoadAllLevelsFromBundle (AssetBundle bundle, IProgress< float > progress=null) |
| Given a loaded AssetBundle, iterate over every ".prefab" asset name, Load it as a GameObject, check for an M_Level component; if found, add to the returned list. Also logs each M_Level found via WKLog.Debug("LevelName"). If you want to register each prefab in a CL_AssetManager database this method will do it automatically. | |
| List< M_Level > | FindLevelsByName (string nameContains) |
| Returns all M_Level instances whose prefab names contain the given substring. (Uses levelPrefabs from the combined asset database in CL_AssetManager) | |
| async Task< M_Gamemode > | LoadGameModeFromBundle (AssetBundle bundle, string assetName, IProgress< float > progress=null) |
| Loads a gamemode from an asset bundle. | |
| Sprite | LoadPngAsSpriteRelative (string relativePngPath) |
Loads a PNG as a Sprite relative to the mod folder.
| |
| Sprite | LoadPngAsSprite (string pngFileName) |
| Convenience: Create a Sprite from a PNG filename. | |
Loads and caches AssetBundles and assets, scoped by ModContext to avoid collisions.
| WKLib.API.Assets.AssetService.AssetService | ( | WKLibAPI | API | ) |
| List< M_Level > WKLib.API.Assets.AssetService.FindLevelsByName | ( | string | nameContains | ) |
Returns all M_Level instances whose prefab names contain the given substring. (Uses levelPrefabs from the combined asset database in CL_AssetManager)
| async Task< Dictionary< string, M_Level > > WKLib.API.Assets.AssetService.LoadAllLevelsFromBundle | ( | AssetBundle | bundle, |
| IProgress< float > | progress = null ) |
Given a loaded AssetBundle, iterate over every ".prefab" asset name, Load it as a GameObject, check for an M_Level component; if found, add to the returned list.
Also logs each M_Level found via WKLog.Debug("LevelName").
If you want to register each prefab in a CL_AssetManager database this method will do it automatically.
| async Task< AssetBundle > WKLib.API.Assets.AssetService.LoadBundleRelativeAsync | ( | string | relativePath, |
| IProgress< float > | progress = null ) |
Loads an AssetBundle given a path relative to the mod assembly folder.
Caches under a key combining ModID and bundle name.
| async Task< M_Gamemode > WKLib.API.Assets.AssetService.LoadGameModeFromBundle | ( | AssetBundle | bundle, |
| string | assetName, | ||
| IProgress< float > | progress = null ) |
Loads a gamemode from an asset bundle.
| Sprite WKLib.API.Assets.AssetService.LoadPngAsSprite | ( | string | pngFileName | ) |
Convenience: Create a Sprite from a PNG filename.
| Sprite WKLib.API.Assets.AssetService.LoadPngAsSpriteRelative | ( | string | relativePngPath | ) |
Loads a PNG as a Sprite relative to the mod folder.
| void WKLib.API.Assets.AssetService.UnloadAllBundles | ( | bool | unloadAllLoadedObjects = false | ) |
Unloads all bundles loaded by this mod.
| void WKLib.API.Assets.AssetService.UnloadBundleRelative | ( | string | relativePath, |
| bool | unloadAllLoadedObjects = false ) |
Unloads a specific bundle for this mod.