예제 #1
0
        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);
            }
        }
예제 #2
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();
                //    }
                //};
            }
        }
예제 #3
0
        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);
                    }
                };
            }
        }