Exemple #1
0
        private void button1_Click(object sender, EventArgs e) //New Game
        {
            label1.Text = "______________";
            //pictureBox1.Image = Image.FromFile("C:\\Users\\Jordan\\Desktop\\Hangman0.png");
            pictureBox1.Image = Properties.Resources.Hangman0;

            var newGame = new NewGame();

            newGame.ShowDialog();
            if (newGame.SecretWord == null)
            {
                return;
            }
            SecretWord   = newGame.SecretWord.ToUpper();
            WrongGuesses = 0;

            SecretWordDictionary = new List <SecretWordDictionary <string, string> >();
            foreach (var letter in SecretWord)
            {
                SecretWordDictionary.Add(new SecretWordDictionary <string, string> {
                    First = "_", Second = letter.ToString()
                });
            }

            var buttons = new List <Button> {
                button2, button3, button4, button5, button6, button7, button8, button9, button10, button11, button12, button13, button14, button15, button16, button17, button18, button19, button20, button21, button22, button23, button24, button25, button26, button27, button28
            };

            foreach (var button in buttons)
            {
                button.Enabled = true;
            }

            UpdateLabelText();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            NewGame game = new NewGame();

            game.StartGame();
        }