void OnDownLoadProgress(DownLoaderBese downLoaderBese) { if (onDownLoadBatchProgress != null) { onDownLoadBatchProgress(this, downLoaderBese); } }
public void OnDownLoadBatchProgress(DownLoadBatch downLoadBatch, DownLoaderBese downLoaderBese) { if (onAssetUpdateProgress != null) { onAssetUpdateProgress(downLoadBatch); } }
void OnDownLoadError(DownLoaderBese downLoaderBese, Exception ex) { exception = ex.ToString(); Debug.LogErrorFormat(" 批下载错误 {0} ", name); if (onDownLoadBatchError != null) { onDownLoadBatchError(this, downLoaderBese); } }
public void AddDownLoader(DownLoaderBese downLoader) { int freeIndex = GetFreeIndex(); if (freeIndex != -1) { queueWorking[freeIndex] = downLoader; downLoader.Execute(); } else { queueWaitting.Enqueue(downLoader); } }
void OnDownLoadComplete(DownLoaderBese downLoaderBese) { if (onDownLoadBatchOneComplete != null) { onDownLoadBatchOneComplete(this, downLoaderBese); } completeCount++; if (completeCount == downLoaderArr.Count) { if (onDownLoadBatchComplete != null) { onDownLoadBatchComplete(this); DownLoadManager.I.RemDownLoadBatch(this); } } }
void OnDownLoadBatchError(DownLoadBatch downLoadBatch, DownLoaderBese downLoaderBese) { /* * 如果在本次下载批次中出现错误,则还原备份的 md5filelist.txt.bak * 当程序再次加载时忽略本次下载结果 */ string localFilePath = assetsUpdatePath + "/md5filelist.txt"; string localFilePathbak = assetsUpdatePath + "/md5filelist.txt.bak"; //如果本地文件存在 if (File.Exists(localFilePath) && File.Exists(localFilePathbak)) { File.Delete(localFilePath); //还原旧列表 File.Move(localFilePathbak, localFilePath); } if (_arrayNeedUpdate != null && _arrayNeedUpdate.Length > 0) { _arrayNeedUpdate = null; } }
// Update is called once per frame void Update() { for (int i = 0; i < maxWorking && i < queueWorking.Length; i++) { if (queueWorking[i] != null) { if (queueWorking [i].IsFree()) { queueWorking [i] = null; if (queueWaitting.Count > 0) { DownLoaderBese downLoaderBese = queueWaitting.Dequeue(); downLoaderBese.Execute(); queueWorking [i] = downLoaderBese; } } else { queueWorking [i].Update(); Debug.LogFormat("downLoader progress : " + queueWorking [i].url + " >>>> " + queueWorking [i].progress); } } } }
void OnDownLoadBatchError(DownLoadBatch downLoadBatch, DownLoaderBese downLoaderBese) { Debug.LogError("下载错误! " + downLoadBatch.name); }
void OnDownLoadProgress(DownLoadBatch downLoadBatch, DownLoaderBese downLoaderBese) { }