/// <summary> /// 加载一个AbProxy /// </summary> /// <param name="abName"></param> /// <param name="fcallback"></param> /// <returns></returns> private IEnumerator LoadABProxyCor(string abName, System.Action <ABProxy> fcallback = null) { ABProxy abProxy = GetOrCreateABProxy(abName); if (!abProxy.isReady) { abProxy.AddRef(); yield return(LoadABProxySync(abProxy)); abProxy.RemoveRef(); } fcallback(abProxy); yield break; }
/// <summary> /// 加载SubAssets协程版 /// </summary> /// <param name="abName"></param> /// <param name="assetName"></param> /// <param name="type"></param> /// <param name="callback"></param> /// <returns></returns> private IEnumerator LoadSubAssetsCor(string abName, string assetName, Type type, System.Action <UnityEngine.Object[]> callback) { //读取abProxy ABProxy abProxy = GetOrCreateABProxy(abName); if (!abProxy.isReady) { abProxy.AddRef(); yield return(LoadABProxySync(abProxy)); abProxy.RemoveRef(); } //这里以后考虑改为LoadAssetSync UnityEngine.Object[] objArray = abProxy.LoadSubAssets(assetName, type); callback(objArray); yield break; }
/// <summary> /// 指定类型加载所有asset协程 /// </summary> /// <param name="abName"></param> /// <param name="fcallback"></param> /// <returns></returns> private IEnumerator LoadAllAssetCor(string abName, System.Action <UnityEngine.Object[]> fcallback) { //读取abProxy ABProxy abProxy = GetOrCreateABProxy(abName); if (!abProxy.isReady) { abProxy.AddRef(); yield return(LoadABProxySync(abProxy)); abProxy.RemoveRef(); } //这里以后考虑改为LoadAssetSync UnityEngine.Object[] go = abProxy.LoadAllAsset(); fcallback(go); yield break; }
/// <summary> /// 加载一个Prefab /// </summary> /// <param name="abName">ab名字</param> /// <param name="assetName">asset名字</param> /// <param name="fcallback">完成回调</param> private IEnumerator LoadPrefabCor(string abName, string assetName, System.Action <GameObject> fcallback) { //读取abProxy ABProxy abProxy = GetOrCreateABProxy(abName); if (!abProxy.isReady) { abProxy.AddRef(); yield return(LoadABProxySync(abProxy)); abProxy.RemoveRef(); } //这里可以改为LoadPrefabSync GameObject go = abProxy.LoadPrefab(assetName); fcallback(go); yield break; }