//-- 取得版本文件 static void getVerinfor(string fPath, string verVal) { //-- 注意是加了版本号的,可以使用cdn string url = PStr.b().a(baseUrl).a("/").a(fPath).a(".").a(verVal).e(); WWWEx.get(url, CLAssetType.bytes, (Callback)onGetVerinfor, (Callback)onGetVerinfor, fPath, true); }
//-- 取得优先更新的资源 static void getPriorityFiles(string fPath) { string Url = ""; string verVal = MapEx.getString(serverPriorityVer, fPath); //--把版本号拼在后面 Url = PStr.begin().a(baseUrl).a("/").a(fPath).a(".").a(verVal).e(); //-- print("Url=="..Url); WWWEx.get(Url, CLAssetType.bytes, (Callback)onGetPriorityFiles, (Callback)initFailed, fPath, true); if (progressCallback != null) { Utl.doCallback(progressCallback, needUpgradeVerver.Count, progress, WWWEx.getWwwByUrl(Url)); } }
void doGetContent(string path, string url, bool needSave, CLAssetType type, object onGetAsset, bool autoRealseAB, params object[] originals) { #if UNITY_EDITOR getedResMap[path] = true; #endif if (url.StartsWith("http")) { url = url.Replace("+", "%2B"); } wwwMap[path] = true; NewList transParam = ObjPool.listPool.borrowObject(); transParam.Add(path); transParam.Add(url); transParam.Add(needSave); transParam.Add(type); transParam.Add(onGetAsset); transParam.Add(originals); transParam.Add(autoRealseAB); UnityWebRequest www = null; if (needSave) { #if UNITY_EDITOR Debug.LogWarning(url); #endif CLAssetType tmptype = type; if (type == CLAssetType.assetBundle) { //因为通过DownloadHandlerAssetBundle无法取得bytes,所以只能先改变取得数据类型,然后再通过AssetBundle.LoadFromMemory取得AssetBundle tmptype = CLAssetType.bytes; } www = WWWEx.get(url, tmptype, (Callback)onWWWBack, (Callback)onWWWBack, transParam, true); addWWW(www, path, url); } else { www = WWWEx.get(url, type, (Callback)onWWWBack, (Callback)onWWWBack, transParam, true); } }
/// <summary> /// Gets the server verver map.取得服务器版本文件的版本信息 /// </summary> static void getServerVerverMap() { string url = ""; //if (CLCfgBase.self.hotUpgrade4EachServer) //{ // //-- 说明是每个服务器单独处理更新控制 // url = PStr.begin().a(baseUrl).a("/").a(mVerverPath).a(".").a(verVerMD5).e(); //} //else //{ // url = PStr.begin().a(baseUrl).a("/").a(mVerverPath).e(); //} url = PStr.begin().a(baseUrl).a("/").a(mVerverPath).e(); WWWEx.get( Utl.urlAddTimes(url), //加了时间戳,保证一定会取得最新的 CLAssetType.bytes, (Callback)onGetServerVerverBuff, (Callback)onGetServerVerverBuff, null, true); }
public WWWEx() { self = this; }