IEnumerator RealLoadAssetGroup(string[] name, Action <UnityEngine.Object[]> comp) { var taskArray = new AssetTask[name.Length]; var objects = new UnityEngine.Object[name.Length]; for (var i = 0; i < name.Length; i++) { var task = new AssetTask(name[i], name[i], (UnityEngine.Object o) => { objects[i] = o; }, null, null); taskArray[i] = task; RealLoadAsset(task); } var j = 0; while (j < taskArray.Length) { if (taskArray[j].isFinish) { j++; } else { yield return(null); } } if (null != comp) { comp(objects); } }
IEnumerator RealLoadAssetBundle(AssetTask assetTask) { assetTask.abName = ALG.DecodeBundleName(assetTask.abName); var dependencies = _assetDependency.GetDependencies(ALG.EncodeBundleName(assetTask.abName)); var taskArray = new AssetTask[dependencies.Length]; for (var i = 0; i < dependencies.Length; i++) { var task = new AssetTask(dependencies[i], null, null, null, null); taskArray[i] = task; new Task(RealLoadAssetBundle(task), "AssetBundleManager_" + task.abName); } var j = 0; while (j < taskArray.Length) { if (taskArray[j].isFinish) { j++; } else { yield return(null); } } _assetBundleLoader.LoadAssetBundle(assetTask.abName, (AssetBundle ab) => { _assetBundleLoader.GetAssetBundle(assetTask.abName).AddReference(); assetTask.isFinish = true; }, null); while (!assetTask.isFinish) { yield return(null); } }
void DownLoadFinish(AssetTask task) { if (!CradSystemFx.GetInstance().mIsChoose) { CradSystemFx.GetInstance().InitCardCell(_ItemOfReward, mId, mIndex); CradSystemFx.GetInstance().mIsChoose = true; CradSystemFx.GetInstance().mCardSystemPanel.mAllOk.gameObject.SetActive(false); CradSystemFx.GetInstance().mCardSystemPanel.m_AgainBtnRoot.gameObject.SetActive(false); } }
IEnumerator ErrorOcurredRepeat(AssetTask task) { bool errorOcurred = false; string assetBundleName = task.AssetBundleName; ConsoleEx.DebugLog(" in error occrredddd "); string url = ResourceSetting.ConverToFtpPath(assetBundleName); int verNum = Core.Data.sourceManager.getNewNum(assetBundleName + ".unity3d"); WWW www = null; try { www = WWW.LoadFromCacheOrDownload(url, verNum); } catch (Exception ex) { errorOcurred = true; // ConsoleEx.DebugLog("LoadFromCacheOrDownload Error : " + ex.ToString()); if (task.LoadError != null) { task.LoadError("[" + assetBundleName + "]:" + ex.ToString()); } } if (!errorOcurred) { if (!dicLoadingReq.ContainsKey(assetBundleName)) { dicLoadingReq.Add(assetBundleName, www); } while (www.isDone == false) { if ((task.LoadType == AssetTask.loadType.Only_Download || task.LoadType == AssetTask.loadType.Both_Download_loadlocal) && task.reportProgress != null) { task.reportProgress(www.progress); } yield return(null); } // Print the error to the console if (!String.IsNullOrEmpty(www.error)) { //ConsoleEx.DebugLog("["+assetBundleName+"]"+www.error); //Debug.LogError ("[" + assetBundleName + "]" + www.error); if (task.LoadError != null) { task.LoadError(www.error); } ConsoleEx.DebugLog(" still error "); dicLoadingReq.Remove(assetBundleName); errorOcurred = true; } } }
void DownLoadSingleFinish(AssetTask task) { Monster curmon = this._rewards[0].toMonster(Core.Data.monManager); if (curmon != null) { if (EggCardSingle.GetInstance()._CRLuo_ShowANDelCharactor != null) { EggCardSingle.GetInstance()._CRLuo_ShowANDelCharactor.CharactorID = curmon.config.ID; EggCardSingle.GetInstance()._CRLuo_ShowANDelCharactor.CreateModel(); EggCardSingle.GetInstance()._CRLuo_ShowANDelCharactor.DeleteModel(); } } }
public CRLuo_PlayAnim_FX Show_LAction(int id_L) { Screen_Brightness_ONOFF(true); if (Man_GameObj_L != null) { Destroy(Man_GameObj_L); } string prefabName = "pb" + id_L; Man_L = null; #if SPLIT_MODEL Object temp_L = ModelLoader.get3DModel(id_L); // Debug.LogError (" temp L ==" + temp_L ); if (temp_L != null) { AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(id_L, temp_L); FeatureLeft(task); } else { // Debug.LogError (" temp L is null == " + Core.Data.sourceManager.IsModelExist(id_L) ); if (Core.Data.sourceManager.IsModelExist(id_L)) { AssetTask aTask = new AssetTask(prefabName, typeof(Object), FeatureLeft); aTask.AppendCommonParam(id_L, null, AssetTask.loadType.Only_loadlocal); //再通过WWW加载 aTask.DispatchToRealHandler(); } else { Object tempDefault = PrefabLoader.loadFromUnPack("CRLuo/pbXXX", false, true); AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(id_L, tempDefault); FeatureLeft(task); } } #else Object temp_L = ModelLoader.get3DModel(id_L); AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(id_L, temp_L); FeatureLeft(task); #endif return(Man_L); }
public void DownloadModel(int index) { //Debug.Log("index : " + index); if (m_SouceDatas.Count > index) { m_CurBundleName = m_SouceDatas [index].FileName; m_IsFrist = true; m_FristTime = Time.time; if (sourceMgr.getSouceExist(m_SouceDatas [index].FileName)) { Debug.Log("FileName : " + m_SouceDatas [index].FileName + " Errr!!!!!!!"); } else { AssetTask aTask = new AssetTask(m_SouceDatas [index].FileName.Replace(".unity3d", ""), typeof(Object), FeatureRight); aTask.AppendCommonParam(m_SouceDatas [index].Num, null, AssetTask.loadType.Only_Download); aTask.reportProgress = functionprogress; aTask.LoadError = loadError; //再通过WWW加载 aTask.DispatchToRealHandler(); } m_SLiderTotal.value = curTotalRatio + (1 - curTotalRatio) * curCount * 1.0f / totalCount; } else { m_BtnState = BtnState.BS_Receive; m_Slider.value = 1; m_SLiderTotal.value = 1; string color1 = "000000"; string color2 = "ffff02"; SetDownloadSizeLabel(SetLabelColor(color2, m_DownEndStr)); SetDownloadLabel(m_DownloadStr); SetDownloadTimeLabel(SetLabelColor(color1, m_DownTimeStr + "0" + m_SecondStr)); if (Core.Data.playerManager.RTData.downloadReawrd != 1) { m_ReceiveBtn.SetActive(true); } else { m_ReceiveBtn.SetActive(false); } } }
void DownLoadFinish(AssetTask task) { if(!CradSystemFx.GetInstance().mIsChoose) { if(!mLockClick) { if(OneTime) { return; } MiniItween nn = MiniItween.MoveTo(gameObject, CradSystemFx.GetInstance().mCardSystemPanel.mGoalPos[mIndex].transform.localPosition, 0.6f); nn.myDelegateFuncWithObject += CompleteFly; mLockClick = true; CradSystemFx.GetInstance().mIsChoose = true; } } }
public void DownloadModel(int id) { string prefabName = "pb" + id; if (Core.Data.sourceManager.IsModelExist(id)) { Debug.Log("prefabName : " + prefabName + " Error!!!!!!!"); } else { AssetTask aTask = new AssetTask(prefabName, typeof(UObj), LoadFinished); aTask.AppendCommonParam(id, null, AssetTask.loadType.Both_Download_loadlocal); aTask.reportProgress = functionprogress; aTask.LoadError = loadError; //再通过WWW加载 aTask.DispatchToRealHandler(); } }
private void LoadFinished(AssetTask aTask) { SouceData data = new SouceData(); data.FileName = aTask.AssetBundleName; data.Num = Core.Data.sourceManager.getNewNum(aTask.AssetBundleName); data.Size = Core.Data.sourceManager.getSouceSize(aTask.AssetBundleName); data.isError = 1; Core.Data.sourceManager.AddDownloadRecordAndSaveToLocaldisk(data); // Caching.CleanCache(); if (m_EventLoadFinished != null) { m_EventLoadFinished(aTask); } m_DownloadModelID = -1; m_DownloadModelName = string.Empty; CloesWin(); }
private void FeatureLeft(AssetTask task) { Object temp_L = task.Obj; if (goModel != null) { Destroy(goModel); goModel = null; } if (temp_L != null) { goModel = (GameObject)GameObject.Instantiate(temp_L, gameObject.transform.position, Quaternion.Euler(new Vector3(0, 0, 0))); } else { goModel = (GameObject)GameObject.Instantiate(Default_Charactor, gameObject.transform.position, Quaternion.Euler(new Vector3(0, 0, 0))); } }
private void LoadEnd() { if (cachedWork.Count > 0) { AssetTask task = cachedWork.Dequeue(); if (task != null) { if (dicLoadingReq.Count < MAX_WWW_COUNT) { // 如果没下载,则开始下载 CoroutineProvider.Instance().StartCoroutine(AsyncLoadCoroutine(task)); } else { cachedWork.Enqueue(task); } } } }
public void ForceJumpEnd(AssetTask task) { m_Index++; curCount++; if (m_EventDownloadModel != null) { m_EventDownloadModel(m_Index); } else { m_SLiderTotal.value = curTotalRatio + (1 - curTotalRatio) * curCount * 1.0f / totalCount; } SouceData data = new SouceData(); data.FileName = task.AssetBundleName; data.Num = 1; data.Size = sourceMgr.getSouceSize(task.AssetBundleName); data.isError = 0; sourceMgr.AddDownloadRecordAndSaveToLocaldisk(data); }
/// <summary> /// 异步加载位于本机的AssetBundle /// </summary> /// <returns>The load loacl.</returns> /// <param name="task">Task.</param> private IEnumerator AsyncLoadLoacl(AssetTask task) { string assetBundleName = task.AssetBundleName; // 添加引用 RefAsset(assetBundleName); string fullPath = Path.Combine(DeviceInfo.PersistRootPath, GetPlatformName()); fullPath = Path.Combine(fullPath, assetBundleName); WWW www = new WWW("file:///" + fullPath); www.threadPriority = ThreadPriority.High; yield return(www); if (www.error != null) { ConsoleEx.DebugLog("WWW download:" + www.error); } else { AssetBundleRequest req = www.assetBundle.LoadAsync(task.PrefabName, task.UType); yield return(req); dicAsset.Add(assetBundleName, req.asset); task.Obj = req.asset; dicLoadingReq.Remove(assetBundleName); www.assetBundle.Unload(false); www.Dispose(); www = null; //本地加载完成 LoadEnd(); if (task.LoadFinished != null) { task.LoadFinished(task); } } }
public void ShowCharactor(int ID, MonsterAttribute attri = MonsterAttribute.DEFAULT_NO, bool allFated = false) { //NewOBJ = true; this.attri = attri; this.mAllFated = allFated; string prefabName = "pb" + ID; #if SPLIT_MODEL Object temp = ModelLoader.get3DModel(ID); if (temp != null) { AssetTask aTask = new AssetTask("pb" + ID, typeof(Object), FeatureShow); aTask.AppendCommonParam(ID, temp); FeatureShow(aTask); } else { if (Core.Data.sourceManager.IsModelExist(ID)) { AssetTask aTask = new AssetTask(prefabName, typeof(Object), FeatureShow); aTask.AppendCommonParam(ID, null, AssetTask.loadType.Only_loadlocal); //再通过WWW加载 aTask.DispatchToRealHandler(); } else { Object tempDefault = PrefabLoader.loadFromUnPack("CRLuo/pbXXX", false, false); AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(ID, tempDefault); FeatureShow(task); } } #else Object temp = ModelLoader.get3DModel(ID); AssetTask aTask = new AssetTask(prefabName, typeof(Object), FeatureShow); aTask.AppendCommonParam(ID, temp); FeatureShow(aTask); #endif }
private void FeatureRight(AssetTask task) { float size = float.Parse(sourceMgr.getSouceSize(task.AssetBundleName)) / 1024 / 1024; m_CurSouceSizes += size; UserConfigManager usr = Core.Data.usrManager; usr.UserConfig.downCurSize = m_CurSouceSizes; usr.save(); string color = "ffff02"; string str1 = SetLabelColor(color, (m_CurSouceSizes).ToString("F")); SetDownloadSizeLabel(str1 + "/" + m_SouceSizes.ToString("F") + "MB"); m_DownloadTime = (int)((m_SouceSizes - m_CurSouceSizes) * m_CurDownTime); SetDownloadTimeLabel(GetDownloadTime(m_DownloadTime)); m_Index++; curCount++; if (m_EventDownloadModel != null) { m_EventDownloadModel(m_Index); } else { m_SLiderTotal.value = curTotalRatio + (1 - curTotalRatio) * curCount * 1.0f / totalCount; } SouceData data = new SouceData(); data.FileName = task.AssetBundleName; data.Num = sourceMgr.getNewNum(task.AssetBundleName); data.Size = sourceMgr.getSouceSize(task.AssetBundleName); data.isError = 1; sourceMgr.AddDownloadRecordAndSaveToLocaldisk(data); }
public void CreateModel() { int id_L = CharactorID; string prefabName = "pb" + id_L; #if SPLIT_MODEL Object temp_L = ModelLoader.get3DModel(id_L); if (temp_L != null) { AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(id_L, temp_L); FeatureLeft(task); } else { if (Core.Data.sourceManager.IsModelExist(id_L)) { AssetTask aTask = new AssetTask(prefabName, typeof(Object), FeatureLeft); aTask.AppendCommonParam(id_L, null, AssetTask.loadType.Only_loadlocal); //再通过WWW加载 aTask.DispatchToRealHandler(); } else { Object tempDefault = PrefabLoader.loadFromUnPack("CRLuo/pbXXX", false, true); AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(id_L, tempDefault); FeatureLeft(task); } } #else Object temp_L = ModelLoader.get3DModel(id_L); AssetTask task = new AssetTask(prefabName, typeof(Object), null); task.AppendCommonParam(id_L, temp_L); FeatureLeft(task); #endif }
public IEnumerator AsyncLoadAll(AssetTask task) { string assetBundleName = task.AssetBundleName; string fullPath = Path.Combine(DeviceInfo.PersistRootPath, GetPlatformName()); fullPath = Path.Combine(fullPath, assetBundleName); WWW www = new WWW("file:///" + fullPath); www.threadPriority = ThreadPriority.High; yield return(www); if (www.error != null) { ConsoleEx.DebugLog("WWW download:" + www.error); } else { StringBuilder sb = new StringBuilder(); UObj[] objs = www.assetBundle.LoadAll(); foreach (UObj obj in objs) { sb.Append("name = " + obj.name + "\t type = " + obj.GetType().ToString()).Append("\n"); } ConsoleEx.DebugLog(sb.ToString()); www.assetBundle.Unload(true); www.Dispose(); www = null; //本地加载完成 LoadEnd(); if (task.LoadFinished != null) { task.LoadFinished(task); } } }
private void FeatureShow(AssetTask task) { NewOBJ = true; Object temp = task.Obj; if (Temp_OBJ != null) { Destroy(Temp_OBJ); Temp_OBJ = null; } if (temp != null) { Temp_OBJ = Instantiate(temp, StageOBJ.transform.position, Quaternion.Euler(new Vector3(0, 180, 0))) as GameObject; } else { temp = PrefabLoader.loadFromUnPack("CRLuo/pbXXX", false, false); Temp_OBJ = Instantiate(temp, StageOBJ.transform.position, Quaternion.Euler(new Vector3(0, 180, 0))) as GameObject; } StageOBJ.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); Temp_OBJ.transform.parent = StageOBJ.transform; CRLuo = Temp_OBJ.GetComponent <CRLuo_PlayAnim_FX>(); CRLuo.CameraKey_Attack = false; CRLuo.CameraKey_GroupSkill = false; CRLuo.CameraKey_OverSkill = false; CRLuo.CameraKey_Skill = false; if (attri == MonsterAttribute.ALL) { CRLuo.AddGoldenGlow(); } CRLuo.BodyFX_ON_OFF(this.mAllFated); }
private void FeatureRight(AssetTask task) { Object temp_R = task.Obj; if (temp_R != null) { Man_GameObj_R = (GameObject)GameObject.Instantiate(temp_R, new Vector3(0, 0, Long_Show), Quaternion.Euler(new Vector3(0, 180, 0))); } else { Man_GameObj_R = (GameObject)GameObject.Instantiate(Default_Charactor, new Vector3(0, 0, Long_Show), Quaternion.Euler(new Vector3(0, 180, 0))); } Man_R = Man_GameObj_R.GetComponent <CRLuo_PlayAnim_FX>(); Man_R.MyCamera_L.cullingMask = (1 << LayerMask.NameToLayer("Default")) | (1 << LayerMask.NameToLayer("3D")); Man_R.MyCamera_L.depth = -1; Man_R.MyCamera_R.cullingMask = (1 << LayerMask.NameToLayer("Default")) | (1 << LayerMask.NameToLayer("3D")); Man_R.MyCamera_R.depth = -1; Man_R.OBJScreen_ID = task.arg1; Man_R.Pos_L = false; Man_R.Injure_Key = false; Man_R.HandleTypeAnim(CRLuoAnim_Main.Type.Show); MiniItween.MoveTo(Man_GameObj_R, new Vector3(0, 0, Long_Show), Fly_Time); if (Man_L != null) { GoShowPos(true); Man_L.Injure_Key = false; } }
// name表示 不包含路径的预设体名, public void LoadAsync(AssetTask task) { if (task == null) { return; } // 如果已经下载,则返回 if (dicAsset.ContainsKey(task.AssetBundleName)) { return; } // 如果正在下载,则返回 if (dicLoadingReq.ContainsKey(task.AssetBundleName)) { return; } if (dicLoadingReq.Count < MAX_WWW_COUNT) { if (Core.DevFSM.rtPlatform == RuntimePlatform.OSXEditor || Core.DevFSM.rtPlatform == RuntimePlatform.OSXPlayer) { //CoroutineProvider.Instance().StartCoroutine(AsyncLoadLoacl(task)); CoroutineProvider.Instance().StartCoroutine(AsyncLoadCoroutine(task)); } else { // 如果没下载,则开始下载 CoroutineProvider.Instance().StartCoroutine(AsyncLoadCoroutine(task)); } } else { cachedWork.Enqueue(task); } }
/// <summary> /// According to LoadType, it will download or load local sync /// 把AssetBundle载入内存,之后再异步Load出来,之后再次删除Assetbundle内存镜像. /// </summary> /// <returns>The load coroutine.</returns> /// <param name="task">Task.</param> private IEnumerator AsyncLoadCoroutine(AssetTask task) { bool errorOcurred = false; string assetBundleName = task.AssetBundleName; string url = ResourceSetting.ConverToFtpPath(assetBundleName); int verNum = 1;//Core.Data.sourceManager.getNewNum(assetBundleName + ".unity3d"); // 添加引用 RefAsset(assetBundleName); if (Caching.IsVersionCached(url, verNum) == false) { //ConsoleEx.DebugLog("Version Is not Cached, which will download from net!"); } WWW www = null; try { www = WWW.LoadFromCacheOrDownload(url, verNum); } catch (Exception ex) { errorOcurred = true; // ConsoleEx.DebugLog("LoadFromCacheOrDownload Error : " + ex.ToString()); if (task.LoadError != null) { task.LoadError("[" + assetBundleName + "]:" + ex.ToString()); } } if (!errorOcurred) { dicLoadingReq.Add(assetBundleName, www); while (www.isDone == false) { if ((task.LoadType == AssetTask.loadType.Only_Download || task.LoadType == AssetTask.loadType.Both_Download_loadlocal) && task.reportProgress != null) { task.reportProgress(www.progress); } yield return(null); } // Print the error to the console if (!String.IsNullOrEmpty(www.error)) { //ConsoleEx.DebugLog("["+assetBundleName+"]"+www.error); Debug.LogError("[" + assetBundleName + "]" + www.error); if (task.LoadError != null) { task.LoadError(www.error); } dicLoadingReq.Remove(assetBundleName); errorOcurred = true; } bool TaskEnd = false; if (task.LoadType == AssetTask.loadType.Only_loadlocal || task.LoadType == AssetTask.loadType.Both_Download_loadlocal) { if (!errorOcurred) { AssetBundleRequest req = www.assetBundle.LoadAsync(task.PrefabName, task.UType); while (req.isDone == false) { yield return(null); } dicAsset.Add(assetBundleName, req.asset); task.Obj = req.asset; dicLoadingReq.Remove(assetBundleName); www.assetBundle.Unload(false); //--- load local finished --- TaskEnd = true; } } else { dicLoadingReq.Remove(assetBundleName); //--- Downloading finished --- TaskEnd = true; } //release memeory if (www != null) { www.Dispose(); www = null; } //start to callback if (TaskEnd) { LoadEnd(); if (task.LoadFinished != null) { task.LoadFinished(task); } } } }
void DownLoadFinish(AssetTask task) { }
public void LoadAsset(string name, Action <UnityEngine.Object> success, Action error, Type type = null) { AssetTask assetTask = new AssetTask(name, name, success, error, type); new Task(RealLoadAsset(assetTask), "AssetBundleManager_" + name); }
private void FeatureShow(AssetTask task) { Object temp = task.Obj; if (Temp_OBJ != null) { Destroy(Temp_OBJ); Temp_OBJ = null; } if (temp != null) { Temp_OBJ = Instantiate(temp, transform.position, Quaternion.Euler(new Vector3(0, 180, 0))) as GameObject; } else { temp = PrefabLoader.loadFromUnPack("CRLuo/pbXXX", false, false); Temp_OBJ = Instantiate(temp, transform.position, Quaternion.Euler(new Vector3(0, 180, 0))) as GameObject; } Temp_OBJ.transform.parent = transform; SkinnedMeshRenderer mesh = Temp_OBJ.GetComponentInChildren <SkinnedMeshRenderer>(); if (mesh != null) { if (mesh.bounds.extents.y > MAX_SIZE) { // RED.LogWarning ("大模型 " + mesh.bounds.extents.y); Temp_OBJ.transform.localScale = mesh.bounds.extents.y / MAX_SIZE * Vector3.one; } else if (mesh.bounds.extents.y < MIN_SIZE) { // RED.LogWarning ("小模型 " + mesh.bounds.extents.y); Temp_OBJ.transform.localScale = MIN_SIZE / mesh.bounds.extents.y * Vector3.one; } else { // RED.LogWarning ("正常模型 " + mesh.bounds.extents.y); Temp_OBJ.transform.localScale = Vector3.one; } } else { RED.LogWarning("mesh is null "); } ShadowAnim shadow = Temp_OBJ.GetComponentInChildren <ShadowAnim>(); if (shadow != null) { shadow.enabled = false; shadow.transform.localPosition = Vector3.zero; } CRLuo = Temp_OBJ.GetComponent <CRLuo_PlayAnim_FX>(); CRLuo.CameraKey_Attack = false; CRLuo.CameraKey_GroupSkill = false; CRLuo.CameraKey_OverSkill = false; CRLuo.CameraKey_Skill = false; if (attri == MonsterAttribute.ALL) { CRLuo.AddGoldenGlow(); } CRLuo.BodyFX_ON_OFF(this.mAllFated); }
void DownLoadSingle(AssetTask task) { SingleDownload(); }
void DownLoadFinish(AssetTask aTask) { bool allFated = FreshSelMonster(); TeamUI.mInstance.show3DModel(_CurMonster.num, _CurMonster.RTData.Attribute, allFated); }
IEnumerator RealLoadAsset(AssetTask assetTask) { #if UNITY_EDITOR if (Config.simulateAssetBundleInEditor) { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.01f, 0.03f)));//模拟加载时间 var t = assetTask.type; if (null != t && t == typeof(Sprite)) { //做精灵加载 if (assetTask.abName != null) { string spriteRoot = Config.spritePath; List <string> files = new List <string>(); files.AddRange(Directory.GetFiles(spriteRoot + assetTask.abName + "/", assetTask.assetName + ".png", SearchOption.AllDirectories)); files.AddRange(Directory.GetFiles(spriteRoot + assetTask.abName + "/", assetTask.assetName + ".jpg", SearchOption.AllDirectories)); if (files.Count != 1) { Debug.LogError("Simulate can not find " + assetTask.assetName); } if (files.Count > 0) { UnityEngine.Object o = UnityEditor.AssetDatabase.LoadAssetAtPath(files[0], t); assetTask.success(o); } else { assetTask.error(); } yield break; } } else { //string fn = AssetBundleManager.GetHexABName(key); //暂时修改方案 UnityEngine.Object o = UnityEditor.AssetDatabase.LoadAssetAtPath(Config.prefabPath + assetTask.abName + ".prefab", typeof(UnityEngine.Object)); assetTask.success(o); //string[] fns = UnityEditor.AssetDatabase.GetAssetPathsFromAssetBundle(assetTask.name); //if (fns.Length != 1) Debug.LogError("Simulate can not find " + assetTask.name); //if (fns.Length > 0) //{ //} //else // error(); yield break; } } #endif yield return(RealLoadAssetBundle(assetTask)); var abCache = _assetBundleLoader.GetAssetBundle(assetTask.abName); _assetLoader.LoadAsset(assetTask.assetName, abCache.Target, (UnityEngine.Object o) => { assetTask.isFinish = true; assetTask.success(o); }, null, assetTask.type); }
void DownLoadFinish(AssetTask aTask) { Debug.Log("LoadFinished"); m_3dCard.Del3DModel(); m_3dCard.Show3DCard(m_data, false); }