aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Oobe.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms/Oobe.cs')
-rw-r--r--ShiftOS.WinForms/Oobe.cs52
1 files changed, 42 insertions, 10 deletions
diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs
index 5b767e0..6017d35 100644
--- a/ShiftOS.WinForms/Oobe.cs
+++ b/ShiftOS.WinForms/Oobe.cs
@@ -221,18 +221,50 @@ You must join the digital society, rise up the ranks, and save us.
public void PromptForLogin()
{
- this.Show();
- this.TopMost = true;
- lblHijack.Text = "";
- textgeninput = lblhackwords;
-
- var fsw = new FakeSetupScreen(this, 10);
- fsw.Show();
- fsw.TopMost = true;
- fsw.DoneLoggingIn += () =>
+ ServerMessageReceived MessageReceived = null;
+ MessageReceived = (msg) =>
{
- this.Close();
+ if(msg.Name == "mud_savefile")
+ {
+ SaveSystem.CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
+ SaveSystem.SaveGame();
+ Application.Restart();
+ }
+ else if(msg.Name == "mud_notfound")
+ {
+ ServerManager.MessageReceived -= MessageReceived;
+
+ PromptForLogin();
+ }
};
+ ServerManager.MessageReceived += MessageReceived;
+ Infobox.PromptYesNo("Login", "You are missing a digital society authentication link. Would you like to generate a new link with an existing account? Choosing \"No\" will restart the session in the out-of-box experience.", (result)=>
+ {
+ if (result == true)
+ {
+ Infobox.PromptText("Login", "Please enter your digital society username.", (uname) =>
+ {
+ Infobox.PromptText("Login", "Please enter your password.", (pword) =>
+ {
+ ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
+ {
+ username = uname,
+ password = pword
+ }));
+ }, true);
+ });
+ }
+ else
+ {
+ //restart in OOBE
+ if (Objects.ShiftFS.Utils.FileExists(Paths.GetPath("user.dat")))
+ {
+ Utils.Delete(Paths.GetPath("user.dat"));
+ }
+ Application.Restart();
+ }
+ });
+
}
public void StartTrailer()