public static void DownloadEvoCardAll(Action <string> onComplete = null, string tag = null) { _onComplete = onComplete; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.EvoCardPackageIndex); DownloadManager.Clear(); ResPack resPack = resIndex.packageDict["EvoCard"]; _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; _downloadingWindow = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath); _downloadingWindow.Content = I18NManager.Get("Download_Downloading"); _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnCompleteEvoCard, OnErrorEvoCard, OnProgress); } }
public static void DownloadAllBundle(Action <string> onComplete, string tag = null) { _onComplete = onComplete; _tag = tag; _releasePath = ""; ResIndex resIndex = GetIndexFile(ResPath.AllResources); if (resIndex == null) { onComplete?.Invoke(tag); return; } ResPack resPack = resIndex.packageDict[ResPath.AllResources]; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnCompleteFullLoading, OnFullLoadingError, OnProgressFullLoading); LoadingProgress.Instance.Show(resPack.packageSize); LoadingProgress.Instance.SetPercent(0); } }
public static void DownloadExtendCache(Action <string> onComplete = null, string tag = null, Action <string> onError = null) { _onComplete = onComplete; _onError = onError; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.Extend); ResPack resPack = resIndex.packageDict[ResPath.Extend]; _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnCompleteFullLoading, OnError, OnProgressFullLoading); LoadingProgress.Instance.Show(resPack.packageSize); LoadingProgress.Instance.SetPercent(0); } }
public static void DownloadLoveDiaryCache(string musicId, Action <string> onComplete = null, Action onCancel = null, string tag = null) { _onComplete = onComplete; _onLoveDiaryCancel = onCancel; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.Special); string packKey = "lovediary"; if (!resIndex.packageDict.ContainsKey(packKey)) { FlowText.ShowMessage(I18NManager.Get("Download_ErrorLoveDiary") + musicId); _onLoveDiaryCancel?.Invoke(); return; } DownloadManager.Clear(); ResPack resPack = resIndex.packageDict[packKey.ToString()]; string resPath = "music/mainplay/" + musicId + ".music"; var rm = resPack.items.Find((m) => { return(m.Path == resPath); }); if (rm == null) { return; } _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Original) { ResItem item = new ResItem() { Md5 = rm.Md5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath + "/" + resPath, Size = rm.Size, FileType = resPack.packageType }; //_downloadingWindow = PopupManager.ShowWindow<DownloadingWindow>(Constants.DownloadingWindowPath); //_downloadingWindow.Content = I18NManager.Get("Download_Downloading"); //_downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); string storePath = AssetLoader.ExternalHotfixPath + "/" + _releasePath + "/" + resPath; Debug.Log(storePath); var downItem = DownloadManager.Load(item, storePath, OnCompleteLoveDiary, OnErrorLoveDiary, null, OnErrorLoveDiary); //_downloadingWindow.WindowActionCallback = evt => //{ // if (evt == WindowEvent.Cancel) // { // onCancel?.Invoke(); // downItem.Cancel(); // } //}; } }
public static void DownloadLoveStoryCache(int cardId, Action <string> onComplete = null, string tag = null, Action <string> onCancle = null) { _onComplete = onComplete; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.LoveStoryIndex); if (!resIndex.packageDict.ContainsKey(cardId.ToString())) { FlowText.ShowMessage(I18NManager.Get("Download_ErrorRole") + cardId); return; } DownloadManager.Clear(); ResPack resPack = resIndex.packageDict[cardId.ToString()]; _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; _downloadingWindow = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath); _downloadingWindow.Content = I18NManager.Get("Download_Downloading"); _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); var downloadItem = DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnCompleteLoveStory, OnErrorLoveStory, OnProgress); //downloadItems = downloadItem; _downloadingWindow.WindowActionCallback = evt => { if (evt == WindowEvent.Cancel) { downloadItem.Cancel(); onCancle?.Invoke(downloadItem.ErrorText); } }; } }
private static void DownloadBackEndCache() { ResPack resPack = _backendPackQueue.Dequeue(); _releasePath = resPack.releasePath; ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; Debug.LogError("StarDownloadBackEnd " + resPack.downloadPath); DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnBackendStepEnd, OnError, OnProgressFullLoading); LoadingProgress.Instance.TotalSize = Math.Round(resPack.packageSize * 1f / 1048576f, 2); }
public static void DownloadEvoCard(int cardId, Action <string> onComplete = null, string tag = null) { _onComplete = onComplete; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.EvoCardIndex); ResPack resPack = resIndex.packageDict["EvoCard"]; string id = cardId + ".bytes"; ResItem resItem = null; foreach (var item in resPack.items) { if (item.Path == id) { resItem = item; break; } } if (resItem == null) { FlowText.ShowMessage(I18NManager.Get("Download_IndexNoExist") + cardId); } else { resItem.Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath + "/" + id; _downloadingWindow = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath); _downloadingWindow.Content = I18NManager.Get("Download_Downloading"); _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); DownloadManager.Load(resItem, AssetLoader.ExternalHotfixPath + "/" + resPack.releasePath + "/" + id, OnCompleteEvoCard, OnErrorEvoCard, OnProgress); } }
public static void DownloadAllAudio(Action <string> onComplete = null, string tag = null) { _onComplete = onComplete; _tag = tag; ResIndex resIndex = GetIndexFile(ResPath.AllAudioIndex); ResPack resPack = resIndex.packageDict["AllAudio"]; _releasePath = resPack.releasePath; if (resPack.packageType == FileType.Zip) { ResItem item = new ResItem() { Md5 = resPack.packageMd5, Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" + resPack.downloadPath, Size = resPack.packageSize, FileType = resPack.packageType }; _downloadingWindow = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath); _downloadingWindow.Content = I18NManager.Get("Download_Downloading"); _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0); var downItem = DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath, OnComplete, OnError, OnProgressAll); _downloadingWindow.WindowActionCallback = evt => { if (evt == WindowEvent.Cancel) { downItem.Cancel(); } }; } }