예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            graph.Clear(Color.Transparent);
            pictureBox1.BackgroundImage = Image.FromFile("monopolyField.jpg");
            int dice1 = Convert.ToInt32(rnd.Next(1, 7)), dice2 = Convert.ToInt32(rnd.Next(1, 7));

            fieldCell += dice1 + dice2;
            dices.Text = $"Значения на костях: {dice1}, {dice2}.";
            graph.FillEllipse(new SolidBrush(Color.Green), xPositions[fieldCell % 40], yPositions[fieldCell % 40], 10, 10);
            pictureBox1.Invalidate();
            if (fieldCell > 40)
            {
                fieldCell           -= 40;
                FormInfo.userPoints += 100;
                MessageBox.Show("Вы прошли поле 'Старт' и получаете 100 очков.");
            }
            if (fieldCell == 2 || fieldCell == 4 || fieldCell == 7 || fieldCell == 12 || fieldCell == 17 || fieldCell == 22 || fieldCell == 28 || fieldCell == 33 || fieldCell == 36 || fieldCell == 38)
            {
                int a = Convert.ToInt32(rnd.Next(-50, 51));
                if (a >= 0)
                {
                    MessageBox.Show($"Вы получаете {a} очков.");
                }
                else
                {
                    MessageBox.Show($"Вы теряете {-a} очков.");
                }
                FormInfo.userPoints += a;
            }
            else if (fieldCell == 40)
            {
                fieldCell           -= 40;
                FormInfo.userPoints += 100;
                MessageBox.Show("Вы попали на поле 'Старт' и получаете 100 очков.");
            }
            else if (fieldCell == 10 || fieldCell == 20 || fieldCell == 30)
            {
                MessageBox.Show("Поздравляем! Вам выпала пустая клетка.");
            }
            else
            {
                if (fieldCell == 5 || fieldCell == 15 || fieldCell == 25 || fieldCell == 35)
                {
                    FormInfo.questionClass = false;
                }
                else
                {
                    FormInfo.questionClass = true;
                }
                Form2 form2 = new Form2();
                form2.Show();
                form2.Owner = this;
                form2.Focus();
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: nikitakarak/-
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (FormInfo.startOfGame)
     {
         MessageBox.Show("Вы начали нашу игру. \n" + rules);
         Form2 form2 = new Form2();
         form2.Show();
         form2.Owner = this;
         form2.Focus();
         this.Hide();
         start.Visible    = true;
         sssstart.Visible = false;
         end.Visible      = true;
     }
 }