void DownloadAssetFile_Complated(string fileName, AsyncCompletedEventArgs e) { FileRecord record = m_NeedUpdateFileRecords.Find(temp => temp.FileName == fileName); if (record == null) { return; } if (e.Error != null) { Debug.LogErrorFormat("download remote file:[{0}] error[{1}]", fileName, e.Error.Message); WebClientDownloader.StopDownloader(); HotfixUpdaterSwitchToFaildState(true); } else if (e.Cancelled) { HotfixUpdaterSwitchToFaildState(true); } else { m_NeedUpdateFileRecords.Remove(record); if (FileUtility.CopyFileByPathType(record.FileName, PathType.Cache, PathType.Local)) { complatedFileRecords.Enqueue(record); } int complatedCount = m_NeedDownCount - m_NeedUpdateFileRecords.Count; NotifyHotFixUpdateProgressChanged(string.Format("下载更新({0}/{1})", complatedCount, m_NeedDownCount), complatedCount * 100f / m_NeedDownCount); if (m_NeedUpdateFileRecords.Count == 0) { DownloadComplatedRestore(); // 下载完成了 FileUtility.CopyFileByPathType(VERSION_FILENAME, PathType.Cache, PathType.Local); HotfixUpdaterSwitchToState(HotFixUpdaterState.ClearObsoleteAssets); } else if (complatedFileRecords.Count >= ComplatedDownloadSaveCount) { DownloadComplatedRestore(); } } }
/// <summary> /// 游戏退出接口 /// </summary> private void OnApplicationQuit() { StopAllCoroutines(); WebClientDownloader.StopDownloader(); }