IAssetLoader.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. namespace XGame.Framework.Asset
  2. {
  3. /// <summary>
  4. /// 资源加载接口
  5. /// </summary>
  6. interface IAssetLoader/* : System.IDisposable*/
  7. {
  8. /// <summary>
  9. /// 同步加载
  10. /// </summary>
  11. /// <typeparam name="TResult">返回结果的泛型,只用于加载前的一些判断</typeparam>
  12. /// <param name="addressableName">可寻址的资源名</param>
  13. /// <returns>返回加载的object,因为TResult可能只是object的某个组件,有时无法真实表达具体的object</returns>
  14. object LoadSync<TResult>(string addressableName);
  15. /// <summary>
  16. /// 异步加载
  17. /// </summary>
  18. /// <typeparam name="TResult">返回结果的泛型,只用于加载前的一些判断</typeparam>
  19. /// <param name="addressableName"></param>
  20. /// <returns>返回加载的IAssetAsync,Async的GetResult返回object,因为TResult可能只是object的某个组件,有时无法真实表达具体的object</returns>
  21. IAssetAsync LoadAsync<TResult>(string addressableName);
  22. /// <summary>
  23. /// 卸载资源
  24. /// </summary>
  25. /// <param name="addressableName"></param>
  26. /// <param name="source"></param>
  27. void Unload(string addressableName, object source);
  28. /// <summary>
  29. /// 卸载所有没有使用的资源
  30. /// </summary>
  31. void UnloadUnusedAssets();
  32. /// <summary>
  33. /// 异步加载Scene的AssetBundle到内存
  34. /// </summary>
  35. /// <param name="sceneName"></param>
  36. IAssetAsync LoadSceneBundleAsync(string sceneName);
  37. /// <summary>
  38. /// 卸载Scene的AssetBundle
  39. /// </summary>
  40. /// <param name="sceneName"></param>
  41. void UnLoadSceneBundle(string sceneName);
  42. }
  43. }