// TODO: 无视AssetName暂时! public static CInstanceAssetLoader Load(string url, CAssetFileLoader.CAssetFileBridgeDelegate callback = null) { var loader = AutoNew <CInstanceAssetLoader>(url); CResourceModule.Instance.StartCoroutine(CoLoad(loader, callback)); return(loader); }
public static CStaticAssetLoader Load(string url, CAssetFileLoader.CAssetFileBridgeDelegate callback = null) { CLoaderDelgate newCallback = null; if (callback != null) { newCallback = (isOk, obj) => callback(isOk, obj as UnityEngine.Object); } return(AutoNew <CStaticAssetLoader>(url, newCallback)); }
// TODO: 无视AssetName暂时! public static CInstanceAssetLoader Load(string url, CAssetFileLoader.CAssetFileBridgeDelegate callback = null) { var loader = AutoNew <CInstanceAssetLoader>(url, (ok, resultObject) => { if (callback != null) { callback(ok, resultObject as UnityEngine.Object); } }, true); return(loader); }
static IEnumerator CoLoad(CInstanceAssetLoader loader, CAssetFileLoader.CAssetFileBridgeDelegate callback) { while (!loader.IsFinished) { yield return(null); } if (loader.IsReadyDisposed) { callback(false, null); } else { var newCopyAsset = loader.CopyAsset(); if (Application.isEditor) { CResourceLoadObjectDebugger.Create("AssetCopy", loader.Url, newCopyAsset); } callback(newCopyAsset != null, newCopyAsset); } }