Ejemplo n.º 1
0
        public static Skill SkillFromSkillData(SkillData data)
        {
            Skill skill = new Skill();

            skill.SkillName = data.Name;
            skill.SkillValue = 0;

            foreach (string s in data.ClassModifiers.Keys)
            {
                skill.ClassModifiers.Add(s, data.ClassModifiers[s]);
            }

            return skill;
        }
Ejemplo n.º 2
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     skill = null;
     this.FormClosing -= FormSkillDetails_FormClosing;
     this.Close();
 }
Ejemplo n.º 3
0
        void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("You must provide a name for the skill.");
                return;
            }

            SkillData newSkill = new SkillData();

            newSkill.Name = tbName.Text;

            if (rbStrength.Checked)
                newSkill.PrimaryAttribute = "Strength";
            else if (rbDexterity.Checked)
                newSkill.PrimaryAttribute = "Dexterity";
            else if (rbCunning.Checked)
                newSkill.PrimaryAttribute = "Cunning";
            else if (rbWillpower.Checked)
                newSkill.PrimaryAttribute = "Willpower";
            else if (rbMagic.Checked)
                newSkill.PrimaryAttribute = "Magic";
            else if (rbConstitution.Checked)
                newSkill.PrimaryAttribute = "Constitution";

            skill = newSkill;
            this.FormClosing -= FormSkillDetails_FormClosing;
            this.Close();
        }
Ejemplo n.º 4
0
        private void AddSkill(SkillData skillData)
        {
            if (FormDetails.SkillManager.SkillData.ContainsKey(skillData.Name))
            {
                DialogResult result = MessageBox.Show(
                    skillData.Name + " already exists. Overwrite it?",
                    "Existing skill",
                    MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                    return;

                skillManager.SkillData[skillData.Name] = skillData;
                FillListBox();
                return;
            }

            skillManager.SkillData.Add(skillData.Name, skillData);
            lbDetails.Items.Add(skillData);
        }