private void BNT_DeleteSelection_Click(object sender, EventArgs e) { if (_SelectedSkill != null) { SkillData _selected = SkillCastConditions.Custom.CustomDefinitions.FirstOrDefault(x => x.Name == _SelectedSkill.Name && x.Power.PowerSNO == _SelectedSkill.Power.PowerSNO); SkillCastConditions.Custom.CustomDefinitions.Remove(_selected); _SelectedSkill = null; Update_View(); } }
private void Skill_Select() { Button _this = _clickedSkill; SkillData _selected = SkillCastConditions.Custom.CustomDefinitions.FirstOrDefault(x => x.Name == _this.Text && x.Power.PowerSNO == int.Parse(_this.Name)); _SelectedSkill = _selected; _SelectedCondition = null; BTN_ConditionEdit.Visible = false; BTN_ContitionRemove.Visible = false; Update_View(); }
private void Skill_Copy() { SkillData ToCopy = A_Collection.SkillCastConditions.Custom.CustomDefinitions.FirstOrDefault( x => x.Name == _clickedSkill.Text); int counter = 0; string newName = ToCopy.Name + "_" + counter.ToString(); while (true) { if (A_Collection.SkillCastConditions.Custom.CustomDefinitions.FirstOrDefault( x => x.Name == newName) == null) break; counter++; newName = ToCopy.Name + "_" + counter.ToString(); } SkillData NewData = new SkillData(ToCopy.Power, newName, ToCopy.SelectedRune, ToCopy.CastConditions); A_Collection.SkillCastConditions.Custom.CustomDefinitions.Add(NewData); Update_View(); }
private void BTN_Add_Click(object sender, EventArgs e) { if (TB_SkillName.Text.Length < 3) { MessageBox.Show("Name too short. Must contain atleast 3 chars!"); return; } var tryGetEntry = SkillCastConditions.Custom.CustomDefinitions.FirstOrDefault(x => x.Name == TB_SkillName.Text); if(tryGetEntry != null) { MessageBox.Show("Name already exists. Please choose another!"); return; } ComboboxItem SelectedPower = CB_PowerSelection.SelectedItem as ComboboxItem; ComboboxItem SelectedRune = CB_SelectedRune.SelectedItem as ComboboxItem; string SkillDefinitionName = TB_SkillName.Text; SkillPower Power = SelectedPower.Value as SkillPower; Rune _Rune = SelectedRune.Value as Rune; SkillCastConditions.Custom.CustomDefinitions.Add(new SkillData(Power, SkillDefinitionName, _Rune, new List<CastCondition>())); _SelectedSkill = null; TB_SkillName.Text = ""; Update_View(); }