From 2ac1033c2dcd0e70114ab9ee5c7bd129bff6c1fa Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 15:56:14 -0400 Subject: Legion story work (SPOILERS!) --- ShiftOS.WinForms/Stories/LegionStory.cs | 169 ++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 ShiftOS.WinForms/Stories/LegionStory.cs (limited to 'ShiftOS.WinForms/Stories') diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs new file mode 100644 index 0000000..424c54b --- /dev/null +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Stories +{ + public static class LegionStory + { + private static void WriteLine(string text, bool showCharacterName=true) + { + Console.WriteLine(); + if (showCharacterName == true) + { + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkMagenta; + Console.Write("DevX"); + Console.ForegroundColor = ConsoleColor.White; + Console.Write("@"); + ConsoleEx.ForegroundColor = ConsoleColor.Yellow; + Console.Write("mud: "); + } + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + ConsoleEx.Bold = false; + + foreach (var c in text) + { + Desktop.InvokeOnWorkerThread(() => + { + Console.Write(c); + }); + Thread.Sleep(75); + } + Thread.Sleep(1000); + } + + public static bool terminalOpen() + { + foreach(var win in AppearanceManager.OpenForms) + { + if (win.ParentWindow is Applications.Terminal) + return true; + } + return false; + } + + [Story("mud_control_centre")] + public static void MCC_Placeholder() + { + //What a way to create unbuyable, engine-managed Shiftorium Upgrades... :P + } + + [Story("devx_legions")] + public static void DevXLegionStory() + { + bool waiting = false; + //Used for DevX dialogue. + //Used for legion selection. + var mud = new Applications.MUDControlCentre(); + //For installing the MCC + 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("DevX@mud - user connecting to your system.", false); + Thread.Sleep(2000); + WriteLine($"Hello, {SaveSystem.CurrentSave.Username}. It's been a while."); + WriteLine("My intelligence suggests you've installed all GUI-based Shiftorium upgrades."); + WriteLine("Bet you're liking ShiftOS now that the terminal isn't the only way you can control it."); + WriteLine("Well, now it's time to introduce your next task."); + WriteLine("In the multi-user domain, each user has a reputation value associated with them."); + WriteLine("Right now, you have a reputation of 0, Neutral."); + WriteLine("This means that nobody has an opinion on you, yet."); + WriteLine("What a good time to make your presence known?"); + WriteLine("I have an application for you to try, that will help you out in the multi-user domain, and help you make yourself famous."); + WriteLine("In the digital society, you can't survive long as a lone sentience. You must kongregate with a group, and these groups are called \"legions\"."); + WriteLine("This application will assist you in finding one. A legion is a group of sentiences who carry out actions together. They're like... a pack of wolves, or a family, if you will."); + WriteLine("They share Codepoints, documents, applications, and other things with each other."); + WriteLine("And they all have their own goals."); + WriteLine("Up until now, you've been blindly following my directions, with the goal of upgrading ShiftOS. Now, it's time for you to join a legion, and fulfill their goals, to become known within the digital society."); + + WriteLine("You'll do all of this through the MUD Control Centre."); + WriteLine("I'll set it up on your system now."); + //Set up an Installer. + waiting = true; + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.SetupWindow(installer); + installer.InitiateInstall(new MCCInstallation()); + }); + while (waiting == true) + Thread.Sleep(25); + + WriteLine("There, it's all installed, so let's get you set up with a legion, shall we?"); + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.SetupWindow(mud); + mud.ShowClasses(); + mud.ClassChanged += () => + { + waiting = false; + }; + }); + WriteLine("First, select a class. A class will help define your personality within the multi-user domain. It'll determine the best legions for you."); + waiting = true; + while (waiting == true) + Thread.Sleep(25); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + }); + t.IsBackground = true; + t.Start(); + + TerminalBackend.PrefixEnabled = false; + } + + public class MCCInstallation : Applications.Installation + { + protected override void Run() + { + SetStatus("Beginning installation..."); + Thread.Sleep(1270); + SetProgress(10); + SetStatus("Installing base application..."); + for(int i = 0; i < 45; i++) + { + Thread.Sleep(25); + SetProgress(10 + i); + } + SetStatus("Configuring system..."); + //First, we initialize the user's legion value. + SaveSystem.CurrentSave.CurrentLegions = new List(); + Thread.Sleep(250); + SetProgress(65); + //Now we initialize their shop value. + SaveSystem.CurrentSave.MyShop = null; + Thread.Sleep(200); + SetProgress(75); + //Now for their reputation... + SaveSystem.CurrentSave.RawReputation = 0.000; + Thread.Sleep(250); + SetProgress(90); + //Now their class. + SaveSystem.CurrentSave.Class = Objects.UserClass.None; + Thread.Sleep(200); + Story.Start("mud_control_centre"); + SaveSystem.SaveGame(); + SetProgress(100); + } + } + } +} -- cgit v1.2.3 From 700a6a95cf2ca623aa6c0a780d2dc7003f4994f2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 19:33:34 -0400 Subject: Finish the MUD Control Centre story --- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 11 ++++++++ ShiftOS.WinForms/Stories/LegionStory.cs | 33 +++++++++++++++++++++++ ShiftOS_TheReturn/Commands.cs | 8 ++++-- 3 files changed, 50 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Stories') diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index 5a51f48..b8ba5f3 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -569,6 +569,8 @@ System version: {SaveSystem.CurrentSave.MajorVersion}.{SaveSystem.CurrentSave.Mi Shared scripts: {scripts} +Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation}) + Current legions: {legionname}"; } @@ -640,6 +642,11 @@ Current legions: {legionname}"; ServerManager.SendMessage("legion_get_all", ""); } + public void ShowLegionSelector() + { + ServerManager.SendMessage("legion_get_all", ""); + } + private void btnjoinlegion_Click(object sender, EventArgs e) { string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1); @@ -648,8 +655,12 @@ Current legions: {legionname}"; SaveSystem.SaveGame(); ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave)); + LegionChanged?.Invoke(); + } + public event Action LegionChanged; + private void btnleavelegion_Click(object sender, EventArgs e) { string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1); diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 424c54b..00c7544 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -122,6 +122,39 @@ namespace ShiftOS.WinForms.Stories waiting = true; while (waiting == true) Thread.Sleep(25); + WriteLine($"Your class has been selected. You are a(n) {SaveSystem.CurrentSave.Class}."); + WriteLine("On this screen, you can see a detailed view of your status within the digital society."); + WriteLine("You'll see this screen everytime you start the MUD Control Centre."); + WriteLine("Like the sos.status command, it shows your Codepoints, the upgrades you've bought and the upgrades available, but it also shows your reputation, legion, shops, and various other details."); + WriteLine("Right now, you are not in any legions. This is about to change."); + WriteLine("I will open the Legion Selector for you. The best legions will be shown at the top of the list."); + WriteLine("Pay attention to their Perdominent Class and their Collective Reputation values. These values will indicate how morally correct the legion is, and may affect your personal reputation."); + Desktop.InvokeOnWorkerThread(() => + { + mud.ShowLegionSelector(); + mud.LegionChanged += () => + { + waiting = false; + }; + }); + waiting = true; + while (waiting == true) + Thread.Sleep(25); + WriteLine($"So, you've joined the [{SaveSystem.CurrentSave.CurrentLegions[0]}] legion."); + WriteLine("Now you can see a more detailed view of the legion - who's inside, how many Codepoints the legion has, and you can also join their private chat."); + WriteLine("It's up to you what you do next. Get acquianted with your new team. I've gotta go work on something."); + WriteLine("I will contact you as you become more well-known."); + WriteLine("OH, one more thing."); + WriteLine("You're probably wondering about your reputation. Well, right now you have a Neutral reputation."); + WriteLine("This means, of course, that people don't have an opinion on you. They don't really know you exist."); + WriteLine("As you start performing large-scale operations within the digital society, your reputation will raise or lower gradually depending on how morally correct that action was."); + WriteLine("For example, if you start performing criminal actions, your reputation will start to drop, and people will start to distrust you."); + WriteLine("And if your rep drops too far, the MUD Safety Task Force, and other safety activists may start going after you and trying to take you off the MUD."); + WriteLine("However, if you perform morally-correct actions, your reputation will rise, and more people will trust you with more sensitive data and operations."); + WriteLine("Be careful though, if you have too high of a reputation, lower-rep groups will try to attack you."); + WriteLine("And, I'd be careful of Investigators. If they suspect anything bad about you, they'll do whatever they can to prove you guilty and dramatically decrease your reputation."); + WriteLine("Anyways, I've got some other sentiences I need to... have a little...word...with. Keep on shifting."); + WriteLine("--user has disconnected from your system.--", false); TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); }); diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 3cd1640..0257f11 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -480,11 +480,15 @@ namespace ShiftOS.Engine [Command("status")] public static bool Status() { - Console.WriteLine($@"ShiftOS version {Assembly.GetExecutingAssembly().GetName().Version.ToString()} + string status = $@"ShiftOS version {Assembly.GetExecutingAssembly().GetName().Version.ToString()} Codepoints: {SaveSystem.CurrentSave.Codepoints} Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, - {Shiftorium.GetAvailable().Length} available"); + {Shiftorium.GetAvailable().Length} available"; + + if (Shiftorium.UpgradeInstalled("mud_control_centre")) + status += Environment.NewLine + $"Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation})"; + Console.WriteLine(status); return true; } } -- cgit v1.2.3 From a9a9beaf63e5a8dc63e8ec8388373e3868d11cfb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 20:46:56 -0400 Subject: 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(-) (limited to 'ShiftOS.WinForms/Stories') 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; -- cgit v1.2.3 From e841b168e13e0bd699c0e0d19857167aa725f1ca Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 May 2017 16:59:54 -0400 Subject: stuff --- ShiftOS.WinForms/Applications/Chat.cs | 1 + ShiftOS.WinForms/Controls/TerminalBox.cs | 11 ++++--- ShiftOS.WinForms/Stories/LegionStory.cs | 9 +----- ShiftOS.WinForms/WinformsDesktop.cs | 49 ++++++++++++++++++-------------- ShiftOS_TheReturn/AppearanceManager.cs | 2 +- 5 files changed, 35 insertions(+), 37 deletions(-) (limited to 'ShiftOS.WinForms/Stories') diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index e150b1a..f9e601f 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -186,6 +186,7 @@ namespace ShiftOS.WinForms.Applications SendMessage(ch, ch, "A little birdie tells me you know about the RTS exploits going around... Try using that on Aiden's server. You can find his systemname on Appscape under \"Contact Us.\" He has a mailserver on Appscape - and also has RTS on the same server."); Thread.Sleep(2500); SendMessage(ch, ch, "Good luck... My life depends on you!"); + complete = true; }); t.IsBackground = true; t.Start(); diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index a6dd610..7658c8c 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -63,15 +63,12 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { - Thread.Sleep(5); - this.SuspendLayout(); this.HideSelection = true; this.SelectionFont = ConstructFont(); this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); this.AppendText(Localization.Parse(text)); this.HideSelection = false; - this.ResumeLayout(); } private Font ConstructFont() @@ -89,8 +86,6 @@ namespace ShiftOS.WinForms.Controls public void WriteLine(string text) { - Thread.Sleep(5); - this.SuspendLayout(); Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; this.Select(this.TextLength, 0); @@ -99,11 +94,12 @@ namespace ShiftOS.WinForms.Controls this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); this.AppendText(Localization.Parse(text) + Environment.NewLine); this.HideSelection = false; - this.ResumeLayout(); } bool quickCopying = false; + bool busy = false; + protected override void OnMouseDown(MouseEventArgs e) { //if right-clicking, then we initiate a quick-copy. @@ -255,8 +251,11 @@ namespace ShiftOS.WinForms.Controls } } + public string ThreadId = ""; + public TerminalBox() : base() { + ThreadId = Thread.CurrentThread.ManagedThreadId.ToString(); this.Tag = "keepbg keepfg keepfont"; } } diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 9b4966f..53d55fb 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -92,14 +92,7 @@ namespace ShiftOS.WinForms.Stories ConsoleEx.ForegroundColor = ConsoleColor.Gray; ConsoleEx.Bold = false; - foreach (var c in text) - { - Desktop.InvokeOnWorkerThread(() => - { - Console.Write(c); - }); - Thread.Sleep(75); - } + Console.WriteLine(text); Thread.Sleep(1000); } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 15ecb7a..6ce8cc9 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -188,14 +188,40 @@ namespace ShiftOS.WinForms widget.OnSkinLoad(); } + SetupDesktop(); }; + + long lastcp = 0; + + var storythread = new Thread(() => + { + do + { + if (SaveSystem.CurrentSave != null) + { + if (SaveSystem.CurrentSave.Codepoints != lastcp) + lastcp = SaveSystem.CurrentSave.Codepoints; + if (lastcp >= 10000) + { + if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) + { + Story.Start("victortran_shiftnet"); + } + } + } + } while (!SaveSystem.ShuttingDown); + }); + storythread.IsBackground = true; + storythread.Start(); + time.Tick += (o, a) => { if (Shiftorium.IsInitiated == true) { - if (SaveSystem.CurrentSave != null && TutorialManager.IsInTutorial == false) + if (SaveSystem.CurrentSave != null) { + lbtime.Text = Applications.Terminal.GetTime(); lbtime.Left = pnlnotifications.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; @@ -230,27 +256,6 @@ namespace ShiftOS.WinForms }; time.Start(); - var ssThread = new Thread(() => - { - while(this.Visible == true) - { - var mousePos = Cursor.Position; - while(Cursor.Position == mousePos) - { - if(millisecondsUntilScreensaver <= 0) - { - ShowScreensaver(); - } - millisecondsUntilScreensaver--; - Thread.Sleep(1); - } - millisecondsUntilScreensaver = 300000; - HideScreensaver(); - } - }); - ssThread.IsBackground = true; - ssThread.Start(); - this.DoubleBuffered = true; } diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 81858d3..7cf06c9 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -190,7 +190,7 @@ namespace ShiftOS.Engine ServerManager.Disconnect(); Desktop.InvokeOnWorkerThread(() => { - Environment.Exit(0); //bye bye + Process.GetCurrentProcess().Kill(); //bye bye }); } -- cgit v1.2.3 From c7ba7d733c756d196f98dd4533289a1ef4db715f Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Sun, 28 May 2017 14:44:08 -0400 Subject: un obsoleting --- ShiftOS.Server/Core.cs | 3 ++- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 16 ++++++++-------- ShiftOS.WinForms/Applications/Skin Loader.cs | 2 +- ShiftOS.WinForms/HackerCommands.cs | 8 ++++---- ShiftOS.WinForms/Oobe.cs | 2 +- ShiftOS.WinForms/Stories/LegionStory.cs | 2 +- ShiftOS_TheReturn/Commands.cs | 2 +- ShiftOS_TheReturn/Scripting.cs | 2 +- ShiftOS_TheReturn/ServerManager.cs | 4 ++-- ShiftOS_TheReturn/TerminalBackend.cs | 8 ++++---- 10 files changed, 25 insertions(+), 24 deletions(-) (limited to 'ShiftOS.WinForms/Stories') diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs index 7bb5b1d..a53a5bc 100644 --- a/ShiftOS.Server/Core.cs +++ b/ShiftOS.Server/Core.cs @@ -32,6 +32,7 @@ using NetSockets; using Newtonsoft.Json; using System.IO; using static ShiftOS.Server.Program; +using ShiftOS.Engine namespace ShiftOS.Server @@ -180,7 +181,7 @@ namespace ShiftOS.Server if (sve.EndsWith(".save")) { var save = JsonConvert.DeserializeObject(File.ReadAllText(sve)); - accs.Add($"{save.Username}@{save.SystemName}"); + accs.Add($"{ShiftOS.Engine.SaveSytem.CurrentUser.Username}@{save.SystemName}"); } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index ab89ffd..97212e7 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -100,7 +100,7 @@ namespace ShiftOS.WinForms.Applications { ServerManager.SendMessage("shop_removeowned", JsonConvert.SerializeObject(new { - username = SaveSystem.CurrentSave.Username + username = SaveSystem.CurrentUser.Username })); ShowCreateShop(); } @@ -290,7 +290,7 @@ namespace ShiftOS.WinForms.Applications creatingShop = true; editingShop.Name = "My shop"; editingShop.Description = "My shop has lots of awesome items. You should buy from my shop."; - editingShop.Owner = SaveSystem.CurrentSave.Username; + editingShop.Owner = SaveSystem.CurrentUser.Username; editingShop.Items = new List(); shop_editor.BringToFront(); PopulateShopEditor(); @@ -402,7 +402,7 @@ namespace ShiftOS.WinForms.Applications lbprice.Text = $"Cost: {item.Cost} CP"; btnbuy.Show(); }; - if(shop.Owner == SaveSystem.CurrentSave.Username) + if(shop.Owner == SaveSystem.CurrentUser.Username) { btneditshop.Show(); } @@ -560,7 +560,7 @@ namespace ShiftOS.WinForms.Applications you_systemstatus.BringToFront(); - lblsysstatus.Text = $@"Username: {SaveSystem.CurrentSave.Username} + lblsysstatus.Text = $@"Username: {SaveSystem.CurrentUser.Username} System name: {SaveSystem.CurrentSave.SystemName} Codepoints: {SaveSystem.CurrentSave.Codepoints} @@ -591,7 +591,7 @@ Current legions: {legionname}"; private void tsMemos_Click(object sender, EventArgs e) { ServerManager.SendMessage("get_memos_for_user", $@"{{ - username: ""{SaveSystem.CurrentSave.Username}"" + username: ""{SaveSystem.CurrentUser.Username}"" }}"); you_memos.BringToFront(); } @@ -812,7 +812,7 @@ Current legions: {legionname}"; { ServerManager.SendMessage("user_shop_check", JsonConvert.SerializeObject(new { - username = SaveSystem.CurrentSave.Username + username = SaveSystem.CurrentUser.Username })); } @@ -895,7 +895,7 @@ Current legions: {legionname}"; private void myShopToolStripMenuItem_Click(object sender, EventArgs e) { - ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentSave.Username); + ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentUser.Username); } private void btneditshop_Click(object sender, EventArgs e) @@ -923,7 +923,7 @@ Current legions: {legionname}"; { ServerManager.SendMessage("delete_save", JsonConvert.SerializeObject(new ClientSave { - Username = SaveSystem.CurrentSave.Username, + Username = SaveSystem.CurrentUser.Username, Password = SaveSystem.CurrentSave.Password })); diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index 90b05a1..e4f0597 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -306,7 +306,7 @@ namespace ShiftOS.WinForms.Applications System.IO.Directory.CreateDirectory(Paths.SharedFolder + "\\skins"); } - string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentSave.Username + "-" + fname; + string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentUser.Username + "-" + fname; System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(LoadedSkin)); }))); diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 86981f4..47b486d 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -107,7 +107,7 @@ namespace ShiftOS.WinForms Thread.Sleep(2000); writeSlow($"Hello there, fellow multi-user domain user."); writeSlow("My name, as you can tell, is hacker101."); - writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentSave.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?"); + writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentUser.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?"); writeSlow("Of course it is."); writeSlow("And I bet you 10,000 Codepoints that you have... " + SaveSystem.CurrentSave.Codepoints.ToString() + " Codepoints."); writeSlow("Oh, and how much upgrades have you installed since you first started using ShiftOS?"); @@ -135,7 +135,7 @@ namespace ShiftOS.WinForms Console.Write(" ..done"); TerminalBackend.InStory = false; TerminalBackend.PrefixEnabled = true; - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); StartHackerTutorial(); TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); @@ -454,7 +454,7 @@ namespace ShiftOS.WinForms var sve = JsonConvert.DeserializeObject(msg.Contents); if(sve.Password == pass) { - Console.WriteLine("Username: " + sve.Username); + Console.WriteLine("Username: " + SaveSystem.CurrentUser.Username); Console.WriteLine("Password: " + sve.Password); Console.WriteLine("System name: " + sve.SystemName); Console.WriteLine(); @@ -531,7 +531,7 @@ namespace ShiftOS.WinForms } sve.Codepoints -= amount; - SaveSystem.TransferCodepointsFrom(sve.Username, amount); + SaveSystem.TransferCodepointsFrom(SaveSystem.CurrentUser.Username, amount); ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); SaveSystem.SaveGame(); } diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 9182b4b..90395a7 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -302,7 +302,7 @@ namespace ShiftOS.WinForms var client = new UniteClient("http://getshiftos.ml", token); var sve = new Save(); - sve.Username = client.GetEmail(); + SaveSystem.CurrentUser.Username = client.GetEmail(); sve.Password = Guid.NewGuid().ToString(); sve.SystemName = client.GetSysName(); sve.UniteAuthToken = token; diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 53d55fb..433ad2d 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -142,7 +142,7 @@ namespace ShiftOS.WinForms.Stories { WriteLine("DevX@mud - user connecting to your system.", false); Thread.Sleep(2000); - WriteLine($"Hello, {SaveSystem.CurrentSave.Username}. It's been a while."); + WriteLine($"Hello, {SaveSystem.CurrentUser.Username}. It's been a while."); WriteLine("My intelligence suggests you've installed all GUI-based Shiftorium upgrades."); WriteLine("Bet you're liking ShiftOS now that the terminal isn't the only way you can control it."); WriteLine("Well, now it's time to introduce your next task."); diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 96e5af5..b97cd1d 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -95,7 +95,7 @@ namespace ShiftOS.Engine { TerminalBackend.IsForwardingConsoleWrites = forwarding; TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null; - Console.WriteLine($"{SaveSystem.CurrentSave.Username} says \"{result}\"."); + Console.WriteLine($"{SaveSystem.CurrentUser.Username} says \"{result}\"."); TerminalBackend.IsForwardingConsoleWrites = false; }; Desktop.InvokeOnWorkerThread(new Action(() => diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index dd5acfd..61c6676 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -312,7 +312,7 @@ end"); { Console.WriteLine(""); Lua(lua); - Console.WriteLine($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.WriteLine($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } catch (Exception e) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index f0acaa2..abb674d 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -148,7 +148,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms switch(msg.Name) { case "getguid_fromserver": - if(SaveSystem.CurrentSave.Username == msg.Contents) + if(SaveSystem.CurrentUser.Username == msg.Contents) { client.Send(new NetObject("yes_i_am", new ServerMessage { @@ -244,7 +244,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms else if(msg.Name == "update_your_cp") { var args = JsonConvert.DeserializeObject>(msg.Contents); - if(args["username"] as string == SaveSystem.CurrentSave.Username) + if(args["username"] as string == SaveSystem.CurrentUser.Username) { SaveSystem.CurrentSave.Codepoints += (long)args["amount"]; Desktop.InvokeOnWorkerThread(new Action(() => diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 1c024eb..6104927 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -581,7 +581,7 @@ namespace ShiftOS.Engine if (TerminalBackend.PrefixEnabled) { - text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); + text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); } IsForwardingConsoleWrites = true; if (TerminalBackend.InStory == false) @@ -590,7 +590,7 @@ namespace ShiftOS.Engine } if (TerminalBackend.PrefixEnabled) { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } IsForwardingConsoleWrites = false; } @@ -605,7 +605,7 @@ namespace ShiftOS.Engine string pass = a["password"] as string; string sys = a["sysname"] as string; string guid = msg.GUID; - if (SaveSystem.CurrentSave.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) + if (SaveSystem.CurrentUser.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) { ForwardGUID = guid; ServerManager.SendMessage("trm_handshake_accept", $@"{{ @@ -615,7 +615,7 @@ namespace ShiftOS.Engine IsForwardingConsoleWrites = true; InvokeCommand("sos.status"); - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); IsForwardingConsoleWrites = false; } } -- cgit v1.2.3