1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
-
- using XGame.Framework.Asyncs;
- namespace XGame.Framework.Asset
- {
- /// <summary>
- /// 资源模块接口
- /// </summary>
- public interface IAssetModule
- {
- /// <summary>
- /// 转换AddressableName
- /// 会根据游戏当前语言、品质等级返回对应的AddressableName
- /// </summary>
- /// <param name="addressableName"></param>
- /// <returns></returns>
- string ConvertAddressableName(string addressableName);
- ///// <summary>
- ///// 同步加载接口
- ///// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
- ///// </summary>
- ///// <typeparam name="TResult">返回值类型</typeparam>
- ///// <param name="addressableName">可寻址资源名字</param>
- ///// <returns>返回泛型对象</returns>
- //TResult LoadSync<TResult>(string addressableName);
- ///// <param name="assetTag">资源标签,默认为空,相同标签的的异步加载可使用标签统一删除或结束回调</param>
- /// <summary>
- /// 异步加载接口
- /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收
- /// </summary>
- /// <typeparam name="TResult">返回对象类型</typeparam>
- /// <param name="addressableName">可寻址资源名字</param>
- /// <returns>返回异步回调</returns>
- IAssetLoadAsync<TResult> LoadAsync<TResult>(string addressableName);
- /// <summary>
- /// 回收资源
- /// </summary>
- /// <param name="obj"></param>
- void Recycle(object obj);
- ///// <summary>
- ///// 停止指定的异步加载
- ///// </summary>
- ///// <typeparam name="TResult"></typeparam>
- ///// <param name="async"></param>
- //void StopAsync<TResult>(IAssetLoadAsync<TResult> async);
- /// <summary>
- /// 结束所有加载的异步
- /// </summary>
- void StopAllAsyncs();
- /// <summary>
- /// 卸载所有没有使用的资源
- /// </summary>
- void UnloadUnusedAssets();
- ///// <summary>
- ///// 预留 Instantiate UnityEngine.Object
- ///// </summary>
- ///// <typeparam name="TObject"></typeparam>
- ///// <param name="original"></param>
- ///// <returns></returns>
- //TObject Instantiate<TObject>(TObject original) where TObject : UnityEngine.Object;
- /// <summary>
- /// 异步加载Scene的AssetBundle到内存
- /// </summary>
- /// <param name="sceneName"></param>
- IAsync LoadSceneBundleAsync(string sceneName);
- /// <summary>
- /// 卸载scene的AssetBundle
- /// </summary>
- /// <param name="sceneName"></param>
- void UnLoadSceneBundle(string sceneName);
- #region 预加载
- /// <summary>
- /// 预加载接口
- /// 只加载不实例化
- /// </summary>
- /// <typeparam name="TResult"></typeparam>
- /// <param name="addressableName"></param>
- /// <returns></returns>
- IAssetPreloadAsync PreloadAsync<TResult>(string addressableName);
- /// <summary>
- /// 释放预加载的资源
- /// 如果预加载的资源已经实例化,则无效
- /// </summary>
- /// <param name="addressableName"></param>
- void UnloadPreloadAsset(string addressableName);
- #endregion
- }
- }
|