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);
            }
        }
Exemple #2
0
        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();
                    }
                };
            }
        }