diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.Designer.cs b/ShiftOS.WinForms/Applications/ShiftLetters.Designer.cs new file mode 100644 index 0000000..c0c70d3 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ShiftLetters.Designer.cs @@ -0,0 +1,122 @@ +/* + * MIT License + * + * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +namespace ShiftOS.WinForms.Applications +{ + partial class ShiftLetters + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblword = new System.Windows.Forms.Label(); + this.tbguess = new System.Windows.Forms.TextBox(); + this.lbllives = new System.Windows.Forms.Label(); + this.btnrestart = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lblword + // + this.lblword.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.lblword.AutoSize = true; + this.lblword.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.lblword.Location = new System.Drawing.Point(127, 31); + this.lblword.Name = "lblword"; + this.lblword.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.lblword.Size = new System.Drawing.Size(72, 18); + this.lblword.TabIndex = 1; + this.lblword.Text = "Loading..."; + // + // tbguess + // + this.tbguess.Location = new System.Drawing.Point(147, 108); + this.tbguess.Name = "tbguess"; + this.tbguess.Size = new System.Drawing.Size(22, 20); + this.tbguess.TabIndex = 2; + this.tbguess.TextChanged += new System.EventHandler(this.tbguess_TextChanged); + // + // lbllives + // + this.lbllives.AutoSize = true; + this.lbllives.Location = new System.Drawing.Point(127, 190); + this.lbllives.Name = "lbllives"; + this.lbllives.Size = new System.Drawing.Size(69, 13); + this.lbllives.TabIndex = 3; + this.lbllives.Text = "Still loading..."; + // + // btnrestart + // + this.btnrestart.Location = new System.Drawing.Point(130, 148); + this.btnrestart.Name = "btnrestart"; + this.btnrestart.Size = new System.Drawing.Size(75, 23); + this.btnrestart.TabIndex = 4; + this.btnrestart.Text = "Restart"; + this.btnrestart.UseVisualStyleBackColor = true; + this.btnrestart.Visible = false; + this.btnrestart.Click += new System.EventHandler(this.btnrestart_Click); + // + // ShiftLetters + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnrestart); + this.Controls.Add(this.lbllives); + this.Controls.Add(this.tbguess); + this.Controls.Add(this.lblword); + this.Name = "ShiftLetters"; + this.Size = new System.Drawing.Size(333, 256); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Label lblword; + private System.Windows.Forms.TextBox tbguess; + private System.Windows.Forms.Label lbllives; + private System.Windows.Forms.Button btnrestart; + } +} diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs new file mode 100644 index 0000000..6e6a43e --- /dev/null +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -0,0 +1,146 @@ +/* + * MIT License + * + * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using Newtonsoft.Json; +using ShiftOS.Engine; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.WinForms.Applications +{ + [Launcher("ShiftLetters", false, null, "Games")] + [RequiresUpgrade("shiftletters")] + [WinOpen("shiftletters")] + public partial class ShiftLetters : UserControl, IShiftOSWindow + { + int lives = 7; + string word = ""; + static Random rng = new Random(); + + public ShiftLetters() + { + InitializeComponent(); + } + + private void StartGame() + { + lives = 7; + tbguess.Visible = true; + lbllives.Visible = true; + lblword.Visible = true; + btnrestart.Visible = false; + var wordlist = new List + { + "shiftos", + "devx", + "delicious", + "shifter", + "pong", + "shiftorium", + "codepoints" + }; + word = wordlist[rng.Next(wordlist.Count)]; + lbllives.Text = "You have 7 lives left!"; + lblword.Text = ""; + for (int i=0; i 0) + { + char[] letters = lblword.Text.ToCharArray(); + correct = true; + letters[i * 2] = System.Convert.ToChar(charGuessed); + lblword.Text = string.Join("", letters); + if (!lblword.Text.Contains("_")) + { + int oldlives = lives; + tbguess.Visible = false; + lives = 0; + lbllives.Visible = true; + btnrestart.Visible = true; + int cp = word.Length * 2; + cp = cp * oldlives; + lbllives.Text = "You earned: " + cp + " codepoints!"; + } + } + } + if (correct == false & lives > 0) + { + lives--; + lbllives.Text = "You have: " + lives + " lives left!"; + if (lives == 0) + { + tbguess.Visible = false; + lbllives.Visible = false; + btnrestart.Visible = true; + } + } + } + } + + private void btnrestart_Click(object sender, EventArgs e) + { + StartGame(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.resx b/ShiftOS.WinForms/Applications/ShiftLetters.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ShiftLetters.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index f2cd046..8472f1d 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License * * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs @@ -914,14 +914,16 @@ namespace ShiftOS.WinForms.Properties { /// Dependencies: null /// }, /// { - /// Name: "Audio Volume", - /// Cost: 50, - /// Description: "Want to adjust the volume of ShiftOS's audio? This upgrade will let you." + /// Name: "AL Notifications", + /// Cost: 125, + /// Dependencies: "app_launcher", + /// Description: "Want to open the Notifications application from within the App Launcher? This upgrade is for you." /// }, /// { - /// Name: "Color Depth Dithering", - /// Cost: 1000, - /// Description: "Right now, if you try to display images on the screen, with a low color depth like we have, the image will be totally unrecogn [rest of string was truncated]";. + /// Name: "Guess the Word", + /// Cost: 150, + /// Dependencies: null, + /// Description: "Sick and tired of playing Pong? Buy this upgrade [rest of string was truncated]";. /// internal static string Shiftorium { get { diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 9c116be..c75372e 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -11,6 +11,18 @@ Dependencies: "app_launcher", Description: "Want to open the Notifications application from within the App Launcher? This upgrade is for you." }, + { + Name: "ShiftLetters", + Cost: 150, + Dependencies: null, + Description: "Sick and tired of playing Pong? Buy this upgrade to get a whole new game!" + }, + { + Name: "AL ShiftLetters", + Cost: 100, + Dependencies: "app_launcher;shiftletters", + Description: "This upgrade allows you to find ShiftLetters in your App Launcher." + }, { Name: "Panel Notifications", Cost: 150, @@ -19,7 +31,7 @@ }, { Name: "Audio Volume", - Cost: 50, + Cost: 80, Description: "Want to adjust the volume of ShiftOS's audio? This upgrade will let you." }, { diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 45c1a47..dac8c73 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -112,6 +112,12 @@ GraphicPicker.cs + + UserControl + + + ShiftLetters.cs + UserControl @@ -268,6 +274,9 @@ GraphicPicker.cs + + ShiftLetters.cs + MUDControlCentre.cs