private IEnumerator LoadImgFromCache(string imgURl, RawImage img) { if (CheckCacheUrlIsExit(imgURl)) { Texture2D tex = new Texture2D(256, 256, TextureFormat.ARGB32, false); img.texture = tex; HttpBase.Download(imgURl, ((request, downloaded, length) => { }), ((request, response) => { if (response == null || !response.IsSuccess) { DebugManager.Instance.LogError("请求失败!"); return; } tex.LoadImage(response.Data); request.Dispose(); response.Dispose(); })); yield return(new WaitForEndOfFrame()); } else { yield break; } }
private IEnumerator LoadImgFromCache(string imgURl, RawImage img) { //Debug.Log(imgURl); if (CheckCacheUrlIsExit(imgURl)) { Texture2D tex = new Texture2D(256, 256, TextureFormat.ARGB32, false); img.texture = tex; HttpBase.Download(imgURl, ((request, downloaded, length) => { }), ((request, response) => { if (response == null || !response.IsSuccess) { return; } tex.LoadImage(response.Data); })); } else { yield break; } }