private void lb_Update() { try { System.Convert.ToInt32(txbScore.Text); System.Convert.ToInt32(txbTime.Text); } catch (Exception ex) { txbScore.Text = "0"; txbTime.Text = "0"; } Snake = new GDI_Computing_Method.Snake_Info(100, 4, 0); Food = new GDI_Computing_Method.Food_Info(tbrFood.Value, 100); Game_info = new GDI_Computing_Method.Game_Info(Keys.Right, (int)GDI_Computing_Method.Game_Info.game_state_enum.Ready, tbrSpeed.Value, 1000 * 60 * System.Convert.ToInt32(txbTime.Text), System.Convert.ToInt32(txbScore.Text)); uint Around = (uint)tbrSea.Value; Oe_info = new GDI_Computing_Method.Obstacle_Info((uint)tbrGreen.Value, (uint)tbrSP.Value, (uint)tbrTree.Value, false, Around, Around, Around, Around, 300, 301, 302, 303); lbTree.Text = tbrTree.Value.ToString(); lbGreen.Text = tbrGreen.Value.ToString(); lbSP.Text = tbrSP.Value.ToString(); lbSea.Text = tbrSea.Value.ToString(); lbFood.Text = tbrFood.Value.ToString(); lbSpeed.Text = string.Format("{0}ms", tbrSpeed.Value); }
private void rbPT_CheckedChanged(object sender, EventArgs e) { gbDiy.Enabled = false; Snake = new GDI_Computing_Method.Snake_Info(100, 4, 0); Food = new GDI_Computing_Method.Food_Info(1, 100); Game_info = new GDI_Computing_Method.Game_Info(Keys.Right, (int)GDI_Computing_Method.Game_Info.game_state_enum.Ready, 150, 1000 * 60 * 2, 25); Oe_info = new GDI_Computing_Method.Obstacle_Info(1, 2, 5, false, 10, 10, 10, 10, 300, 301, 302, 303); }
//窗口第一次显示 private void frmGameStart_Shown(object sender, EventArgs e) { int total = GDI_Computing_Method.M_x * GDI_Computing_Method.M_y; tbrTree.Maximum = (int)(total * 0.10); tbrGreen.Maximum = (int)((total / 25) * 0.3); tbrSP.Maximum = (int)((total / 5) * 0.1); tbrSea.Maximum = (int)(GDI_Computing_Method.M_x / 2); tbrFood.Minimum = 1; tbrFood.Maximum = (int)(total * 0.025); tbrSpeed.Minimum = 20; tbrSpeed.Maximum = 3000; lb_Update(); gbDiy.Enabled = false; Snake = new GDI_Computing_Method.Snake_Info(100, 4, 0); Food = new GDI_Computing_Method.Food_Info(1, 100); Game_info = new GDI_Computing_Method.Game_Info(Keys.Right, (int)GDI_Computing_Method.Game_Info.game_state_enum.Ready, 150, 1000 * 60 * 2, 25); Oe_info = new GDI_Computing_Method.Obstacle_Info(1, 2, 5, false, 10, 10, 10, 10, 300, 301, 302, 303); }