123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using UnityEngine;
- using XGame.Framework.Asset;
- namespace XGame.Framework.UI
- {
- /// <summary>
- /// UI的加载模块
- /// 每个UIView都有一个独立的IUIAssetModule
- /// </summary>
- public interface IUIAssetModule
- {
- /// <summary>
- /// 异步加载接口
- /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
- /// </summary>
- /// <typeparam name="TResult">返回对象类型</typeparam>
- /// <param name="addressableName">可寻址资源名字</param>
- /// <returns>返回异步回调</returns>
- IAssetLoadAsync<TResult> LoadAsync<TResult>(string addressableName) where TResult : Object;
- /// <summary>
- /// 回收资源
- /// </summary>
- /// <param name="obj"></param>
- /// <param name="isDestroy">是否销毁,只有GameObject可以销毁</param>
- void Recycle(Object obj, bool isDestroy = false);
- /// <summary>
- /// 加载嵌套UI
- /// 加载后需要自己设置父节点和激活
- /// </summary>
- /// <param name="nestedKey">共用UIKey</param>
- /// <returns></returns>
- IAssetLoadAsync<INestedView> LoadNested(UIKey nestedKey);
- /// <summary>
- /// 释放INestedView
- /// INestedView不复用,只回收GameObject
- /// </summary>
- /// <param name="nestedView"></param>
- /// <param name="isDestroy">是否销毁GameObject, FGUI时忽略该参数</param>
- void Recycle(INestedView nestedView, bool isDestroy = false);
- /// <summary>
- /// 结束所有加载的异步
- /// </summary>
- void StopAllAsyncs();
- ///// <summary>
- ///// 释放该UI的所有资源
- ///// </summary>
- //void UnloadUnusedAssets();
- }
- public interface IUIAssetModuleCreator
- {
- /// <summary>
- /// 框架业务不要用
- /// </summary>
- /// <param name="context"></param>
- /// <returns></returns>
- IUIAssetModule Create(UIContext context);
- }
- }
|