1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using UnityEngine;
- using XGame.Framework.Asset;
- namespace XGame.Framework.Map
- {
- public interface IEntityViewHandle
- {
- TEntityView CreateEntity<TEntityView>(EntityBehaviour behaviour) where TEntityView : class, IEntityView, new();
- }
- public interface IMapAssetModule : IEntityViewHandle
- {
- /// <summary>
- /// 异步加载接口
- /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
- /// </summary>
- /// <typeparam name="TResult">返回对象类型</typeparam>
- /// <param name="addressableName">可寻址资源名字</param>
- /// <returns>返回异步回调</returns>
- IAssetLoadAsync<TResult> LoadAsync<TResult>(string addressableName) where TResult : UnityEngine.Object;
- IEntityViewLoadAsync<TEntityView> LoadEntity<TEntityView>(string addressableName, Transform parent) where TEntityView : class, IEntityView, new();
- /// <summary>
- /// 回收资源
- /// </summary>
- /// <param name="obj"></param>
- void Recycle(UnityEngine.Object obj);
- /// <summary>
- /// 回收Entity实例
- /// 和LoadEntity配套
- /// </summary>
- /// <param name="entityView"></param>
- /// <param name="isDestroy">是否销毁,默认false</param>
- void Recycle(IEntityView entityView, bool isDestroy = false);
- /// <summary>
- /// 结束所有加载的异步
- /// </summary>
- void StopAllAsyncs();
- }
- }
|