Exemplo n.º 1
0
        private void OnComplete()
        {
            if (this.EnableVFS)
            {
                var dataPath  = _savePath + Versions.Dataname;
                var downloads = _downloader.downloads;
                if (downloads.Count > 0 && File.Exists(dataPath))
                {
                    OnMessage("更新本地版本信息");
                    var files = new List <VFile>(downloads.Count);
                    foreach (var download in downloads)
                    {
                        files.Add(new VFile {
                            name = download.name, hash = download.hash, len = download.len,
                        });
                    }

                    var file = files[0];
                    if (!file.name.Equals(Versions.Dataname))
                    {
                        Versions.UpdateDisk(dataPath, files);
                    }
                }

                Versions.LoadDisk(dataPath);
            }

            OnProgress(1);
            OnMessage($"更新完成,版本号:{Versions.LoadVersion(_savePath + Versions.Filename)}");

            StartCoroutine(LoadGameScene());
        }
Exemplo n.º 2
0
        private void PrepareDownloads()
        {
            if (_step == STEP_PREPAREOVER)
            {
                return;
            }

            if (enableVFS)
            {
                var path = string.Format("{0}{1}", _savePath, Versions.Dataname);
                if (!File.Exists(path))
                {
                    AddDownload(_versions[0]);
                    return;
                }

                Versions.LoadDisk(path);
            }

            for (var i = 1; i < _versions.Count; i++)
            {
                var item = _versions[i];
                if (Versions.IsNew(string.Format("{0}{1}", _savePath, item.name), item.len, item.hash))
                {
                    AddDownload(item);
                }
            }
        }
Exemplo n.º 3
0
        private void OnComplete()
        {
            if (enableVFS)
            {
                var dataPath  = _savePath + Versions.Dataname;
                var downloads = _downloader.downloads;
                if (downloads.Count > 0 && File.Exists(dataPath))
                {
                    OnMessage("更新本地版本信息");
                    var files = new List <VFile>(downloads.Count);
                    foreach (var download in downloads)
                    {
                        files.Add(new VFile
                        {
                            name = Path.GetFileName(download.savePath),
                            hash = download.hash,
                            len  = download.len,
                        });
                    }

                    var file = files[0];
                    if (!file.name.Equals(Versions.Dataname))
                    {
                        Versions.UpdateDisk(dataPath, files);
                    }
                }

                Versions.LoadDisk(dataPath);
            }

            OnProgress(1);
            OnMessage("更新完成");
            var version = Versions.LoadVersion(_savePath + Versions.Filename);

            if (version > 0)
            {
                OnVersion(version.ToString());
            }

            _step = STEP_COMPLETE;

            StartCoroutine(LoadGameScene());
        }
Exemplo n.º 4
0
        private void OnComplete()
        {
            if (enableVFS)
            {
                var dataPath  = _savePath + Versions.Dataname;
                var downloads = _downloader.downloads;
                if (downloads.Count > 0 && File.Exists(dataPath))
                {
                    OnMessage("更新本地版本信息");
                    var files = new List <VFile>(downloads.Count);
                    foreach (var download in downloads)
                    {
                        files.Add(new VFile
                        {
                            name = download.name,
                            hash = download.hash,
                            len  = download.len,
                        });
                    }

                    var file = files[0];
                    if (!file.name.Equals(Versions.Dataname))
                    {
                        Versions.UpdateDisk(dataPath, files);
                    }
                }

                Versions.LoadDisk(dataPath);
            }

            OnProgress(1);
            OnMessage("更新完成");
            var version = Versions.LoadVersion(_savePath + Versions.Filename);

            if (version > 0)
            {
                OnVersion(version.ToString());
            }

            //StartCoroutine(LoadGameScene());
            FrameworkBoot.Event.Fire(StartBootResSystemEventArgs.EventId, StartBootResSystemEventArgs.Create(1));
        }