예제 #1
0
        private void btnEditSpells_Click(object sender, EventArgs e)
        {
            ObjTemplate.ObjectType type = (ObjTemplate.ObjectType)(Enum.Parse(typeof(ObjTemplate.ObjectType), (String)cbItemType.SelectedItem));

            switch (type)
            {
            default:
                MessageBox.Show("This item type cannot contain spells.");
                break;

            case ObjTemplate.ObjectType.herb:
            case ObjTemplate.ObjectType.pill:
            case ObjTemplate.ObjectType.potion:
            case ObjTemplate.ObjectType.scroll:
            case ObjTemplate.ObjectType.spellbook:
            case ObjTemplate.ObjectType.staff:
            case ObjTemplate.ObjectType.trap:
            case ObjTemplate.ObjectType.wand:
                EditSpells dlg = new EditSpells(_area.Objects[objectList.SelectedIndex].SpellEffects);
                dlg.ShowDialog();
                if (dlg.DialogResult == DialogResult.OK)
                {
                    _area.Objects[objectList.SelectedIndex].SpellEffects = dlg.GetSpellEffects();
                }
                break;
            }
        }
예제 #2
0
        private void btnEditSpells_Click(object sender, EventArgs e)
        {
            ObjTemplate.ObjectType type = (ObjTemplate.ObjectType)(Enum.Parse(typeof(ObjTemplate.ObjectType), (String)cbItemType.SelectedItem));

            switch (type)
            {
                default:
                    MessageBox.Show("This item type cannot contain spells.");
                    break;
                case ObjTemplate.ObjectType.herb:
                case ObjTemplate.ObjectType.pill:
                case ObjTemplate.ObjectType.potion:
                case ObjTemplate.ObjectType.scroll:
                case ObjTemplate.ObjectType.spellbook:
                case ObjTemplate.ObjectType.staff:
                case ObjTemplate.ObjectType.trap:
                case ObjTemplate.ObjectType.wand:
                    EditSpells dlg = new EditSpells(_area.Objects[objectList.SelectedIndex].SpellEffects);
                    dlg.ShowDialog();
                    if (dlg.DialogResult == DialogResult.OK)
                    {
                        _area.Objects[objectList.SelectedIndex].SpellEffects = dlg.GetSpellEffects();
                    }
                    break;
            }
        }