IAssetManager.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using XGame.Framework.Asyncs;
  2. namespace XGame.Framework.Asset
  3. {
  4. /// <summary>
  5. /// 资源模块接口
  6. /// </summary>
  7. public interface IAssetManager
  8. {
  9. /// <summary>
  10. /// 同步加载接口
  11. /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
  12. /// </summary>
  13. /// <typeparam name="TResult">返回值类型</typeparam>
  14. /// <param name="addressableName">可寻址资源名字</param>
  15. /// <returns>返回泛型对象</returns>
  16. TResult LoadSync<TResult>(string addressableName);
  17. /// <summary>
  18. /// 异步加载接口
  19. /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
  20. /// </summary>
  21. /// <typeparam name="TResult">返回对象类型</typeparam>
  22. /// <param name="addressableName">可寻址资源名字</param>
  23. /// <returns>返回异步回调</returns>
  24. IAssetLoadAsync<TResult> LoadAsync<TResult>(string addressableName);
  25. /// <summary>
  26. /// 回收资源
  27. /// </summary>
  28. /// <param name="obj"></param>
  29. void Recycle(object obj);
  30. /// <summary>
  31. /// 停止指定的异步加载
  32. /// </summary>
  33. /// <typeparam name="TResult"></typeparam>
  34. /// <param name="async"></param>
  35. void StopAsync<TResult>(IAssetLoadAsync<TResult> async);
  36. /// <summary>
  37. /// 卸载当前未使用的资源
  38. /// </summary>
  39. void UnloadUnusedAssets();
  40. /// <summary>
  41. /// 异步加载Scene的AssetBundle到内存
  42. /// </summary>
  43. /// <param name="sceneName"></param>
  44. IAsync LoadSceneBundle(string sceneName);
  45. /// <summary>
  46. /// 卸载scene的AssetBundle
  47. /// </summary>
  48. /// <param name="sceneName"></param>
  49. void UnLoadSceneBundle(string sceneName);
  50. /// <summary>
  51. /// 异步销毁
  52. /// </summary>
  53. /// <returns></returns>
  54. IAsync Dispose();
  55. /// <summary>
  56. /// 转换AddressableName
  57. /// 会根据游戏当前语言、品质等级返回对应的AddressableName
  58. /// </summary>
  59. /// <param name="addressableName"></param>
  60. /// <returns></returns>
  61. string ConvertAddressableName(string addressableName);
  62. }
  63. }