void UpdateComplete(ByteFileInfoList pInfo, string pError) { Debug.Log(pError); if (pError == null) { } }
ByteFileInfoList GetNeedDownloadFiles(List <ByteFileInfo> pList) { if (pList == null || pList.Count == 0) { return(null); } var tcmp = new ByteFileInfoList(); tcmp.AddRange(pList); string tdedfile = GameCore.CombinePath(GameCore.PersistentResDataPath, downloadedfile); var tdedinfo = new ByteFileInfoList(tdedfile); var tneedList = tdedinfo.Comparison(tcmp); if (tneedList.Count == 0) { UpdateLocalList(); return(null); } else { ByteFileInfoList ret = new ByteFileInfoList(); ret.AddRange(tneedList); return(ret); } }
void DownLoadCheckFileFinished(CheckComplete onComplete) { isChecking = false; ByteFileInfoList ret = GetNeedDownloadFiles(GetUpdateList()); CallCheckOnComplete(onComplete, ret); }
void FileUpdateing(ByteFileInfoList pInfo, UpdateComplete onComplete, bool autoRetry) { curInfo = pInfo; curOnComplete = onComplete; curAutoRetry = autoRetry; ReleaseGroupLoader(); downLoadGroup = new DownLoadGroup("updateGroup"); foreach (var item in pInfo.fileInfoList) { string turl = GetServerUrl(item.resName); var tloader = downLoadGroup.AddByUrl(turl, GameCore.PersistentResDataPath, item.resName, item.fileMD5, item.fileSize, false); tloader.priority = item.priority; tloader.OnComplete += (a) => { if (a.IsCompleteDownLoad) { OnUpdateOneComplete(pInfo[a.FileName]); } }; } downLoadGroup.StartAsync(); UpdateProcess(); StartCoroutine(WaitUpdateDone()); }
ByteFileInfoList GetErroListInfo(DownLoadGroup pGroup, ByteFileInfoList pInfo) { var tlist = pGroup.GetNotCompletFileNameTable(); pInfo.RemoveRangeWithOutList(tlist); return(pInfo); }
static public void UpdateRes(ByteFileInfoList pInfo, UpdateComplete onComplete, bool autoRetry) { if (isUpdateing) { Debug.LogError("Updateing."); return; } isUpdateing = true; Instance.StartCoroutine(Instance.WaitStarUpdate(0.1f, pInfo, onComplete, autoRetry)); }
void CallUpdateOnComplete(UpdateComplete onComplete, ByteFileInfoList pInfo, string pError) { try { ReleaseGroupLoader(); ReTryCount = 0; onComplete?.Invoke(pInfo, pError); } catch (System.Exception erro) { Debug.LogError("CheckUpdate->" + erro.ToString()); } }
void OnUpdateComplete(ByteFileInfoList info, string error) { if (string.IsNullOrEmpty(error)) { updateType = UpdateType.finished; checkType = CheckType.AllGood; updateList = null; } else { updateType = UpdateType.fail; updateList = info; } }
public void LoadByteFileInfoList() { _ByteInfoData = new ByteFileInfoList(); AssetBundle tinfobundle = AssetBundle.LoadFromFile(GetFullPath(byteFileInfoFileName)); if (tinfobundle != null) { TextAsset tass = tinfobundle.LoadAsset <TextAsset>(byteFileInfoFileName); if (tass != null) { _ByteInfoData.Load(tass.bytes); } tinfobundle.Unload(false); } }
void CallCheckOnComplete(CheckComplete onComplete, ByteFileInfoList pObj) { try { string error = checkLoader != null ? checkLoader.Error : null; ReleaseCheckLoader(); ReTryCheckCount = 0; onComplete?.Invoke(pObj, error); } catch (System.Exception erro) { Debug.LogError("CheckUpdate->" + erro.ToString()); } }
void OnCheckComplete(ByteFileInfoList info, string error) { if (error == null) { if (info != null && info.fileMap.Count > 0) { checkType = CheckType.needUpdate; updateList = info; } else { checkType = CheckType.AllGood; } } else { checkType = CheckType.fail; } }
void UpdateFileFail() { isUpdateing = false; ByteFileInfoList erroListInfo = GetErroListInfo(downLoadGroup, curInfo); if (ReTryCount >= ReTryMaxCount) { curAutoRetry = false; } if (!curAutoRetry) { CallUpdateOnComplete(curOnComplete, erroListInfo, downLoadGroup.Error); } else { Debug.Log(downLoadGroup.Error); ReTryCount++; StartCoroutine(WaitReTryUpdate()); } }
List <ByteFileInfo> GetUpdateList() { List <ByteFileInfo> ret = null; var tinfo = new ByteFileInfoList(); string tfilePath = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName()); if (File.Exists(tfilePath)) { AssetBundle tinfobundle = AssetBundle.LoadFromFile(tfilePath); if (tinfobundle != null) { TextAsset tass = tinfobundle.LoadAsset <TextAsset>(LoaderManager.byteFileInfoFileName); if (tass != null) { tinfo.Load(tass.bytes); } tinfobundle.Unload(false); } } ret = LoaderManager.ByteInfoData.Comparison(tinfo); return(ret); }
IEnumerator WaitStarUpdate(float delayTime, ByteFileInfoList pInfo, UpdateComplete onComplete, bool autoRetry) { yield return(new WaitForSeconds(delayTime)); Instance.FileUpdateing(pInfo, onComplete, autoRetry); }