From a9a9beaf63e5a8dc63e8ec8388373e3868d11cfb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 20:46:56 -0400 Subject: [PATCH] finish the smiley's first story --- ShiftOS.WinForms/Applications/Downloader.cs | 5 +- ShiftOS.WinForms/Applications/Installer.cs | 5 + ShiftOS.WinForms/Applications/Shiftnet.cs | 5 +- ShiftOS.WinForms/Resources/Shiftorium.txt | 23 +++- ShiftOS.WinForms/Stories/LegionStory.cs | 135 +++++++++++++++++++- ShiftOS.WinForms/WinformsDesktop.cs | 11 ++ 6 files changed, 179 insertions(+), 5 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index 1f240bf..b3d2cea 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -42,8 +42,11 @@ using System.IO.Compression; namespace ShiftOS.WinForms.Applications { [MultiplayerOnly] - [Launcher("Downloader", false, null, "Networking")] + [Launcher("Downloader", true, "al_downloader", "Networking")] [DefaultIcon("iconDownloader")] + [WinOpen("downloader")] + [DefaultTitle("Downloader")] + [RequiresUpgrade("downloader")] public partial class Downloader : UserControl, IShiftOSWindow { public Downloader() diff --git a/ShiftOS.WinForms/Applications/Installer.cs b/ShiftOS.WinForms/Applications/Installer.cs index 1b5521e..2193f8a 100644 --- a/ShiftOS.WinForms/Applications/Installer.cs +++ b/ShiftOS.WinForms/Applications/Installer.cs @@ -11,6 +11,11 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [WinOpen("installer")] + [RequiresUpgrade("installer")] + [MultiplayerOnly] + [DefaultTitle("Installer")] + [Launcher("Installer", true, "al_installer", "Utilities")] public partial class Installer : UserControl, IShiftOSWindow { public Installer() diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 501fa56..54a8aa6 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -44,8 +44,11 @@ namespace ShiftOS.WinForms.Applications // //READ THE DAMN SHIFTOS CODING GUIDELINES. - [Launcher("Shiftnet", false, null, "Networking")] + [Launcher("Shiftnet", true, "al_shiftnet", "Networking")] [MultiplayerOnly] + [DefaultTitle("Shiftnet")] + [WinOpen("shiftnet")] + [RequiresUpgrade("victortran_shiftnet")] [DefaultIcon("iconShiftnet")] public partial class Shiftnet : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index ae4cb0a..fd03677 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -160,7 +160,28 @@ Category: "GUI", Description: "This upgrade allows you to find ShiftLotto in your App Launcher." }, - + //STORY-DRIVEN AL UPGRADES + { + Name: "AL Shiftnet", + Cost: 150, + Dependencies: "app_launcher;victortran_shiftnet", + Category: "GUI", + Description: "This upgrade puts a Shiftnet entry into your app launcher - you know, for those times when you just feel like surfing the net." + }, + { + Name: "AL Installer", + Cost: 150, + Dependencies: "installer;app_launcher", + Category: "GUI", + Description: "Got a new .stp file and want to set it up, from your App Launcher? This upgrade is for you! It adds an AL entry for the Installer." + }, + { + Name: "AL Downloader", + Cost: 150, + Dependencies: "app_launcher;downloader", + Category: "GUI", + Description: "The Downloader is an easy, central way to check all your downloads' progress. This upgrade adds an app launcher entry for it." + }, // COLOR DEPTH AND DITHERING { diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 00c7544..9b4966f 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -10,6 +10,72 @@ namespace ShiftOS.WinForms.Stories { public static class LegionStory { + private static string CharacterName = "DevX"; + private static string SysName = "mud"; + + [Story("victortran_shiftnet")] + public static void ShiftnetStoryFeaturingTheBlueSmileyFaceHolyFuckThisFunctionNameIsLong() + { + CharacterName = "victor_tran"; + SysName = "theos"; + bool waiting = false; + var installer = new Applications.Installer(); + installer.InstallCompleted += () => + { + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.Close(installer); + }); + waiting = false; + }; + + if (!terminalOpen()) + { + var term = new Applications.Terminal(); + AppearanceManager.SetupWindow(term); + } + + var t = new Thread(() => + { + WriteLine("victortran@theos - user connecting to your system.", false); + Thread.Sleep(2000); + WriteLine("Hey there - yes, I am not just a sentient being. I am indeed Victor Tran."); + WriteLine("I am the creator of a Linux desktop environment called theShell."); + WriteLine("I'm in the middle of working on a ShiftOS version of it."); + WriteLine("However, before I start, I feel I need to show you something."); + WriteLine("You have a lot of ShiftOS applications, and you can earn lots of Codepoints - and you already have lots."); + WriteLine("Well, you'd be a perfect candidate for me to install the Shiftnet Client on your system."); + WriteLine("I'll begin the installation right now."); + //Set up an Installer. + waiting = true; + Desktop.InvokeOnWorkerThread(() => + { + Story.Start("installer"); + AppearanceManager.SetupWindow(installer); + installer.InitiateInstall(new ShiftnetInstallation()); + }); + while (waiting == true) + Thread.Sleep(25); + + WriteLine("All installed! Once I disconnect, type win.open to see a list of your new apps."); + WriteLine("The Shiftnet is a vast network of websites only accessible through ShiftOS."); + WriteLine("Think of it as the DarkNet, but much darker, and much more secretive."); + WriteLine("There are lots of apps, games, skins and utilities on the Shiftnet."); + WriteLine("There are also lots of companies offering many services."); + WriteLine("I'd stay on the shiftnet/ cluster though, others may be dangerous."); + WriteLine("I'd also stick to the sites listed on shiftnet/shiftsoft/ping - that site is regularly updated with the most safe Shiftnet sites."); + WriteLine("Anyways, it was nice meeting you, hopefully someday you'll give theShell a try."); + + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + }); + t.IsBackground = true; + t.Start(); + + TerminalBackend.PrefixEnabled = false; + + } + private static void WriteLine(string text, bool showCharacterName=true) { Console.WriteLine(); @@ -17,11 +83,11 @@ namespace ShiftOS.WinForms.Stories { ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkMagenta; - Console.Write("DevX"); + Console.Write(CharacterName); Console.ForegroundColor = ConsoleColor.White; Console.Write("@"); ConsoleEx.ForegroundColor = ConsoleColor.Yellow; - Console.Write("mud: "); + Console.Write(SysName + ": "); } ConsoleEx.ForegroundColor = ConsoleColor.Gray; ConsoleEx.Bold = false; @@ -56,6 +122,8 @@ namespace ShiftOS.WinForms.Stories [Story("devx_legions")] public static void DevXLegionStory() { + CharacterName = "DevX"; + SysName = "mud"; bool waiting = false; //Used for DevX dialogue. //Used for legion selection. @@ -198,5 +266,68 @@ namespace ShiftOS.WinForms.Stories SetProgress(100); } } + + /// + /// Stub: Used for story-driven Shiftorium dependency "installer". + /// + [Story("installer")] + public static void InstallerPlaceholder() + { + + } + + /// + /// Stub: Used for story-driven Shiftorium dependency: "downloader" + /// + [Story("downloader")] + public static void DownloaderPlaceholder() + { + + } + + public class ShiftnetInstallation : Applications.Installation + { + protected override void Run() + { + SetStatus("Preparing to install dependency: installer_user_agent"); + SetProgress(0); + Thread.Sleep(5000); + for(int i = 0; i < 100; i++) + { + SetStatus("Installing installer_user_agent"); + SetProgress(i); + Thread.Sleep(50); + } + SetProgress(0); + SetStatus("Preparing to install dependency: downloader"); + Thread.Sleep(3500); + for(int i = 0; i < 100; i++) + { + SetStatus("Installing dependency: downloader"); + SetProgress(i); + Thread.Sleep(100); + } + Story.Start("downloader"); + SetProgress(0); + SetStatus("Dependencies installed."); + Thread.Sleep(2000); + SetStatus("Installing Shiftnet."); + Thread.Sleep(3000); + for(int i = 0; i < 100; i++) + { + SetProgress(i); + string dots = ""; + if ((i % 2) == 0) + dots = "."; + if ((i % 3) == 0) + dots = ".."; + if ((i % 4) == 0) + dots = "..."; + SetStatus($"Installing Shiftnet{dots}"); + Thread.Sleep(100); + } + + } + } } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 5a42106..8704b94 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -74,6 +74,17 @@ namespace ShiftOS.WinForms } } } + + if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) + { + if (SaveSystem.CurrentSave.Codepoints >= 50000) + { + if (Shiftorium.IsCategoryEmptied("Applications")) + { + Story.Start("victortran_shiftnet"); + } + } + } }; this.TopMost = false;