//using System; //using Cysharp.Threading.Tasks; //using UnityEngine; //using System.Threading; ///* // * 此代码由 AI 与悟空框架团队合作完成 // * 资源加载助手,提供统一的资源加载接口 // * 作为悟空框架的扩展解决方案,用于桥接具体的资源加载实现 // */ //public static class ResHelper //{ // public static Func Initialize { get; set; } // public static Func LoadAssetImpl { get; set; } // public static Func> LoadAssetAsyncImpl { get; set; } // public static Func, Action, int> LoadAssetAsyncImplH { get; set; } // public static Action UnloadAssetImpl { get; set; } // public static Action UnloadAssetImplH { get; set; } // //public static T LoadAsset(string path) where T : UnityEngine.Object // //{ // // if (LoadAssetImpl == null) // // { // // Debug.LogError("LoadAssetImpl is not initialized"); // // return null; // // } // // return LoadAssetImpl(path, typeof(T)) as T; // //} // public static async UniTask LoadAssetAsync(string path, CancellationToken cancellationToken = default) where T : UnityEngine.Object // { // if (LoadAssetAsyncImpl == null) // { // Debug.LogError("LoadAssetAsyncImpl is not initialized"); // return null; // } // var obj = await LoadAssetAsyncImpl(path, typeof(T)).AttachExternalCancellation(cancellationToken); // return obj as T; // } // public static int LoadAssetAsync(string path, Action callback, Action errorCallback = null) where T : UnityEngine.Object // { // if (LoadAssetAsyncImplH == null) // { // errorCallback?.Invoke("LoadAssetAsyncImplH is not initialized"); // return -1; // } // return LoadAssetAsyncImplH(path, typeof(T), callback as Action, errorCallback); // } // public static void UnloadAsset(UnityEngine.Object obj) // { // if (UnloadAssetImpl == null) // { // Debug.LogError("UnloadAssetImpl is not initialized"); // return; // } // UnloadAssetImpl(obj); // } // public static void UnloadAssetHandle(int handle) // { // if (UnloadAssetImplH == null) // { // Debug.LogError("UnloadAssetImplH is not initialized"); // return; // } // UnloadAssetImplH(handle); // } //}