diff options
| author | Michael <[email protected]> | 2017-07-24 21:09:48 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-24 21:09:48 -0400 |
| commit | 2cd1452ff1dd9813cedb15ee18bf9a84e0baaf84 (patch) | |
| tree | 257a13c3c1ff5752d872a6da5292ab7f551f7699 /ShiftOS.Frontend | |
| parent | 5ab60d77068edce177841e94b8260e1a40231730 (diff) | |
| download | shiftos_thereturn-2cd1452ff1dd9813cedb15ee18bf9a84e0baaf84.tar.gz shiftos_thereturn-2cd1452ff1dd9813cedb15ee18bf9a84e0baaf84.tar.bz2 shiftos_thereturn-2cd1452ff1dd9813cedb15ee18bf9a84e0baaf84.zip | |
Fucking fuckrape the motherfucking winforms proj
Diffstat (limited to 'ShiftOS.Frontend')
| -rw-r--r-- | ShiftOS.Frontend/Apps/Terminal.cs | 19 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Infobox.cs | 10 | ||||
| -rw-r--r-- | ShiftOS.Frontend/MonoGameOOBE.cs | 150 | ||||
| -rw-r--r-- | ShiftOS.Frontend/ShiftOS.Frontend.csproj | 1 | ||||
| -rw-r--r-- | ShiftOS.Frontend/ShiftOS.cs | 3 |
5 files changed, 178 insertions, 5 deletions
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; + /// <summary> /// Gets the X and Y coordinates (in pixels) of the caret. /// </summary> @@ -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 @@ <Compile Include="HackerTestCommands.cs" /> <Compile Include="Infobox.cs" /> <Compile Include="MonoGameLanguageProvider.cs" /> + <Compile Include="MonoGameOOBE.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> 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 /// </summary> protected override void Initialize() { + OutOfBoxExperience.Init(new MonoGameOOBE()); + //Before we do ANYTHING, we've got to initiate the ShiftOS engine. UIManager.GraphicsDevice = GraphicsDevice.GraphicsDevice; |
