From cdb40b2b834429d2047d9b159a3a4a24c677ca73 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 25 Jul 2017 13:17:19 -0400 Subject: [PATCH] Working-ish out of box existential crisis --- .../GraphicsSubsystem/UIManager.cs | 4 +- ShiftOS.Frontend/MonoGameOOBE.cs | 128 +++++++++++++++++- ShiftOS_TheReturn.sln | 6 - ShiftOS_TheReturn/SaveSystem.cs | 3 +- 4 files changed, 131 insertions(+), 10 deletions(-) diff --git a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs index 4ec1292..b45b2ff 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs @@ -90,8 +90,8 @@ namespace ShiftOS.Frontend.GraphicsSubsystem { _target = new RenderTarget2D( graphics, - ctrl.Width, - ctrl.Height, + Math.Max(1,ctrl.Width), + Math.Max(1,ctrl.Height), false, graphics.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); diff --git a/ShiftOS.Frontend/MonoGameOOBE.cs b/ShiftOS.Frontend/MonoGameOOBE.cs index 4e6705d..e56f279 100644 --- a/ShiftOS.Frontend/MonoGameOOBE.cs +++ b/ShiftOS.Frontend/MonoGameOOBE.cs @@ -34,6 +34,8 @@ namespace ShiftOS.Frontend } private Apps.TerminalControl Console = null; + private GUI.ProgressBar progress = null; + private GUI.TextControl status = null; public void StartShowing(Save save) { @@ -125,7 +127,6 @@ It's called ShiftOS."); Thread.Sleep(5000); - GraphicsSubsystem.UIManager.StopHandling(term); while(AppearanceManager.OpenForms.Count > 0) { AppearanceManager.OpenForms[0].Close(); @@ -142,7 +143,132 @@ It's called ShiftOS."); _shiftos.Layout(new Microsoft.Xna.Framework.GameTime()); _shiftos.X = (GraphicsSubsystem.UIManager.Viewport.Width - _shiftos.Width) / 2; + status = new GUI.TextControl(); + GraphicsSubsystem.UIManager.AddTopLevel(status); + status.Font = SkinEngine.LoadedSkin.MainFont; + status.AutoSize = true; + status.Text = "Beginning installation..."; + status.Y = _shiftos.Y + _shiftos.Height + 5; + status.Layout(new Microsoft.Xna.Framework.GameTime()); + status.X = (GraphicsSubsystem.UIManager.Viewport.Width - status.Width) / 2; + progress = new GUI.ProgressBar(); + GraphicsSubsystem.UIManager.AddTopLevel(progress); + progress.Width = 150; + progress.Height = 10; + progress.Maximum = 250; + progress.Value = 0; + progress.Y = status.Y + status.Height + 15; + progress.X = (GraphicsSubsystem.UIManager.Viewport.Width - progress.Width) / 2; + + term.Clear(); + term.Width = 320; + term.Height = 200; + term.X = (GraphicsSubsystem.UIManager.Viewport.Width - term.Width) / 2; + term.Y = progress.Y + progress.Height + 15; + var nt = new Thread(() => + { + while(status != null) + { + try + { + if (term.Lines.Length > 0) + { + string txt = term.Lines[term.Lines.Length - 1]; + if (status.Text != txt + $" [{progress.Value}%]") + { + status.Text = txt + $" [{progress.Value}%]"; + status.Layout(new Microsoft.Xna.Framework.GameTime()); + status.X = (GraphicsSubsystem.UIManager.Viewport.Width - status.Width) / 2; + } + } + else + { + Thread.Sleep(10); + } + } + catch { } + } + }); + nt.Start(); + SlowWriteLine("Formatting storage device A with ShiftFS version 4.7..."); + + progress.Maximum = 100; + for (int i = 0; i < 100; i++) + { + progress.Value = i; + Thread.Sleep(25); + } + progress.Value = 0; + Console.WriteLine("Mounting storage device A to 0:/"); + Thread.Sleep(135); + Console.WriteLine("Writing system files & directories to sentience..."); + Thread.Sleep(450); + foreach (var dir in Paths.GetAllWithoutKey()) + { + try + { + if (dir.StartsWith("0:/")) + { + Console.WriteLine("Writing: " + dir); + Thread.Sleep(30); + } + } + catch { } + } + Thread.Sleep(1250); + Console.WriteLine("Generating system profile..."); + Thread.Sleep(25); + Console.WriteLine("Codepoints: 0"); + save.Codepoints = 0; + progress.Value = 10; + Thread.Sleep(25); + Console.WriteLine("Shiftorium cache generated..."); + save.Upgrades = new Dictionary(); + progress.Value = 20; + Console.WriteLine("Performing even more redundant tasks that have already been done for us by the backend because we're redundant programmers who don't know our own code... jesus christ this is a long string..."); + save.ID = Guid.NewGuid(); + save.IsSandbox = false; + save.Language = "english"; + save.MusicEnabled = true; + save.MusicVolume = 100; + save.PickupPoint = ""; + save.ShiftnetSubscription = 0; + save.SoundEnabled = true; + save.StoriesExperienced = new List(); + Thread.Sleep(2000); + Console.WriteLine("Far out. We haven't asked the user for a hostname."); + bool hostnameEntered = false; + Engine.Infobox.PromptText("Enter system hostname", "You need a hostname to exist within the Digital Society. Your hostname allows other sentiences to interact with you. Please enter one.", (hostname) => + { + hostnameEntered = true; + save.SystemName = hostname; + }); + int ticks = 0; + while(hostnameEntered == false) + { + Thread.Sleep(10); + ticks++; + if(ticks == 1000) + { + Console.WriteLine(" [growls] COME ON. THE BOX IS RIGHT THERE. PICK A DARN HOSTNAME ALREADY."); + } + if(ticks == 1250) + { + Console.WriteLine(" [screaming expletives] WHAT ARE YOU WAITING FOR? WHAT DO YOU WANT?"); + } + if(ticks == 1500) + { + Console.WriteLine(" [someone pissed in its cereal] For crying out loud I'm about ready to default you to localhost and prevent you from accessing the Digital Society."); + } + } + progress.Value = 100; + save.ViralInfections = new List(); + Console.WriteLine(" Setup complete. You're ready."); + Thread.Sleep(500); + save.StoryPosition = 123456789; //HERE. YOU DO THE MATH. + SaveSystem.CurrentSave = save; + SaveSystem.SaveGame(); }); t.Start(); } diff --git a/ShiftOS_TheReturn.sln b/ShiftOS_TheReturn.sln index c849ba1..a3c1adb 100644 --- a/ShiftOS_TheReturn.sln +++ b/ShiftOS_TheReturn.sln @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Engine", "ShiftOS_T EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Objects", "ShiftOS.Objects\ShiftOS.Objects.csproj", "{A069089A-8962-4607-B2B2-4CF4A371066E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Updater", "ShiftOS.Updater\ShiftOS.Updater.csproj", "{36BC512F-6FD4-4139-AED7-565FC8D5BCBC}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Frontend", "ShiftOS.Frontend\ShiftOS.Frontend.csproj", "{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}" EndProject Global @@ -25,10 +23,6 @@ Global {A069089A-8962-4607-B2B2-4CF4A371066E}.Debug|Any CPU.Build.0 = Debug|Any CPU {A069089A-8962-4607-B2B2-4CF4A371066E}.Release|Any CPU.ActiveCfg = Release|Any CPU {A069089A-8962-4607-B2B2-4CF4A371066E}.Release|Any CPU.Build.0 = Release|Any CPU - {36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Release|Any CPU.Build.0 = Release|Any CPU {4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 99d1868..f72c95b 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -329,7 +329,8 @@ namespace ShiftOS.Engine goto Sysname; } - + //why the fuck is it crashing here of all places + //fucking fuckdrunk Console.WriteLine($@" `-:/++++::.` .+ydNMMMMMNNMMMMMNhs/.