IMapAssetModule.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using UnityEngine;
  3. using XGame.Framework.Asset;
  4. namespace XGame.Framework.Map
  5. {
  6. public interface IEntityViewHandle
  7. {
  8. TEntityView CreateEntity<TEntityView>(EntityBehaviour behaviour) where TEntityView : class, IEntityView, new();
  9. }
  10. public interface IMapAssetModule : IEntityViewHandle
  11. {
  12. /// <summary>
  13. /// 异步加载接口
  14. /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
  15. /// </summary>
  16. /// <typeparam name="TResult">返回对象类型</typeparam>
  17. /// <param name="addressableName">可寻址资源名字</param>
  18. /// <returns>返回异步回调</returns>
  19. IAssetLoadAsync<TResult> LoadAsync<TResult>(string addressableName) where TResult : UnityEngine.Object;
  20. IEntityViewLoadAsync<TEntityView> LoadEntity<TEntityView>(string addressableName, Transform parent) where TEntityView : class, IEntityView, new();
  21. /// <summary>
  22. /// 回收资源
  23. /// </summary>
  24. /// <param name="obj"></param>
  25. void Recycle(UnityEngine.Object obj);
  26. /// <summary>
  27. /// 回收Entity实例
  28. /// 和LoadEntity配套
  29. /// </summary>
  30. /// <param name="entityView"></param>
  31. /// <param name="isDestroy">是否销毁,默认false</param>
  32. void Recycle(IEntityView entityView, bool isDestroy = false);
  33. /// <summary>
  34. /// 结束所有加载的异步
  35. /// </summary>
  36. void StopAllAsyncs();
  37. }
  38. }