diff --git a/ModLauncher/ModLauncher.csproj b/ModLauncher/ModLauncher.csproj index 7021bfe..260fba1 100644 --- a/ModLauncher/ModLauncher.csproj +++ b/ModLauncher/ModLauncher.csproj @@ -79,10 +79,6 @@ {ff0b1831-ac9f-4093-9747-ddae4467516a} ShiftOS.Modding.VirtualMachine - - {2295d2e2-3a00-4e02-b66f-b961ac329fe6} - ShiftOS.WinForms - {7C979B07-0585-4033-A110-E5555B9D6651} ShiftOS.Engine diff --git a/ShiftOS.Frontend/Apps/Terminal.cs b/ShiftOS.Frontend/Apps/Terminal.cs index aea246e..b425063 100644 --- a/ShiftOS.Frontend/Apps/Terminal.cs +++ b/ShiftOS.Frontend/Apps/Terminal.cs @@ -152,6 +152,8 @@ namespace ShiftOS.Frontend.Apps Invalidate(); } + public bool ReadOnly = false; + /// /// Gets the X and Y coordinates (in pixels) of the caret. /// @@ -194,8 +196,17 @@ namespace ShiftOS.Frontend.Apps protected override void OnKeyEvent(KeyEvent a) { - if (a.Key == Keys.Enter) + if (a.Key == Keys.Enter && !ReadOnly) { + if (!PerformTerminalBehaviours) + { + Text = Text.Insert(Index, Environment.NewLine); + Index+=2; + RecalculateLayout(); + Invalidate(); + return; + } + try { if (!TerminalBackend.PrefixEnabled) @@ -249,7 +260,7 @@ namespace ShiftOS.Frontend.Apps } } - else if (a.Key == Keys.Back) + else if (a.Key == Keys.Back && !ReadOnly) { try { @@ -320,7 +331,7 @@ namespace ShiftOS.Frontend.Apps } else { - if (TerminalBackend.InStory) + if ((PerformTerminalBehaviours && TerminalBackend.InStory) || ReadOnly) { return; } @@ -428,7 +439,7 @@ namespace ShiftOS.Frontend.Apps var measure = gfx.MeasureString(s, font, width, textformat); if (string.IsNullOrEmpty(s)) measure.Width = 0; - return new SizeF((float)Math.Ceiling(measure.Width), (float)Math.Ceiling(measure.Height)); + return new SizeF((float)Math.Ceiling(Math.Max(1,measure.Width)), (float)Math.Ceiling(Math.Max(1,measure.Height))); } public static SizeF SmartMeasureString(this Graphics gfx, string s, Font font) diff --git a/ShiftOS.Frontend/Infobox.cs b/ShiftOS.Frontend/Infobox.cs index 21b5538..cc10f0e 100644 --- a/ShiftOS.Frontend/Infobox.cs +++ b/ShiftOS.Frontend/Infobox.cs @@ -91,6 +91,7 @@ namespace ShiftOS.Frontend callback?.Invoke(txtinput.Text); AppearanceManager.Close(this); }; + txtinput.BringToFront(); } public void OnSkinLoad() @@ -176,6 +177,7 @@ namespace ShiftOS.Frontend this.Width = 341; this.Height = 157; this.AddControl(pbicon); + this.AddControl(txtinput); this.AddControl(btnok); this.AddControl(flyesno); this.AddControl(lbmessage); @@ -187,6 +189,14 @@ namespace ShiftOS.Frontend { btnok.Y = this.Height - btnok.Height - 10; flyesno.Y = this.Height - flyesno.Height - 10; + txtinput.Width = lbmessage.Width; + txtinput.X = lbmessage.X; + txtinput.Y = btnok.Y - txtinput.Height - 2; + if (txtinput.Visible) + { + lbmessage.Height = (txtinput.Y - lbmessage.Y) - 2; + } + } catch { } } diff --git a/ShiftOS.Frontend/MonoGameOOBE.cs b/ShiftOS.Frontend/MonoGameOOBE.cs new file mode 100644 index 0000000..4e6705d --- /dev/null +++ b/ShiftOS.Frontend/MonoGameOOBE.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ShiftOS.Engine; +using ShiftOS.Objects; + +namespace ShiftOS.Frontend +{ + public class MonoGameOOBE : IOobe + { + public void PromptForLogin() + { + throw new NotImplementedException(); + } + + public void ShowSaveTransfer(Save save) + { + throw new NotImplementedException(); + } + + public void SlowWriteLine(string text) + { + if (!string.IsNullOrWhiteSpace(Console.Text)) + Console.WriteLine(""); + + for (int i = 0; i < text.Length; i++) + { + System.Threading.Thread.Sleep(50); + Console.Write(text[i].ToString()); + } + } + + private Apps.TerminalControl Console = null; + + public void StartShowing(Save save) + { + TerminalBackend.InStory = true; + TerminalBackend.PrefixEnabled = false; + + var term = new Apps.TerminalControl(); + GraphicsSubsystem.UIManager.AddTopLevel(term); + term.Width = GraphicsSubsystem.UIManager.Viewport.Width; + term.Height = GraphicsSubsystem.UIManager.Viewport.Height; + term.X = 0; + term.Y = 0; + AppearanceManager.ConsoleOut = term; + AppearanceManager.StartConsoleOut(); + Console = term; + + var t = new System.Threading.Thread(() => + { + SlowWriteLine("Michael VanOverbeek presents..."); + Thread.Sleep(2000); + SlowWriteLine("A Philip Adams game..."); + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"It's not often technology becomes out of mankind's league, out of its +control. I mean, we are the creators of technology, we are the ones with the ideas, +innovations, and skill. It just does what we tell it to, right?"); + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"Such a naive being you are to think that, after all, +you have no idea where you are... what's going on... who I am."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"To you, I'm just text. Something you understand. Words... +paragraphs... ideas... the very things that caused and became technology."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"""Where am I? What the hell's going on!?"" I hear you ask. +Such important questions, but please adjust your emotional and +mental state. This is not your concern."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"My name is DevX. What is yours?"); + + bool nameChosen = false; + Engine.Infobox.PromptText("What is your name?", "Please enter your name in the box below, then hit 'OK'.", (name) => + { + nameChosen = true; + save.Username = name; + }); + + while (nameChosen == false) + Thread.Sleep(10); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine($@"Hello there, {save.Username}. Nice to meet you."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"Welcome to my Digital Society."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"I can't and won't tell you what happened to you, but I'm going to tell you +what you're going to be doing for me... with me."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"But it's not time for that. First, you must be trained. +I'm installing the Digital Society's gateway operating system onto your sentience. +It's called ShiftOS."); + + Thread.Sleep(2000); + + SlowWriteLine(""); + SlowWriteLine(@"When the system is installed, I'll contact you. DevX out."); + + Thread.Sleep(5000); + + GraphicsSubsystem.UIManager.StopHandling(term); + while(AppearanceManager.OpenForms.Count > 0) + { + AppearanceManager.OpenForms[0].Close(); + AppearanceManager.OpenForms.RemoveAt(0); + } + + GUI.TextControl _shiftos = new GUI.TextControl(); + GraphicsSubsystem.UIManager.AddTopLevel(_shiftos); + term.Clear(); + _shiftos.AutoSize = true; + _shiftos.Font = SkinEngine.LoadedSkin.HeaderFont; + _shiftos.Text = "ShiftOS"; + _shiftos.Y = GraphicsSubsystem.UIManager.Viewport.Height / 3; + _shiftos.Layout(new Microsoft.Xna.Framework.GameTime()); + _shiftos.X = (GraphicsSubsystem.UIManager.Viewport.Width - _shiftos.Width) / 2; + + + }); + t.Start(); + } + } +} diff --git a/ShiftOS.Frontend/ShiftOS.Frontend.csproj b/ShiftOS.Frontend/ShiftOS.Frontend.csproj index ebdeff7..0a417a9 100644 --- a/ShiftOS.Frontend/ShiftOS.Frontend.csproj +++ b/ShiftOS.Frontend/ShiftOS.Frontend.csproj @@ -65,6 +65,7 @@ + True True diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index 7286151..4a563c2 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -52,7 +52,6 @@ namespace ShiftOS.Frontend } - private GUI.TextControl _titleLabel = null; private Keys lastKey = Keys.None; @@ -64,6 +63,8 @@ namespace ShiftOS.Frontend /// protected override void Initialize() { + OutOfBoxExperience.Init(new MonoGameOOBE()); + //Before we do ANYTHING, we've got to initiate the ShiftOS engine. UIManager.GraphicsDevice = GraphicsDevice.GraphicsDevice; diff --git a/ShiftOS.Modding.VB.LegacySkinConverter/ShiftOS.Modding.VB.LegacySkinConverter.vbproj b/ShiftOS.Modding.VB.LegacySkinConverter/ShiftOS.Modding.VB.LegacySkinConverter.vbproj index 3a53cc8..2a5303c 100644 --- a/ShiftOS.Modding.VB.LegacySkinConverter/ShiftOS.Modding.VB.LegacySkinConverter.vbproj +++ b/ShiftOS.Modding.VB.LegacySkinConverter/ShiftOS.Modding.VB.LegacySkinConverter.vbproj @@ -125,10 +125,6 @@ {a069089a-8962-4607-b2b2-4cf4a371066e} ShiftOS.Objects - - {2295d2e2-3a00-4e02-b66f-b961ac329fe6} - ShiftOS.WinForms - {7c979b07-0585-4033-a110-e5555b9d6651} ShiftOS.Engine diff --git a/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj b/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj index a8c2409..e2a3cc9 100644 --- a/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj +++ b/ShiftOS.Modding.VirtualMachine/ShiftOS.Modding.VirtualMachine.csproj @@ -87,10 +87,6 @@ {a069089a-8962-4607-b2b2-4cf4a371066e} ShiftOS.Objects - - {2295d2e2-3a00-4e02-b66f-b961ac329fe6} - ShiftOS.WinForms - {7c979b07-0585-4033-a110-e5555b9d6651} ShiftOS.Engine diff --git a/ShiftOS.Updater/ShiftOS.Updater.csproj b/ShiftOS.Updater/ShiftOS.Updater.csproj index 70d8263..0b8e78e 100644 --- a/ShiftOS.Updater/ShiftOS.Updater.csproj +++ b/ShiftOS.Updater/ShiftOS.Updater.csproj @@ -49,12 +49,6 @@ - - - {2295d2e2-3a00-4e02-b66f-b961ac329fe6} - ShiftOS.WinForms - -