diff options
| author | lempamo <[email protected]> | 2017-08-23 13:38:40 -0400 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-08-23 13:38:40 -0400 |
| commit | 3306d36ecbc024775972e5cf7971b2a7a70671d0 (patch) | |
| tree | 0a79e67b6723a8c75ffd66c7828bdd0ebb1bf74d /Histacom2/OS/Win2K/Win2KApps/SurviveTheDay.cs | |
| parent | 99fef5c57360f07259fc86f433bed8a9ab59c48e (diff) | |
| download | histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.tar.gz histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.tar.bz2 histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.zip | |
Renaming the game!
Diffstat (limited to 'Histacom2/OS/Win2K/Win2KApps/SurviveTheDay.cs')
| -rw-r--r-- | Histacom2/OS/Win2K/Win2KApps/SurviveTheDay.cs | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/Histacom2/OS/Win2K/Win2KApps/SurviveTheDay.cs b/Histacom2/OS/Win2K/Win2KApps/SurviveTheDay.cs new file mode 100644 index 0000000..89fc446 --- /dev/null +++ b/Histacom2/OS/Win2K/Win2KApps/SurviveTheDay.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +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 Histacom2.OS.Win2K.Win2KApps +{ + public partial class SurviveTheDay : UserControl + { + public SurviveTheDay() + { + InitializeComponent(); + } + + private void typer(string newtxt, string overtxt, bool over) + { + 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(); + } + } +} |
