public void hp_reflash(int xue) //道具的回血 { sql.Open(); PERSON person1 = new PERSON(); int hp = person1.Tiqu_person_hp(); int change_hp = person1.Tiqu_change_hp(); if (xue + change_hp < hp) { int he = xue + change_hp; string blood_return = "update person set change_hp+= " + he; SqlCommand blood_command = new SqlCommand(blood_return, sql); try { blood_command.ExecuteNonQuery(); } catch { MessageBox.Show("执行回血语句失败"); } finally { sql.Close(); } } else { string blood_return = "update person set change_hp= " + hp; SqlCommand blood_command = new SqlCommand(blood_return, sql); try { blood_command.ExecuteNonQuery(); } catch { MessageBox.Show("语句失败"); } finally { sql.Close(); } } }
private void shop_FormClosing(object sender, FormClosingEventArgs e) { PERSON pERSON = new PERSON(); int xy = pERSON.Tiqu_person_grade(); Form1.form1.label1.Text = "人物属性\r\n名字:红凯 等级 : " + Convert.ToString(xy) + "\r\n血量 : " + Convert.ToString(pERSON.Tiqu_person_hp()) + "\r\n攻击力 : " + Convert.ToString(pERSON.Tiqu_person_wuli()) + "\r\n"; Form1.form1.label1.Text += "金钱:" + pERSON.Tiqu_person_money(); }
private void button1_Click_1(object sender, EventArgs e) { progressBar1.Visible = true; progressBar1.Maximum = 10; // progressBar1.Value = 0; progressBar1.Minimum = 0; for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++) { System.Threading.Thread.Sleep(100); progressBar1.Value = i; this.Refresh(); } PERSON pERSON = new PERSON(); pERSON.blood_return(); int xy = pERSON.Tiqu_person_grade(); label1.Text = "人物属性\r\n名字:红凯 等级 : " + Convert.ToString(xy) + "\r\n血量 : " + Convert.ToString(pERSON.Tiqu_person_hp()) + "\r\n攻击力 : " + Convert.ToString(pERSON.Tiqu_person_wuli()) + "\r\n"; label1.Text += "金钱:" + pERSON.Tiqu_person_money(); MessageBox.Show("恢复成功", "提示"); progressBar1.Visible = false; }