Added custom wordlist feature to shiftletters

This commit is contained in:
lempamo 2017-02-25 20:28:58 -05:00
parent f51200b5d7
commit b2bd8eb462
4 changed files with 66 additions and 38 deletions

View file

@ -56,19 +56,20 @@ namespace ShiftOS.WinForms.Applications
this.tbguess = new System.Windows.Forms.TextBox();
this.lbllives = new System.Windows.Forms.Label();
this.btnrestart = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
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", 13F);
this.lblword.Location = new System.Drawing.Point(116, 34);
this.lblword.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F);
this.lblword.Location = new System.Drawing.Point(5, 41);
this.lblword.Name = "lblword";
this.lblword.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lblword.Size = new System.Drawing.Size(89, 22);
this.lblword.Size = new System.Drawing.Size(302, 22);
this.lblword.TabIndex = 1;
this.lblword.Text = "Loading...";
this.lblword.Text = "Choose a wordlist from the box below.";
this.lblword.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tbguess
//
@ -80,28 +81,37 @@ namespace ShiftOS.WinForms.Applications
//
// lbllives
//
this.lbllives.AutoSize = true;
this.lbllives.Location = new System.Drawing.Point(127, 190);
this.lbllives.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lbllives.Location = new System.Drawing.Point(9, 201);
this.lbllives.Name = "lbllives";
this.lbllives.Size = new System.Drawing.Size(69, 13);
this.lbllives.TabIndex = 3;
this.lbllives.Text = "Still loading...";
this.lbllives.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnrestart
//
this.btnrestart.Location = new System.Drawing.Point(130, 148);
this.btnrestart.Location = new System.Drawing.Point(121, 148);
this.btnrestart.Name = "btnrestart";
this.btnrestart.Size = new System.Drawing.Size(75, 23);
this.btnrestart.TabIndex = 4;
this.btnrestart.Text = "Restart";
this.btnrestart.Text = "Play";
this.btnrestart.UseVisualStyleBackColor = true;
this.btnrestart.Visible = false;
this.btnrestart.Click += new System.EventHandler(this.btnrestart_Click);
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(99, 81);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 5;
//
// ShiftLetters
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.btnrestart);
this.Controls.Add(this.lbllives);
this.Controls.Add(this.tbguess);
@ -118,5 +128,6 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.TextBox tbguess;
private System.Windows.Forms.Label lbllives;
private System.Windows.Forms.Button btnrestart;
private System.Windows.Forms.ComboBox comboBox1;
}
}

View file

@ -46,6 +46,11 @@ namespace ShiftOS.WinForms.Applications
string word = "";
static Random rng = new Random();
string guessedCharacters = "";
List<String> shiftWordlist = new List<string> { "shiftos", "devx", "artpad", "shifter", "pong",
"shiftorium", "codepoints", "shiftletters", "shops", "mud", "notification", "namechanger",
"skinning", "skinloader", "calculator", "fileskimmer", "lua", "shiftnet", "terminal", "textpad"};
List<String> contributorsWordlist = new List<string> { "12padams", "carverh", "computelinux", "lempamo",
"wowmom98", "michaeltheshifter", "arencclc", "therandommelon", "pfg", "craftxbox"};
public ShiftLetters()
{
@ -56,34 +61,14 @@ namespace ShiftOS.WinForms.Applications
{
guessedCharacters = "";
lives = 7;
comboBox1.Visible = false;
tbguess.Visible = true;
lbllives.Visible = true;
lblword.Visible = true;
btnrestart.Visible = false;
var wordlist = new List<string>
{
"shiftos",
"devx",
"artpad",
"shifter",
"pong",
"shiftorium",
"codepoints",
"shiftletters",
"shops",
"mud",
"notification",
"namechanger",
"skinning",
"skinloader",
"calculator",
"fileskimmer",
"lua",
"shiftnet",
"terminal",
"textpad"
};
word = wordlist[rng.Next(wordlist.Count)];
if ((String)comboBox1.SelectedItem == "ShiftOS") word = shiftWordlist[rng.Next(shiftWordlist.Count)];
else if ((String)comboBox1.SelectedItem == "Contributors") word = contributorsWordlist[rng.Next(contributorsWordlist.Count)];
else throw new NullWordlistException(":P");
lbllives.Text = "You have 7 lives left!";
lblword.Text = "";
for (int i=0; i<word.Length; i++)
@ -94,7 +79,10 @@ namespace ShiftOS.WinForms.Applications
public void OnLoad()
{
StartGame();
tbguess.Visible = false;
comboBox1.Items.Add("ShiftOS");
if (ShiftoriumFrontend.UpgradeInstalled("sl_contributors_wordlist")) comboBox1.Items.Add("Contributors");
btnrestart.Visible = true;
}
public void OnUpgrade()
@ -134,6 +122,8 @@ namespace ShiftOS.WinForms.Applications
lives = 0;
lbllives.Visible = true;
btnrestart.Visible = true;
btnrestart.Text = "Restart";
comboBox1.Visible = true;
int cp = word.Length * oldlives;
lbllives.Text = "You earned: " + cp + " codepoints!";
SaveSystem.TransferCodepointsFrom("shiftletters", cp);
@ -150,6 +140,8 @@ namespace ShiftOS.WinForms.Applications
tbguess.Visible = false;
lbllives.Visible = false;
btnrestart.Visible = true;
btnrestart.Text = "Restart";
comboBox1.Visible = true;
}
}
}
@ -159,5 +151,13 @@ namespace ShiftOS.WinForms.Applications
{
StartGame();
}
private class NullWordlistException : Exception
{
public NullWordlistException(string message) : base("ShiftLetters tried to use a Null Wordlist.")
{
}
}
}
}

View file

@ -72,6 +72,8 @@
Dependencies: "app_launcher",
Description: "Want to open the Notifications application from within the App Launcher? This upgrade is for you."
},
// SHIFTLETTERS AND WORDLISTS
{
Name: "ShiftLetters",
Cost: 150,
@ -84,6 +86,12 @@
Dependencies: "app_launcher;shiftletters",
Description: "This upgrade allows you to find ShiftLetters in your App Launcher."
},
{
Name: "SL Contributors Wordlist",
Cost: 250,
Dependencies: "shiftletters",
Description: "This nice wordlist lets you find out the people who contributed to the development of ShiftOS!"
},
{
Name: "Panel Notifications",
Cost: 150,
@ -95,6 +103,9 @@
Cost: 80,
Description: "Want to adjust the volume of ShiftOS's audio? This upgrade will let you."
},
// COLOR DEPTH AND DITHERING
{
Name: "Color Depth Dithering",
Cost: 1000,
@ -435,13 +446,13 @@
Dependencies: "mud_fundamentals;window_manager;pong_upgrade"
},
{
Name: "WAV Player",
Name: "Audio Player",
Cost: 10000,
Description: "Want to listen to the greatest tunes? Well get this app asap!",
Dependencies: "desktop;wm_free_placement"
},
{
Name: "WAV Player AL",
Name: "Audio Player AL",
Cost: 300,
Description: "Just another app launcher, making it easier to listen to your favorite songs!",
Dependencies: "desktop;wm_free_placement;wav_player"

View file

@ -64,6 +64,12 @@
<Compile Include="Applications\Artpad.Designer.cs">
<DependentUpon>Artpad.cs</DependentUpon>
</Compile>
<Compile Include="Applications\AudioPlayer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Applications\AudioPlayer.Designer.cs">
<DependentUpon>AudioPlayer.cs</DependentUpon>
</Compile>
<Compile Include="Applications\Calculator.cs">
<SubType>UserControl</SubType>
</Compile>