From fc471fdac25bdc0fe7f889552ecd889e2f28724f Mon Sep 17 00:00:00 2001 From: lempamo Date: Sun, 11 Jun 2017 10:15:33 -0400 Subject: i srsly thought i commited this >:( --- .../OS/Win2K/Win2KApps/SurviveTheDay.Designer.cs | 85 ++++++++++----------- TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.cs | 86 +++++++++++++++++++++- 2 files changed, 124 insertions(+), 47 deletions(-) (limited to 'TimeHACK.Main/OS/Win2K') diff --git a/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.Designer.cs b/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.Designer.cs index 4ecfac0..e580b9c 100644 --- a/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.Designer.cs +++ b/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.words = new System.Windows.Forms.Label(); this.time = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); @@ -35,17 +36,17 @@ this.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); - this.button6 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); + this.gameoverlbl = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); this.SuspendLayout(); // // words // this.words.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.words.ForeColor = System.Drawing.Color.White; - this.words.Location = new System.Drawing.Point(35, 40); + this.words.Location = new System.Drawing.Point(35, 35); this.words.Name = "words"; - this.words.Size = new System.Drawing.Size(553, 100); + this.words.Size = new System.Drawing.Size(568, 149); this.words.TabIndex = 2; this.words.Text = "Welcome to Survive The Day.\r\nYour goal is simple.\r\nMake it from 4 AM to midnight " + "without dying.\r\nThe time will be displayed in the bottom right corner.\r\nGood luc" + @@ -53,112 +54,107 @@ // // time // - this.time.AutoSize = true; this.time.Font = new System.Drawing.Font("Courier New", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.time.ForeColor = System.Drawing.Color.Red; - this.time.Location = new System.Drawing.Point(514, 408); + this.time.Location = new System.Drawing.Point(514, 409); this.time.Name = "time"; this.time.Size = new System.Drawing.Size(89, 19); this.time.TabIndex = 3; this.time.Text = "--:-- --"; - this.time.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.time.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // button1 // this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.Font = new System.Drawing.Font("Courier New", 12F); this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(35, 191); + this.button1.Location = new System.Drawing.Point(35, 227); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(553, 28); + this.button1.Size = new System.Drawing.Size(568, 28); this.button1.TabIndex = 4; + this.button1.Tag = "start"; this.button1.Text = "Play"; this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.choice_click); // // button2 // this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button2.Font = new System.Drawing.Font("Courier New", 12F); this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(35, 225); + this.button2.Location = new System.Drawing.Point(35, 261); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(553, 28); + this.button2.Size = new System.Drawing.Size(568, 28); this.button2.TabIndex = 5; this.button2.Text = "--"; this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button2.UseVisualStyleBackColor = true; + this.button2.Visible = false; + this.button2.Click += new System.EventHandler(this.choice_click); // // button3 // this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button3.Font = new System.Drawing.Font("Courier New", 12F); this.button3.ForeColor = System.Drawing.Color.White; - this.button3.Location = new System.Drawing.Point(35, 259); + this.button3.Location = new System.Drawing.Point(35, 295); this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(553, 28); + this.button3.Size = new System.Drawing.Size(568, 28); this.button3.TabIndex = 6; this.button3.Text = "--"; this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button3.UseVisualStyleBackColor = true; + this.button3.Visible = false; + this.button3.Click += new System.EventHandler(this.choice_click); // // button4 // this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button4.Font = new System.Drawing.Font("Courier New", 12F); this.button4.ForeColor = System.Drawing.Color.White; - this.button4.Location = new System.Drawing.Point(35, 293); + this.button4.Location = new System.Drawing.Point(35, 329); this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(553, 28); + this.button4.Size = new System.Drawing.Size(568, 28); this.button4.TabIndex = 7; this.button4.Text = "--"; this.button4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button4.UseVisualStyleBackColor = true; + this.button4.Visible = false; + this.button4.Click += new System.EventHandler(this.choice_click); // // button5 // this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button5.Font = new System.Drawing.Font("Courier New", 12F); this.button5.ForeColor = System.Drawing.Color.White; - this.button5.Location = new System.Drawing.Point(35, 327); + this.button5.Location = new System.Drawing.Point(35, 363); this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(553, 28); + this.button5.Size = new System.Drawing.Size(568, 28); this.button5.TabIndex = 8; this.button5.Text = "--"; this.button5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button5.UseVisualStyleBackColor = true; + this.button5.Visible = false; + this.button5.Click += new System.EventHandler(this.choice_click); // - // button6 - // - this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button6.Font = new System.Drawing.Font("Courier New", 12F); - this.button6.ForeColor = System.Drawing.Color.White; - this.button6.Location = new System.Drawing.Point(35, 361); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(553, 28); - this.button6.TabIndex = 9; - this.button6.Text = "--"; - this.button6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button6.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold); - this.label1.ForeColor = System.Drawing.Color.Red; - this.label1.Location = new System.Drawing.Point(35, 144); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(498, 18); - this.label1.TabIndex = 10; - this.label1.Text = "GAME OVER: No death, this shouldn\'t show in game!"; + // gameoverlbl + // + this.gameoverlbl.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold); + this.gameoverlbl.ForeColor = System.Drawing.Color.Red; + this.gameoverlbl.Location = new System.Drawing.Point(35, 192); + this.gameoverlbl.Name = "gameoverlbl"; + this.gameoverlbl.Size = new System.Drawing.Size(568, 21); + this.gameoverlbl.TabIndex = 10; + this.gameoverlbl.Text = "GAME OVER: No death, this shouldn\'t show in game!"; + this.gameoverlbl.Visible = false; // // SurviveTheDay // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; - this.Controls.Add(this.label1); - this.Controls.Add(this.button6); + this.Controls.Add(this.gameoverlbl); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.button3); @@ -169,7 +165,6 @@ this.Name = "SurviveTheDay"; this.Size = new System.Drawing.Size(635, 459); this.ResumeLayout(false); - this.PerformLayout(); } @@ -181,7 +176,7 @@ private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; - private System.Windows.Forms.Button button6; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label gameoverlbl; + private System.Windows.Forms.Timer timer1; } } diff --git a/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.cs b/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.cs index 7140e7d..f4b199f 100644 --- a/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.cs +++ b/TimeHACK.Main/OS/Win2K/Win2KApps/SurviveTheDay.cs @@ -7,6 +7,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Media; +using System.Threading; +using Newtonsoft.Json.Linq; namespace TimeHACK.OS.Win2K.Win2KApps { @@ -17,9 +20,88 @@ namespace TimeHACK.OS.Win2K.Win2KApps InitializeComponent(); } - private void typer(string newtxt) + private void typer(string newtxt, string overtxt, bool over) { - words.Text = ""; + SoundPlayer beep = new SoundPlayer(Properties.Resources.std_beep); + SoundPlayer overbeep = new SoundPlayer(Properties.Resources.std_gobeep); + this.Invoke(new Action(() => + { + words.Text = ""; + gameoverlbl.Text = ""; + gameoverlbl.Show(); + })); + + foreach (char c in newtxt) + { + this.Invoke(new Action(() => + { + words.Text += c; + })); + beep.Play(); + Thread.Sleep(40); + } + + if (over) + { + Thread.Sleep(200); + foreach (char c in overtxt) + { + this.Invoke(new Action(() => + { + gameoverlbl.Text += c; + })); + overbeep.Play(); + Thread.Sleep(150); + } + } + this.Invoke(new Action(() => + { + if ((string)button1.Tag != "") button1.Show(); + if ((string)button2.Tag != "") button2.Show(); + if ((string)button3.Tag != "") button3.Show(); + if ((string)button4.Tag != "") button4.Show(); + if ((string)button5.Tag != "") button5.Show(); + })); + } + + private void choice_click(object sender, EventArgs e) + { + Button btn = sender as Button; + + if (btn.Tag == null | (string)btn.Tag == "") return; + if ((string)btn.Tag == "quit") + { + this.ParentForm.Close(); + return; + } + + JObject story = JObject.Parse(Properties.Resources.std_story); + JToken path = story[(string)btn.Tag]; + + button1.Text = (string)path["btn1txt"]; + button1.Tag = (string)path["btn1tag"]; + button1.Hide(); + button2.Text = (string)path["btn2txt"]; + button2.Tag = (string)path["btn2tag"]; + button2.Hide(); + button3.Text = (string)path["btn3txt"]; + button3.Tag = (string)path["btn3tag"]; + button3.Hide(); + button4.Text = (string)path["btn4txt"]; + button4.Tag = (string)path["btn4tag"]; + button4.Hide(); + button5.Text = (string)path["btn5txt"]; + button5.Tag = (string)path["btn5tag"]; + button5.Hide(); + + time.Text = (string)path["time"]; + + var t = new Thread(new ThreadStart(() => + { + typer((string)path["txt"], (string)path["overtxt"], (bool)path["over"]); + })); + t.IsBackground = true; + t.Start(); } } } -- cgit v1.2.3