//同步加载 internal void StartSync() { m_start = true; url = ResourcesLoader.GetAssetBundleDownloadingURL(assetBundleName); // set full url url = CUtils.GetAndroidABLoadPath(url); var assetBundle = AssetBundle.LoadFromFile(url); m_Done(assetBundle); }
public static void GetHttpDnsIP(string strUrl, System.Action <string, string> onComplete) { string url = string.Format("http://119.29.29.29/d?dn={0}", strUrl); System.Action <CRequest> onEnd = delegate(CRequest req) { string text = req.data.ToString(); string[] strIps = text.Split(';'); string strIp = strIps[0]; onComplete(strUrl, strIp); }; Debug.Log("ResourcesLoader.HttpRequest:" + url); ResourcesLoader.HttpRequest(url, null, typeof(string), onEnd, null, null); }
public void Start() { m_start = true; var cacheData = CacheManager.TryGetCache(assetBundleName); if (!cacheData.canUse) //判断ab是否已经加载防止同步加载 { url = ResourcesLoader.GetAssetBundleDownloadingURL(assetBundleName); // set full url url = CUtils.GetAndroidABLoadPath(url); m_abRequest = AssetBundle.LoadFromFileAsync(url); CacheManager.SetCacheDataLoding(assetBundleName);//修改为loading状态 } }
public override void Enqueue(CRequest req) { if (ResourcesLoader.LoadAssetFromCache(req)) { ABDelayUnloadManager.CheckRemove(req.keyHashCode); ResourcesLoader.DispatchReqAssetOperation(req, false); } else { req.group = this; base.Enqueue(req); } }
bool _Update() { string url = HttpDns.GetUrl(cRequest.url); // get dsn ip if (string.IsNullOrEmpty(url)) { return(true); //wait for ip } if (url != cRequest.url) { var headers = cRequest.head; if (headers == null) { headers = new WebHeaderCollection(); cRequest.head = headers; } if (string.IsNullOrEmpty(headers.Get("host"))) { headers.Add("host", new System.Uri(cRequest.url).Host); } // Debug.LogFormat("request ip {0} override host {1} ",url,cRequest.overrideHost); ResourcesLoader.UnityWebRequest(cRequest); } else if (originalOperation != null) { Debug.LogFormat(" dns resolve fail request url {0} ", url); ResourcesLoader.ProcessFinishedOperation(originalOperation); } else { Debug.LogFormat("dns resolve fail , complete request url {0} ", url); cRequest.DispatchEnd(); if (cRequest.group != null) { cRequest.group.Complete(cRequest, true); } cRequest.ReleaseToPool(); } return(false); }
void m_Start() { #if HUGULA_LOADER_DEBUG HugulaDebug.FilterLogFormat(cRequest.key, " <color=#15A0A1> 1 AssetBundle Request(assetName={0}) key={1},frame={2} </color>", cRequest.assetName, cRequest.key, Time.frameCount); #endif if (cRequest.url.StartsWith("http")) { m_UnityWebRequest = UnityWebRequest.GetAssetBundle(cRequest.url); m_abRequest = m_UnityWebRequest.Send(); } else { cRequest.url = ResourcesLoader.GetAssetBundleDownloadingURL(cRequest.vUrl); // set full url string url = CUtils.GetAndroidABLoadPath(cRequest.url); // var abInfo = ManifestManager.GetABInfo (cRequest.key); // if (abInfo != null && abInfo.size < ResourcesLoader.asyncSize) { // assetBundle = AssetBundle.LoadFromFile (url); // } else { m_abRequest = AssetBundle.LoadFromFileAsync(url); } frameBegin = Time.frameCount; }
bool _Update() { string url = HttpDns.GetUrl(cRequest.url); // get dsn ip if (string.IsNullOrEmpty(url)) { return(true); //wait for ip } if (url != cRequest.url) { cRequest.overrideHost = cRequest.uri.Host;// set host cRequest.overrideUrl = url; // request Debug.LogFormat("request ip {0} override host {1} ", url, cRequest.overrideHost); ResourcesLoader.HttpRequest(cRequest); } else if (originalOperation != null) { Debug.LogFormat(" dns resolve fail request url {0} ", url); ResourcesLoader.ProcessFinishedOperation(originalOperation); } else { Debug.LogFormat("dns resolve fail , complete request url {0} ", url); cRequest.DispatchEnd(); if (cRequest.group != null) { cRequest.group.Complete(cRequest, true); } cRequest.ReleaseToPool(); } return(false); }