public GUI() { MessageBox.Show ("Choose a category"); Form intro= new Form(); intro.Text="Categories"; intro.Size = new Size (300,300); intro.StartPosition=FormStartPosition.CenterScreen; Button animalsButton= new Button(); animalsButton.Text = "Animals"; animalsButton.Location = new Point (110, 30); intro.Controls.Add (animalsButton); animalsButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the animal"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("animals"))); }; Button challengewordsButton= new Button(); challengewordsButton.Text = "Challenging Words"; challengewordsButton.Location=new Point(animalsButton.Left, animalsButton.Height+animalsButton.Top+10); intro.Controls.Add (challengewordsButton); challengewordsButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the challenging word"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("challengewords"))); //hang.Play (); }; Button countriesButton = new Button (); countriesButton.Text = "Countries"; countriesButton.Location = new Point (challengewordsButton.Left, challengewordsButton.Height + challengewordsButton.Top + 10); intro.Controls.Add (countriesButton); countriesButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the country"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("countries"))); //hang.Play (); }; Button musiciansButton = new Button (); musiciansButton.Text = "Musicians"; musiciansButton.Location = new Point (countriesButton.Left, countriesButton.Height + countriesButton.Top + 10); intro.Controls.Add (musiciansButton); musiciansButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the musician"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("musicians"))); //hang.Play (); }; Button pokemonButton = new Button (); pokemonButton.Text = "Pokemon"; pokemonButton.Location = new Point (musiciansButton.Left, musiciansButton.Height + musiciansButton.Top + 10); intro.Controls.Add (pokemonButton); pokemonButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the Pokemon"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("pokemon"))); //hang.Play (); }; Button sportsButton = new Button (); sportsButton.Text = "Sports"; sportsButton.Location = new Point (pokemonButton.Left, pokemonButton.Height + pokemonButton.Top + 10); intro.Controls.Add (sportsButton); sportsButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the sport"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("sports"))); //hang.Play (); }; Button superchallengewordsButton = new Button (); superchallengewordsButton.Text = "Super Hard"; superchallengewordsButton.Location = new Point (sportsButton.Left, sportsButton.Height + sportsButton.Top + 10); intro.Controls.Add (superchallengewordsButton); superchallengewordsButton.Click+=(sender, e)=> { intro.Hide(); MessageBox.Show("Guess the super challenging word"); Hangman hang = new Hangman (Hangman.HangManReader(Hangman.PromptWordList("superchallengewords"))); //hang.Play (); }; intro.ShowDialog(); Form HangWindow= new Form(); HangWindow.Size= new Size(800, 800); HangWindow.Text="Categories"; HangWindow.StartPosition=FormStartPosition.CenterScreen; Button a = new Button (); a.Text = "a"; a.Location = new Point (10, 500); HangWindow.Controls.Add (a); a.Click+=(sender, e)=> { Hangman.Guess("a"); Hangman.CheckGuess(); }; Button b = new Button (); b.Text = "b"; b.Location = new Point (90, 500); HangWindow.Controls.Add (b); b.Click+=(sender, e)=> { Hangman.Guess("b"); Hangman.CheckGuess(); }; Button c = new Button (); c.Text = "c"; c.Location = new Point (170, 500); HangWindow.Controls.Add (c); c.Click+=(sender, e)=> { Hangman.Guess("c"); Hangman.CheckGuess(); }; Button d = new Button (); d.Text = "d"; d.Location = new Point (250, 500); HangWindow.Controls.Add (d); d.Click+=(sender, e)=> { Hangman.Guess("d"); Hangman.CheckGuess(); }; Button e1 = new Button (); e1.Text = "e"; e1.Location = new Point (330, 500); HangWindow.Controls.Add (e1); e1.Click+=(sender, e)=> { Hangman.Guess("e"); Hangman.CheckGuess(); }; Button f = new Button (); f.Text = "f"; f.Location = new Point (410, 500); HangWindow.Controls.Add (f); f.Click+=(sender, e)=> { Hangman.Guess("f"); Hangman.CheckGuess(); }; Button g = new Button (); g.Text="g"; g.Location= new Point (490, 500); HangWindow.Controls.Add (g); g.Click+=(sender, e)=> { Hangman.Guess("g"); Hangman.CheckGuess(); }; Button h = new Button (); h.Text = "h"; h.Location = new Point (570, 500); HangWindow.Controls.Add (h); h.Click+=(sender, e)=> { Hangman.Guess("h"); Hangman.CheckGuess(); }; Button i = new Button (); i.Text = "i"; i.Location = new Point (650, 500); HangWindow.Controls.Add (i); i.Click+=(sender, e)=> { Hangman.Guess("i"); Hangman.CheckGuess(); }; Button j = new Button (); j.Text = "j"; j.Location=new Point(10, 530); HangWindow.Controls.Add (j); j.Click+=(sender, e)=> { Hangman.Guess("j"); Hangman.CheckGuess(); }; Button k = new Button (); k.Text = "k"; k.Location = new Point (90, 530); HangWindow.Controls.Add (k); k.Click+=(sender, e)=> { Hangman.Guess("k"); Hangman.CheckGuess(); }; Button l = new Button (); l.Text = "l"; l.Location = new Point (170, 530); HangWindow.Controls.Add (l); l.Click+=(sender, e)=> { Hangman.Guess("l"); Hangman.CheckGuess(); }; Button m = new Button (); m.Text = "m"; m.Location= new Point (250, 530); HangWindow.Controls.Add (m); m.Click+=(sender, e)=> { Hangman.Guess("m"); Hangman.CheckGuess(); }; Button n = new Button (); n.Text = "n"; n.Location = new Point (330, 530); HangWindow.Controls.Add (n); n.Click+=(sender, e)=> { Hangman.Guess("n"); Hangman.CheckGuess(); }; Button o = new Button (); o.Text = "o"; o.Location = new Point (410, 530); HangWindow.Controls.Add (o); o.Click+=(sender, e)=> { Hangman.Guess("o"); Hangman.CheckGuess(); }; Button p = new Button (); p.Text = "p"; p.Location = new Point (490, 530); HangWindow.Controls.Add (p); p.Click+=(sender, e)=> { Hangman.Guess("p"); Hangman.CheckGuess(); }; Button q = new Button (); q.Text = "q"; q.Location = new Point (570, 530); HangWindow.Controls.Add (q); q.Click+=(sender, e)=> { Hangman.Guess("q"); Hangman.CheckGuess(); }; Button r = new Button (); r.Text = "r"; r.Location = new Point (650, 530); HangWindow.Controls.Add (r); r.Click+=(sender, e)=> { Hangman.Guess("r"); Hangman.CheckGuess(); }; Button s = new Button (); s.Text = "s"; s.Location = new Point (10, 560); HangWindow.Controls.Add (s); s.Click+=(sender, e)=> { Hangman.Guess("s"); Hangman.CheckGuess(); }; Button t = new Button (); t.Text = "t"; t.Location = new Point (90, 560); HangWindow.Controls.Add (t); t.Click+=(sender, e)=> { Hangman.Guess("t"); Hangman.CheckGuess(); }; Button u = new Button (); u.Text = "u"; u.Location = new Point (170, 560); HangWindow.Controls.Add (u); u.Click+=(sender, e)=> { Hangman.Guess("u"); Hangman.CheckGuess(); }; Button v = new Button (); v.Text = "v"; v.Location = new Point (250, 560); HangWindow.Controls.Add (v); v.Click+=(sender, e)=> { Hangman.Guess("v"); Hangman.CheckGuess(); }; Button w = new Button (); w.Text = "w"; w.Location = new Point (330, 560); HangWindow.Controls.Add (w); w.Click+=(sender, e)=> { Hangman.Guess("w"); Hangman.CheckGuess(); }; Button x = new Button (); x.Text = "x"; x.Location = new Point (410, 560); HangWindow.Controls.Add (x); x.Click+=(sender, e)=> { Hangman.Guess("x"); Hangman.CheckGuess(); }; Button y = new Button (); y.Text = "y"; y.Location=new Point(490, 560); HangWindow.Controls.Add (y); y.Click+=(sender, e)=> { Hangman.Guess("y"); Hangman.CheckGuess(); }; Button z = new Button (); z.Text = "z"; z.Location = new Point (570, 560); HangWindow.Controls.Add (z); z.Click+=(sender, e)=> { Hangman.Guess("z"); Hangman.CheckGuess(); }; Label containerLabel=new Label(); containerLabel.Location=new Point(100,100); HangWindow.Controls.Add(containerLabel); string ui= Hangman.getWordContainer(); containerLabel.Text=ui; Label lives = new Label (); lives.Location = new Point (100, 130); HangWindow.Controls.Add (lives); lives.Text = Hangman.getGuessCount ().ToString(); Label wrong = new Label (); wrong.Location = new Point (100, 160); HangWindow.Controls.Add (wrong); wrong.Text = Hangman.getWrongGuesses ().ToString(); HangWindow.Show (); Form result= new Form(); result.Text="Results"; result.StartPosition=FormStartPosition.CenterScreen; Label outcome = new Label (); outcome.Text = "You have "+Hangman.getWins()+" and "+Hangman.getLosses()+" losses!"+"\n"+"Do you want to play again?"; }
public static void Main () { Hangman hang = new Hangman (HangManReader(PromptWordList())); hang.Play (); }