Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Lvl2_4x4 f = new Lvl2_4x4(0);

            //this.Hide();
            f.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Check every icon to see if it is matched, by
        /// comparing its foreground color to its background color.
        /// If all of the icons are matched, the player wins.
        /// </summary>
        private void CheckForWinner()
        {
            // Go through all of the labels in the TableLayoutPanel,
            // checking each one to see if its icon is matched.
            foreach (Control control in tableLayoutPanel1.Controls)
            {
                Label iconLabel = control as Label;

                if (iconLabel != null)
                {
                    if (iconLabel.ForeColor == iconLabel.BackColor)
                    {
                        return;
                    }
                }
            }

            // If the loop didn’t return, it didn't find
            // any unmatched icons.
            // That means the user won. Show a message and close the form.
            MessageBox.Show("LEVEL-1 PASSED! You matched all the icons!", "Congratulations!");

            Menu m = new Menu();

            int[] a     = m.readScoreFile();
            bool  check = false;

            for (int j = 0; j < 5; j++)
            {
                if ((i > a[j]) && (check == false))
                {
                    a[j]  = i;
                    check = true;
                }
            }
            m.writeScoreFile(a);

            Lvl2_4x4 f = new Lvl2_4x4(i);

            //this.Hide();
            f.Show();
            Close();
        }