public static void DoStory() { Applications.Terminal term = null; TerminalBackend.PrefixEnabled = false; Desktop.InvokeOnWorkerThread(() => { term = new Applications.Terminal(); AppearanceManager.SetupWindow(term); ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Welcome to ShiftOS."); Console.WriteLine(); ConsoleEx.Bold = false; ConsoleEx.ForegroundColor = ConsoleColor.White; Console.WriteLine("Before we can bring you to your new system, we must perform some system tasks."); Console.WriteLine(); Console.WriteLine("Here's the installation outline."); Console.WriteLine(); Console.Write(" - "); ConsoleEx.Bold = true; Console.Write("Storage preparation"); ConsoleEx.Bold = false; Console.Write(" First, we have to prepare your computer's storage device for ShiftOS. This \r\nincludes formatting your drive with the ShiftFS file \r\nsystem, creating system directories, and generating system files."); Console.WriteLine(); Console.Write(" - "); ConsoleEx.Bold = true; Console.Write("User configuration"); ConsoleEx.Bold = false; Console.Write(" Next it's up to you to set up a system hostname, create a user account, and personalize it."); Console.WriteLine(); Console.Write(" - "); ConsoleEx.Bold = true; Console.Write("System tutorial"); ConsoleEx.Bold = false; Console.WriteLine("Finally, we'll teach you how to use ShiftOS."); Console.WriteLine(); ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Let's get started!"); }); int position = 0; Thread.Sleep(5000); ConsoleEx.Bold = true; Console.WriteLine("System preparation"); Console.WriteLine(); ConsoleEx.Bold = false; ConsoleEx.ForegroundColor = ConsoleColor.White; Console.WriteLine(@"We'll now begin formatting your drive. Please be patient."); Console.WriteLine(); double bytesFree, totalBytes; string type, name; dynamic dinf; try { if (Lunix.InWine) { dinf = new Lunix.DFDriveInfo("/"); } else { dinf = new DriveInfo("C:\\"); } bytesFree = dinf.AvailableFreeSpace / 1073741824.0; totalBytes = dinf.TotalSize / 1073741824.0; type = dinf.DriveFormat.ToString(); name = dinf.Name; ConsoleEx.Bold = true; Console.Write("Drive name: "); ConsoleEx.Bold = false; Console.WriteLine(name); ConsoleEx.Bold = true; Console.Write("Drive type: "); ConsoleEx.Bold = false; Console.WriteLine(type); ConsoleEx.Bold = true; Console.Write("Total space: "); ConsoleEx.Bold = false; Console.WriteLine(String.Format("{0:F1}", totalBytes) + " GB"); ConsoleEx.Bold = true; Console.Write("Free space: "); Console.WriteLine(String.Format("{0:F1}", bytesFree) + " GB"); Console.WriteLine(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } ConsoleEx.Bold = false; ConsoleEx.BackgroundColor = ConsoleColor.Black; Console.Write("Formatting: ["); ConsoleEx.OnFlush?.Invoke(); int formatProgress = 3; while (formatProgress <= 100) { if (formatProgress % 3 == 0) { ConsoleEx.BackgroundColor = ConsoleColor.White; Console.Write(" "); ConsoleEx.OnFlush?.Invoke(); ConsoleEx.BackgroundColor = ConsoleColor.Black; } Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.typesound)); formatProgress++; Thread.Sleep(175); } Console.WriteLine("] ..done."); Thread.Sleep(1000); ConsoleEx.Bold = true; Console.WriteLine("Creating directories..."); ConsoleEx.Bold = false; foreach (var dir in Paths.GetAllWithoutKey()) { if (!dir.Contains(".") && dir.StartsWith("0:/")) { Console.WriteLine("Creating: " + dir); Thread.Sleep(125); Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.writesound)); } } Console.WriteLine(); Console.WriteLine("Next, let's get user information."); Console.WriteLine(); Desktop.InvokeOnWorkerThread(() => { var uSignUpDialog = new UniteSignupDialog((result) => { var sve = new Save(); sve.SystemName = result.SystemName; sve.Codepoints = 0; sve.Upgrades = new Dictionary <string, bool>(); sve.ID = Guid.NewGuid(); sve.StoriesExperienced = new List <string>(); sve.StoriesExperienced.Add("mud_fundamentals"); sve.Users = new List <ClientSave> { new ClientSave { Username = "******", Password = result.RootPassword, Permissions = 0 } }; sve.StoryPosition = 8675309; SaveSystem.CurrentSave = sve; Shiftorium.Silent = true; SaveSystem.SaveGame(); Shiftorium.Silent = false; }); AppearanceManager.SetupDialog(uSignUpDialog); }); }
public void Start() { Shiftorium.Silent = false; foreach (var frm in AppearanceManager.OpenForms) { (frm as Form).Invoke(new Action(() => { frm.Close(); })); } TerminalBackend.CommandProcessed += (cmd, args) => { if (cmd == "sos.help") { if (TutorialProgress == 0) { TutorialProgress = 1; } } else if (cmd == "sos.status") { if (TutorialProgress == 1) { TutorialProgress = 2; } } else if (cmd == "shiftorium.list") { if (TutorialProgress == 2) { TutorialProgress = 3; SaveSystem.TransferCodepointsFrom("sys", 50); } } else if (cmd == "shiftorium.info" && args == "{\"upgrade\":\"mud_fundamentals\"}") { if (TutorialProgress == 3) { TutorialProgress = 4; } } else if (cmd == "win.open") { if (TutorialProgress == 4) { TutorialProgress = 5; } } }; if (this.Visible == false) { this.Show(); } var t = new Thread(() => { textgeninput = lblHijack; Clear(); textgeninput = lblhackwords; Clear(); this.Invoke(new Action(() => { textgeninput.Font = SkinEngine.LoadedSkin.TerminalFont; })); TextType("ShiftOS has been installed successfully."); Thread.Sleep(500); TextType("Before you can continue to the operating system, here's a little tutorial on how to use it."); Thread.Sleep(500); TextType("Starting a Terminal..."); Applications.Terminal term = null; this.Invoke(new Action(() => { term = new Applications.Terminal(); this.Controls.Add(term); term.Location = new Point( (this.Width - term.Width) / 2, (this.Height - term.Height) / 2 ); term.Show(); term.OnLoad(); term.OnSkinLoad(); term.OnUpgrade(); })); TextType("This little text box is called a Terminal."); Thread.Sleep(500); TextType("Normally, it would appear in full-screen, but this window is hosting it as a control so you can see this text as well."); Thread.Sleep(500); TextType("In ShiftOS, the Terminal is your main control centre for the operating system. You can see system status, check Codepoints, open other programs, buy upgrades, and more."); Thread.Sleep(500); TextType("Go ahead and type 'sos.help' to see a list of commands."); while (TutorialProgress == 0) { //JESUS CHRIST PAST MICHAEL. //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. Thread.Sleep(100); } TextType("As you can see, sos.help gives you a list of all commands in the system."); Thread.Sleep(500); TextType("You can run any command, by typing in their Namespace, followed by a period (.), followed by their Command Name."); Thread.Sleep(500); TextType("Go ahead and run the 'status' command within the 'sos' namespace to see what the command does."); while (TutorialProgress == 1) { //JESUS CHRIST PAST MICHAEL. //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. Thread.Sleep(100); } TextType("Brilliant. The sos.status command will tell you how many Codepoints you have, as well as how many upgrades you have installed and how many are available."); Thread.Sleep(500); TextType("Codepoints, as you know, are a special currency within ShiftOS. They are used to buy things within the multi-user domain, such as upgrades, scripts, and applications."); Thread.Sleep(500); TextType("You can earn Codepoints by doing things in ShiftOS - such as completing jobs for other users, making things like skins, scripts, documents, etc, and playing games like Pong."); Thread.Sleep(500); TextType("At times, you'll be given Codepoints to help complete a task. You will receive Codepoints from 'sys' - the multi-user domain itself."); //SaveSystem.TransferCodepointsFrom("sys", 50); TextType("Right now, you don't have any upgrades. Upgrades can give ShiftOS additional features and capabilities - like new core applications, supported file types, and new Terminal commands."); Thread.Sleep(500); TextType("You can easily get upgrades using the Shiftorium - a repository of approved ShiftOS upgrades."); Thread.Sleep(500); TextType("To start using the Shiftorium, simply type 'shiftorium.list' to see available upgrades."); while (TutorialProgress == 2) { //JESUS CHRIST PAST MICHAEL. //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. Thread.Sleep(100); } Clear(); TextType("Right now, you have enough Codepoints to buy the 'mud_fundamentals' upgrade. You can use shiftorium.info to see information about this upgrade."); Thread.Sleep(500); TextType("Some commands, like shiftorium.info, require you to pass information to them in the form of arguments."); Thread.Sleep(500); TextType("Argument pairs sit at the end of the command, and are enclosed in curly braces."); Thread.Sleep(500); TextType("Inside these curly braces, you can input an argument key, followed by a colon, followed by the value. Then, if you need multiple arguments, you can put a comma after the value, and then insert another argument pair."); Thread.Sleep(500); TextType("There are different value types - numeric values, which can be any positive or negative 32-bit integer"); Thread.Sleep(500); TextType("Then there are boolean values which can be either 'true' or 'false'"); Thread.Sleep(500); TextType("Then there are string values, which are enclosed in double-quotes."); Thread.Sleep(500); TextType(" If for some reason you need to use a double-quote inside a string, you must escape it using a single backslash followed by the quote, like this: key:\"My \\\"awesome\\\" value.\""); Thread.Sleep(500); TextType("If you want to escape a backslash inside a string, simply type two backslashes instead of one - for example key:\"Back\\\\slash.\""); Thread.Sleep(500); TextType("shiftorium.info requires an upgrade argument, which is a string type. Go ahead and give shiftorium.info's upgrade argument the 'mud_fundamentals' upgrade's ID."); while (TutorialProgress == 3) { //JESUS CHRIST PAST MICHAEL. //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. Thread.Sleep(100); } TextType("As you can see, mud_fundamentals is very useful. In fact, a lot of useful upgrades depend on it. You should buy it!"); Thread.Sleep(500); TextType("shiftorium.info already gave you a command that will let you buy the upgrade - go ahead and run that command!"); while (!Shiftorium.UpgradeInstalled("mud_fundamentals")) { //JESUS CHRIST PAST MICHAEL. //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. Thread.Sleep(100); } TextType("Hooray! You now have the MUD Fundamentals upgrade."); Thread.Sleep(500); TextType("You can also earn more Codepoints by playing Pong. To open Pong, you can use the win.open command."); Thread.Sleep(500); TextType("If you run win.open without arguments, you can see a list of applications that you can open."); Thread.Sleep(500); TextType("Just run win.open without arguments, and this tutorial will be completed!"); while (TutorialProgress == 4) { //JESUS CHRIST PAST MICHAEL. //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. Thread.Sleep(100); } TextType("This concludes the ShiftOS beginners' guide brought to you by the multi-user domain. Stay safe in a connected world."); Thread.Sleep(2000); Desktop.InvokeOnWorkerThread(() => { OnComplete?.Invoke(this, EventArgs.Empty); SaveSystem.CurrentSave.StoryPosition = 2; this.Close(); SaveSystem.SaveGame(); AppearanceManager.SetupWindow(new Applications.Terminal()); }); }); t.IsBackground = true; t.Start(); }