Ejemplo n.º 1
0
 private void ContinueFromUpdate(bool toSAS)
 {
     if (toSAS)
     {
         Regulator.AsyncTransition("AvatarData");
         View.LoginDialog.Visible   = true;
         View.LoginProgress.Visible = true;
     }
     else
     {
         View.LoginDialog.Visible   = true;
         View.LoginProgress.Visible = true;
         Regulator.AsyncReset();
     }
 }
Ejemplo n.º 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);
        }