public virtual void LoadObjectWWW(string resPath, ResLoadInfo.callback fn = null, object fnPara = null) { string originalFullPath = "Assets/Resources_Bundle/" + resPath; string parseCommonPath = "Assets/Resources_Bundle/" + parseCommonAsset(resPath); string md5Str = HashUtils.MD5(parseCommonPath) + ".ab"; string assetResPath = ResPath + md5Str; if (directoryResLoadInfo.ContainsKey(ResPathWWW + md5Str)) { ResLoadInfo rli = directoryResLoadInfo[ResPathWWW + md5Str]; if (rli.success) { rli.currentPrefabName = Path.GetFileNameWithoutExtension(resPath); fn(rli, fnPara); } else { rli.append(Path.GetFileNameWithoutExtension(resPath), fn, fnPara); } return; } if (true)//System.IO.File.Exists(assetResPath) { // Log.Info("LoadObjectWWW :" + Path.GetFileNameWithoutExtension(resPath)+ " " + assetResPath); string[] dps = mainfest.GetAllDependencies(md5Str); string[] resPaths = new string[dps.Length + 1]; if (dps != null && dps.Length > 0) { for (int i = 0; i < dps.Length; i++) { resPaths[i] = ResPathWWW + dps[i]; } } resPaths[resPaths.Length - 1] = ResPathWWW + md5Str;// assetResPath; ResLoadInfo res = new ResLoadInfo(); res.isCache = parseCommonAssetCache(resPath); directoryResLoadInfo.Add(ResPathWWW + md5Str, res); res.start(Path.GetFileNameWithoutExtension(resPath), resPaths, fn, fnPara, resPath); } else { //Log.Error("LoadObjectWWW: " + parseCommonPath + " " + md5Str + " not find file!"); ResLoadInfo res = new ResLoadInfo(); fn(res, null); } }
/// <summary> /// 加载依赖文件(暂时借用回调) /// </summary> public virtual void buildMainFest(ExtractCallback ecb) { //#if UNITY_EDITOR //ecb(1, 1); //#else ResLoadInfo resLoadInfo = new ResLoadInfo(); string[] ss = new string[1]; ss[0] = ResPathWWW + "res"; Debug.Log("Extract" + ss[0]); resLoadInfo.start("AssetBundleManifest", ss, (ResLoadInfo res, object param) => { mainfest = res.LoadAsset <AssetBundleManifest>(); //Log.Info(mainfest == null ? "mainfest加载失败" : "mainfest加载成功"); ecb(1, 1); }); }