private void LoadPart(SkillPartInfo partInfo) { currentPartInfo = partInfo; txtId.Text = partInfo.Id.ToString(); txtName.Text = partInfo.Name; txtDescription.Text = partInfo.Description; txtDescription2.Text = partInfo.Description2; txtDescription3.Text = partInfo.Description3; numHPCost.Value = (decimal)partInfo.Cost.health; numMPCost.Value = (decimal)partInfo.Cost.mana; numSPCost.Value = (decimal)partInfo.Cost.stamina; if (partInfo is SkillModifierInfo) { cboType.Items.Clear(); foreach (SkillModifierInfo.ModifierType type in modTypes) { cboType.Items.Add(type); } SkillModifierInfo modInfo = (SkillModifierInfo)partInfo; cboType.SelectedItem = modInfo.ModType; } else { cboType.Items.Clear(); foreach (SkillTechniqueInfo.TechniqueType type in techTypes) { cboType.Items.Add(type); } SkillTechniqueInfo techInfo = (SkillTechniqueInfo)partInfo; cboType.SelectedItem = techInfo.TechType; } }
private void SaveCurrentPart() { if (currentPartInfo != null) { currentPartInfo.Name = txtName.Text; currentPartInfo.Description = txtDescription.Text; currentPartInfo.Description2 = txtDescription2.Text; currentPartInfo.Description3 = txtDescription3.Text; currentPartInfo.Cost.health = (float)numHPCost.Value; currentPartInfo.Cost.mana = (float)numMPCost.Value; currentPartInfo.Cost.stamina = (float)numSPCost.Value; if (currentPartInfo is SkillModifierInfo) { SkillModifierInfo modInfo = (SkillModifierInfo)currentPartInfo; modInfo.ModType = (SkillModifierInfo.ModifierType)cboType.SelectedItem; } else { SkillTechniqueInfo techInfo = (SkillTechniqueInfo)currentPartInfo; techInfo.TechType = (SkillTechniqueInfo.TechniqueType)cboType.SelectedItem; } } }