using UnityEngine; namespace XGame.Framework.Asset { /// /// IAssetModule扩展 /// public static class AssetModuleExt { #region 内部扩展方法 //private static bool IsRegister(this IAssetModule module, object asset, object parent) //{ // if (module == null || asset == null || parent == null) // return false; // return (module as AssetModule)?.IsRegister(asset.GetLongHashCode(), parent.GetLongHashCode()) ?? false; //} //private static bool Register(this IAssetModule module, object asset, object parent) //{ // if (module == null || asset == null || parent == null) // return false; // return (module as AssetModule)?.Register(asset.GetLongHashCode(), parent.GetLongHashCode()) ?? false; //} //private static bool UnRegister(this IAssetModule module, object asset, object parent) //{ // if (module == null || asset == null || parent == null) // return false; // return (module as AssetModule)?.UnRegister(asset.GetLongHashCode(), parent.GetLongHashCode()) ?? false; //} #endregion #region GameObject ///// ///// 不推荐业务使用同步加载,先屏蔽 ///// 同步加载 GameObject ///// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收 ///// ///// ///// ///// //public static GameObject LoadSync(this IAssetModule module, string addressableName) //{ // return module.LoadSync(addressableName); //} /// /// 异步加载 GameObject /// 使用该接口加载的资源严禁使用Object.Destroy销毁,只能使用Recycle(obj)方法回收 /// /// /// /// public static IAssetLoadAsync LoadAsync(this IAssetModule module, string addressableName) { return module.LoadAsync(addressableName); } /// /// 回收GameObject对象接口 /// /// /// /// public static void Recycle(this IAssetModule module, GameObject go, bool destroy) { if (module == null || go == null) return; if (destroy) { (module as AssetModule)?.Recycle(go, true); } else { module.Recycle(go); } } #endregion } }