protected override void OnDownLoadError(AssetDownInfo info) { Debug.Log("ZIP下载错误!"); // 回炉重造 _current_strategy.GoBackDownLoadFileResultInfo(info); // 下载错误 if (info.ErrorNumber < DownloaderConstant.MAX_DOWNLOAD_ERROR_NUMBER) { StartDownLoad(info); } else { if (_current_strategy.AssetType == eUpdateAssetType.Zip) { FileManifestManager.RemoveLocalFenBaoData(info.ToAssetDataInfo()); } else { FileManifestManager.RemoveLocalABData(info.ToAssetDataInfo()); } AssetDownLoads.StopALLDownLoad(); } if (!_downLoad_error.Contains(info)) { _downLoad_error.Add(info); } }
void DownloadPlaying() { DownloadPlayingStageDataFactory strategyFactory = new DownloadPlayingStageDataFactory(); StageDataBase[] strategyBases = strategyFactory.BuildStrategys(); if (strategyBases == null || strategyBases.Length <= 0) { return; } Debug.Log("边玩边下载包=" + strategyBases.Length); ResourcesDownLoad zipDownload = new ResourcesDownLoad(strategyBases); zipDownload.StartDownLoad(); if (_first_view != null) { GUIS.Remove(_first_view); _first_view = null; } new PackageDownLoadView(zipDownload); zipDownload.DownLoadCompleteEvent = (rt) => { Updates.Clear(); GUIS.Clear(); AssetDownLoads.Clear(); }; }
public AssetDownLoadBase() { Updates.Add(this); AssetDownLoads.Add(this); downLoad_error_events = new Queue <DownLoadErrorEvent>(); download_successful_events = new Queue <DownloadSuccessfulEvent>(); httpDownloadAsyncs = new List <HttpDownLoadAsync>(); }
void ShowDownLoadInfo() { GUILayout.BeginHorizontal(); if (GUILayout.Button("停止下载")) { AssetDownLoads.StopALLDownLoad(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.TextField("正在下载!!!!!!!!"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.TextField(string.Format("每秒[{0}]Bit", DownloaderConstant.DownLoadSpeed)); GUILayout.EndHorizontal(); GUILayout.Space(10); ShowDownLoadErrorFile(); GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("文件数量{0}进度", "下载")); GUILayout.HorizontalScrollbar( 0, DownLoadStageResult.CurrentCount, 0, DownLoadStageResult.FileCount, GUILayout.Width(500)); GUILayout.TextField(string.Format("{0}/{1}", DownLoadStageResult.CurrentCount, DownLoadStageResult.FileCount)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("Bytes{0}进度", "下载")); GUILayout.HorizontalScrollbar( 0, DownLoadStageResult.CurrentSize, 0, DownLoadStageResult.TotalSize, GUILayout.Width(500)); GUILayout.TextField(string.Format("{0}/{1}", DownLoadStageResult.CurrentSize, DownLoadStageResult.TotalSize)); GUILayout.EndHorizontal(); if (DownLoadStageResult.DownLoadFileInfos == null) { return; } var itr = DownLoadStageResult.DownLoadFileInfos.Keys.GetEnumerator(); while (itr.MoveNext()) { if (DownLoadStageResult.DownLoadFileInfos[itr.Current].AssetName == string.Empty) { continue; } ShowDownLoadFileInfo(itr.Current); } itr.Dispose(); }
public void Update() { if (AssetDownLoads.IsAllDownLoadComplete) { Debug.Log("全部下载完成!!"); GUIS.Clear(); AssetDownLoads.Clear(); Updates.Clear(); } }
public void Clear() { AssetDownLoads.Remove(this); Updates.Remove(this); }