aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/ShiftLetters.cs
diff options
context:
space:
mode:
authorwowmom98 <[email protected]>2017-02-26 15:52:08 -0500
committerwowmom98 <[email protected]>2017-02-26 15:52:08 -0500
commitec61f5dfe9de92470cd91269c77713549e7d6159 (patch)
tree47faf338907cd5c57040556cff7e7a4bbd1547da /ShiftOS.WinForms/Applications/ShiftLetters.cs
parent2809d9c76d47640e6ac076e7484801415eff625f (diff)
parent0e3362e8e3c635150d92fd5acc9d69473ec588fc (diff)
downloadshiftos_thereturn-ec61f5dfe9de92470cd91269c77713549e7d6159.tar.gz
shiftos_thereturn-ec61f5dfe9de92470cd91269c77713549e7d6159.tar.bz2
shiftos_thereturn-ec61f5dfe9de92470cd91269c77713549e7d6159.zip
Merge remote-tracking branch 'origin/master'
# Conflicts: # ShiftOS.WinForms/Resources/Shiftorium.txt
Diffstat (limited to 'ShiftOS.WinForms/Applications/ShiftLetters.cs')
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLetters.cs151
1 files changed, 118 insertions, 33 deletions
diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs
index 2578669..32a1ed4 100644
--- a/ShiftOS.WinForms/Applications/ShiftLetters.cs
+++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs
@@ -46,6 +46,52 @@ 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> { "philipadams", "carverh", "computelinux", "lempamo",
+ "wowmom", "michaeltheshifter", "arencclc", "therandommelon", "pfg", "craftxbox"};
+
+ List<string> osWordlist = new List<string>
+ {
+ "windows",
+ "longhorn",
+ "memphis",
+ "neptune",
+ "vista",
+ "visopsys",
+ "ubuntu",
+ "linux",
+ "arch",
+ "debian",
+ "redhat",
+ "fedora",
+ "opensuse",
+ "kubuntu",
+ "lubuntu",
+ "xubuntu",
+ "mythbuntu",
+ "ubuntumate",
+ "zorin",
+ "lindows",
+ "msdos",
+ "freedos",
+ "freebsd",
+ "netbsd",
+ "pcbsd",
+ "android",
+ "ios",
+ "macos",
+ "mint",
+ "mikeos",
+ "raspbian",
+ "cosmos",
+ "chicago",
+ "vienna",
+ "whistler",
+ "windowsxp",
+ "windowsforworkgroups"
+ };
public ShiftLetters()
{
@@ -56,40 +102,58 @@ 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>
+
+ bool isShiftOS = comboBox1.SelectedItem.ToString().ToLower() == "shiftos";
+ bool isContributors = comboBox1.SelectedItem.ToString().ToLower() == "contributors";
+ bool isOSes = comboBox1.SelectedItem.ToString().ToLower() == "operating systems";
+
+
+ var wordlist = new List<string>();
+ if (isOSes)
{
- "shiftos",
- "devx",
- "artpad",
- "shifter",
- "pong",
- "shiftorium",
- "codepoints",
- "shiftletters",
- "shops",
- "mud",
- "notification",
- "namechanger",
- "skinning",
- "skinloader",
- "calculator",
- "fileskimmer",
- "lua",
- "shiftnet",
- "terminal",
- "textpad"
- };
- //This can diversify the amount of ShiftOS-related words in the game.
- foreach(var upg in Shiftorium.GetDefaults())
+ foreach (var w in osWordlist)
+ {
+ if (!wordlist.Contains(w.ToLower()))
+ {
+ wordlist.Add(w.ToLower());
+ }
+ }
+ }
+ if (isShiftOS)
{
- foreach(var w in upg.Name.Split(' '))
+ foreach (var w in shiftWordlist)
{
if (!wordlist.Contains(w.ToLower()))
+ {
wordlist.Add(w.ToLower());
+ }
+ }
+ }
+ else if (isContributors)
+ {
+ foreach (var w in contributorsWordlist)
+ {
+ if (!wordlist.Contains(w.ToLower()))
+ {
+ wordlist.Add(w.ToLower());
+ }
+ }
+ }
+ if (isShiftOS)
+ {
+ //This can diversify the amount of ShiftOS-related words in the game.
+ foreach (var upg in Shiftorium.GetDefaults())
+ {
+ foreach (var w in upg.Name.Split(' '))
+ {
+ if (!wordlist.Contains(w.ToLower()))
+ wordlist.Add(w.ToLower());
+ }
}
}
word = wordlist[rng.Next(wordlist.Count)];
@@ -108,7 +172,12 @@ 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");
+ if (Shiftorium.UpgradeInstalled("sl_operating_systems_wordlist")) comboBox1.Items.Add("Operating Systems");
+ btnrestart.Visible = true;
+ lblword.Left = (this.Width - lblword.Width) / 2;
}
public void OnUpgrade()
@@ -123,7 +192,7 @@ namespace ShiftOS.WinForms.Applications
public void OnSkinLoad()
{
-
+ lblword.Left = (this.Width - lblword.Width) / 2;
}
string lastword = "";
@@ -146,13 +215,9 @@ namespace ShiftOS.WinForms.Applications
if (!lblword.Text.Contains("_"))
{
int oldlives = lives;
- tbguess.Visible = false;
- lives = 0;
- lbllives.Visible = true;
- btnrestart.Visible = true;
int cp = word.Length * oldlives;
- lbllives.Text = "You earned: " + cp + " codepoints!";
SaveSystem.TransferCodepointsFrom("shiftletters", cp);
+ StartGame();
}
}
}
@@ -160,12 +225,19 @@ namespace ShiftOS.WinForms.Applications
{
guessedCharacters = guessedCharacters + charGuessed;
lives--;
- lbllives.Text = "You have: " + lives + " lives left!";
+ if (lives == 1)
+ {
+ lbllives.Text = "You have 1 life left! Be careful...";
+ } else {
+ lbllives.Text = "You have " + lives + " lives left!";
+ }
if (lives == 0)
{
tbguess.Visible = false;
lbllives.Visible = false;
btnrestart.Visible = true;
+ btnrestart.Text = "Restart";
+ comboBox1.Visible = true;
}
}
}
@@ -175,5 +247,18 @@ namespace ShiftOS.WinForms.Applications
{
StartGame();
}
+
+ private class NullWordlistException : Exception
+ {
+ public NullWordlistException(string message) : base("ShiftLetters tried to use a Null Wordlist.")
+ {
+
+ }
+ }
+
+ private void lblword_TextChanged(object sender, EventArgs e)
+ {
+ lblword.Left = (this.Width - lblword.Width) / 2;
+ }
}
}