Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem q in listView1.SelectedItems)
            {
                price = Convert.ToInt32(q.Text);
            }
            GamePoligon gamePolygon = (GamePoligon)this.Owner;

            try
            {
                gamePolygon.progressBarSatiety.Value += price;
            }
            catch (System.ArgumentOutOfRangeException)
            {
                gamePolygon.progressBarSatiety.Value = 100;
            }

            gamePolygon.label1.Text = $"Количество листиков: {Convert.ToString(gamePolygon.Money(-price))}";
            if (gamePolygon.Money(-price) <= 0)
            {
                gamePolygon.label1.Text = $"Количество листиков: {Convert.ToString(gamePolygon.Money(0))}";
            }
            gamePolygon.labelSatiety.Text = gamePolygon.progressBarSatiety.Value.ToString() + "%";
            this.Close();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int g;

            foreach (ListViewItem q in listView1.SelectedItems)
            {
                g = q.Index;
                for (int i = 0; i < qwe.Length; i++)
                {
                    if (i == g)
                    {
                        health = qwe[i];
                        break;
                    }
                }
            }
            GamePoligon gamePolygon = (GamePoligon)this.Owner;

            try
            {
                gamePolygon.Health          += health;
                gamePolygon.labelHealth.Text = gamePolygon.progressBarHealth.Value.ToString() + "%";
            }
            catch (System.ArgumentOutOfRangeException)
            {
                gamePolygon.progressBarMood.Value = 100;
            }
            this.Close();
        }
Пример #3
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (textBoxNameTam.Text.Length == 0)
     {
         MessageBox.Show("Пожалуйста введите имя медведя");
     }
     else if (typeBear == "")
     {
         MessageBox.Show("Пожалуйста выберите медведя");
     }
     else
     {
         poligon = new GamePoligon();
         poligon.SetTypeBear(typeBear);
         poligon.SetNameBear(textBoxNameTam.Text);
         this.Close();
         poligon.Show();
     }
 }
Пример #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            GamePoligon createTam = new GamePoligon("savefile.txt");

            createTam.Show();
        }