Пример #1
0
        private void Symbol_Click(object sender, EventArgs e)
        {
            if (firstClick != null && secondClick != null)
            {
                return;
            }

            Label clickedLabel = sender as Label;

            if (clickedLabel == null)
            {
                return;
            }

            if (clickedLabel.ForeColor == Color.Black)
            {
                return;
            }

            if (firstClick == null)
            {
                firstClick           = clickedLabel;
                firstClick.ForeColor = Color.Black;
                return;
            }
            secondClick           = clickedLabel;
            secondClick.ForeColor = Color.Black;
            if (firstClick.Text == secondClick.Text)
            {
                firstClick  = null;
                secondClick = null;

                Win.Start();
                MessageBox.Show("You Win");

                Random rnd        = new Random(); // randomly chooses a minigame
                int    gamePicker = rnd.Next(1, 3);

                if (gamePicker == 1)
                {
                    var Game1 = new Game1();
                    Game1.Show();
                }
                else
                {
                    var Game3 = new Game3();
                    Game3.Show();
                }
            }

            else
            {
                Reset.Start();
            }
        }
Пример #2
0
        private void btnGame1_Click(object sender, EventArgs e)
        {
            Random rnd        = new Random(); // randomly chooses a minigame
            int    gamePicker = rnd.Next(1, 4);

            if (gamePicker == 1)
            {
                var Game4 = new Game4();
                Game4.Show();
            }

            else if (gamePicker == 2)
            {
                var Game3 = new Game3();
                Game3.Show();
            }
            else
            {
                var Game1 = new Game1();
                Game1.Show();
            }
        }