aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-30 19:42:48 -0400
committerMichael <[email protected]>2017-04-30 19:42:48 -0400
commit5f11bf2d299ab7575daf31970c4c504066f82a43 (patch)
tree1e253319d6730735d23f61e3d011bdefeafaefc4 /ShiftOS.WinForms
parentaec0eff8187fadb7418892c076a88c9bd03b8ff0 (diff)
downloadshiftos_thereturn-5f11bf2d299ab7575daf31970c4c504066f82a43.tar.gz
shiftos_thereturn-5f11bf2d299ab7575daf31970c4c504066f82a43.tar.bz2
shiftos_thereturn-5f11bf2d299ab7575daf31970c4c504066f82a43.zip
Intro uses new login system
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/OobeStory.cs167
1 files changed, 1 insertions, 166 deletions
diff --git a/ShiftOS.WinForms/OobeStory.cs b/ShiftOS.WinForms/OobeStory.cs
index ab730e7..b0fa444 100644
--- a/ShiftOS.WinForms/OobeStory.cs
+++ b/ShiftOS.WinForms/OobeStory.cs
@@ -141,173 +141,8 @@ namespace ShiftOS.WinForms
Console.WriteLine();
Console.WriteLine("Next, let's get user information.");
Console.WriteLine();
- Console.WriteLine("Please enter a system hostname.");
- string allowed_chars = "abcdefghijklmnopqrstuvwxyz1234567890_";
- bool userExists = false;
- Applications.Terminal.TextSent += (text) =>
- {
- if(position == 0)
- {
- if(text.Length < 5)
- {
- Console.WriteLine("Your hostname must be at least 5 characters long.");
- return;
- }
-
- if(!isValid(text, allowed_chars))
- {
- Console.WriteLine("Your hostname contains illegal characters. You can only use these characters: " + allowed_chars);
- return;
- }
- SaveSystem.CurrentSave.SystemName = text;
- position = 1;
- }
- else if(position == 1)
- {
- if (text.Length < 5)
- {
- Console.WriteLine("Your username must be at least 5 characters long.");
- return;
- }
- if (!isValid(text, allowed_chars))
- {
- Console.WriteLine("Your username contains illegal characters. You can only use these characters: " + allowed_chars);
- return;
- }
- SaveSystem.CurrentSave.Username = text;
- position = 2;
- }
- else if(position == 3)
- {
- if (!userExists)
- {
- if (text.Length < 5)
- {
- Console.WriteLine("Your password must be at least 5 characters long.");
- return;
- }
- SaveSystem.CurrentSave.Password = text;
- position = 4;
- }
- else
- {
- ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
- {
- username = SaveSystem.CurrentSave.Username,
- password = text
- }));
- }
- }
- };
+ ShiftOS.Engine.OutOfBoxExperience.PromptForLogin();
- TerminalBackend.InStory = false;
-
- while (position == 0)
- Thread.Sleep(10);
- Console.WriteLine("Connecting to the multi-user domain as " + SaveSystem.CurrentSave.SystemName + "...");
- bool connected = false;
- Engine.AudioManager.PlayCompleted += () => { connected = true; };
- Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02);
- while (connected == false)
- Thread.Sleep(10);
- Console.WriteLine("Connection successful, system spinning up...");
- Thread.Sleep(200);
- UsernameWait:
- Console.WriteLine("No users associated with this system. Please enter a username.");
- Console.WriteLine(" - If the username is registered as a digital being, you will be prompted for your password. Else, you will be prompted to create a new account.");
- while(position == 1)
- {
- Thread.Sleep(10);
- }
- bool goBack = false;
- int incorrectChances = 2;
- Console.WriteLine("Checking sentience records...");
- ServerMessageReceived smr = (msg) =>
- {
- if (position == 2)
- {
- if (msg.Name == "mud_found")
- {
- Console.WriteLine("Your username has been taken by another sentient being within the digital society.");
- Console.WriteLine("If you are that sentience, you have two chances to type the correct password.");
- userExists = true;
- }
- else if (msg.Name == "mud_notfound")
- {
- Console.WriteLine("Please enter a password for this new user.");
- userExists = false;
- }
- position = 3;
- }
- else if (position == 3)
- {
- if(userExists == true)
- {
- if(msg.Name == "mud_savefile")
- {
- Console.WriteLine("Your sentience profile has been assigned to your system successfully. We will bring you to your system shortly.");
- SaveSystem.CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
- position = 4;
- }
- else if(msg.Name == "mud_login_denied")
- {
- if (incorrectChances > 0)
- {
- incorrectChances--;
- Console.WriteLine("Access denied. Chances: " + incorrectChances);
- }
- else
- {
- Console.WriteLine("Access denied.");
- position = 2;
- goBack = true;
- }
- }
- }
- }
- };
- ServerManager.MessageReceived += smr;
- ServerManager.SendMessage("mud_checkuserexists", JsonConvert.SerializeObject(new { username = SaveSystem.CurrentSave.Username }));
- while (position == 2)
- {
- Thread.Sleep(10);
- }
- while (position == 3)
- {
- Thread.Sleep(10);
- }
- if (goBack)
- {
- ServerManager.MessageReceived -= smr;
- goto UsernameWait;
- }
- Console.WriteLine("Sentience linkup successful.");
- Console.WriteLine("We will bring you to your system in 5 seconds.");
- Thread.Sleep(5000);
- Desktop.InvokeOnWorkerThread(() =>
- {
- SaveSystem.CurrentSave.StoryPosition = 3;
- SaveSystem.SaveGame();
- while (!Shiftorium.IsInitiated)
- {
- Thread.Sleep(10);
- }
- if (!Shiftorium.UpgradeInstalled("desktop"))
- {
- SaveSystem.GameReady += () =>
- {
- term.ClearText();
- TerminalBackend.PrintPrompt();
- Console.Write("sos.status");
- TerminalBackend.InvokeCommand("sos.status");
- TerminalBackend.PrintPrompt();
- Console.Write("sos.help");
- TerminalBackend.InvokeCommand("sos.help");
- Thread.Sleep(1000);
- TerminalBackend.PrintPrompt();
- };
- }
- });
}
private static bool isValid(string text, string chars)
{