예제 #1
0
 private void EditProts_Load(object sender, EventArgs e)
 {
     foreach(Protectors pro in Main.Stats.Protectors) bind.Add(pro);
     Protectors First = new Protectors();
     First.Number = 1;
     //First.DN = r.NextDouble() * ()
     if (Main.Stats.Protectors.Count == 0)
     {
         Main.Stats.Protectors.Add(First);
         bind.Add(First);
     }
     CurrProts.DataSource = bind;
     (CurrProts.Columns[1] as DataGridViewComboBoxColumn).Items.AddRange(Main.Stats.TypesProtectors);
     CurrProts.Update();
     CurrProts.Refresh();
 }
예제 #2
0
 private void Add_Click(object sender, EventArgs e)
 {
     Random r = new Random();
     Protectors pro = new Protectors();
     pro.Number = Main.Stats.Protectors.Count + 1;
     pro.TypeProtector = Main.Stats.Protectors[Main.Stats.Protectors.Count - 1].TypeProtector;
     pro.DN = (r.Next((int)M.tempDef.DNLowest * 10, (int)M.tempDef.DNHighest * 10)) / 10;
     pro.DT = (r.Next((int)M.tempDef.DTLowest * 10, (int)M.tempDef.DTHighest * 10)) / 10;
     pro.MaxDN = M.tempDef.maxDN;
     pro.MaxDT = M.tempDef.maxDT;
     Main.Stats.Protectors.Add(pro);
     bind.Add(pro);
     CurrProts.DataSource = bind;
     CurrProts.Update();
     CurrProts.Refresh();
 }