コード例 #1
0
        public void AcceptUpdate(UpdatePath path)
        {
            UIScreen.RemoveDialog(_UpdaterAlert);

            try
            {
                if (path.FullZipStart)
                {
                    System.IO.File.WriteAllText("PatchFiles/clean.txt", "CLEAN");
                }
                else
                {
                    System.IO.File.Delete("PatchFiles/clean.txt");
                }
            } catch
            {
            }

            var downloader = new UIWebDownloaderDialog(GameFacade.Strings.GetString("f101", "1"), BuildFiles(path));

            downloader.OnComplete += (bool success) => {
                UIScreen.RemoveDialog(downloader);
                if (success)
                {
                    _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
                    {
                        Title   = GameFacade.Strings.GetString("f101", "3"),
                        Message = GameFacade.Strings.GetString("f101", "13"),
                        Buttons = UIAlertButton.Ok(y =>
                        {
                            UIScreen.RemoveDialog(_UpdaterAlert);
                            RestartGamePatch();
                        })
                    }, true);
                }
                else
                {
                    UIScreen.GlobalShowAlert(new UIAlertOptions
                    {
                        Title   = GameFacade.Strings.GetString("f101", "30"),
                        Message = GameFacade.Strings.GetString("f101", "28"),
                        Buttons = UIAlertButton.Ok(y =>
                        {
                            Continue(false);
                        })
                    }, true);
                }
            };
            GameThread.NextUpdate(y => UIScreen.GlobalShowDialog(downloader, true));
        }
コード例 #2
0
        public void DoUpdate(string branch, string version, string url)
        {
            View.LoginDialog.Visible   = false;
            View.LoginProgress.Visible = false;

            var str = GlobalSettings.Default.ClientVersion;

            var    split     = str.LastIndexOf('-');
            int    verNum    = 0;
            string curBranch = str;

            if (split != -1)
            {
                int.TryParse(str.Substring(split + 1), out verNum);
                curBranch = str.Substring(0, split);
            }

            _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
            {
                Title   = GameFacade.Strings.GetString("f101", "3"),
                Message = GameFacade.Strings.GetString("f101", "4", new string[] { version, branch, verNum.ToString(), curBranch }),
                Width   = 500,
                Buttons = UIAlertButton.YesNo(x =>
                {
                    UIScreen.RemoveDialog(_UpdaterAlert);
                    var downloader = new UIWebDownloaderDialog(GameFacade.Strings.GetString("f101", "1"), new DownloadItem[]
                    {
                        new DownloadItem {
                            Url      = url,
                            DestPath = "PatchFiles/patch.zip",
                            Name     = GameFacade.Strings.GetString("f101", "10")
                        }
                    });
                    downloader.OnComplete += (bool success) => {
                        UIScreen.RemoveDialog(downloader);
                        UIScreen.GlobalShowAlert(new UIAlertOptions
                        {
                            Title   = GameFacade.Strings.GetString("f101", "3"),
                            Message = GameFacade.Strings.GetString("f101", "13"),
                            Buttons = UIAlertButton.Ok(y =>
                            {
                                RestartGamePatch();
                            })
                        }, true);
                    };
                    GameThread.NextUpdate(y => UIScreen.GlobalShowDialog(downloader, true));
                },
                                              x =>
                {
                    GameThread.NextUpdate(state =>
                    {
                        UIScreen.RemoveDialog(_UpdaterAlert);
                        if (state.ShiftDown)
                        {
                            _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
                            {
                                Title   = GameFacade.Strings.GetString("f101", "11"),
                                Message = GameFacade.Strings.GetString("f101", "12"),
                                Width   = 500,
                                Buttons = UIAlertButton.Ok(y =>
                                {
                                    Regulator.AsyncTransition("AvatarData");
                                    UIScreen.RemoveDialog(_UpdaterAlert);
                                    View.LoginDialog.Visible   = true;
                                    View.LoginProgress.Visible = true;
                                })
                            }, true);
                        }
                        else
                        {
                            View.LoginDialog.Visible   = true;
                            View.LoginProgress.Visible = true;
                            Regulator.AsyncReset();
                        }
                    });
                })
            }, true);
        }