Example #1
0
 public FrmItem(ModItem mi, FrmMain frmmain, Lang lang)
 {
     this.DialogResult = DialogResult.Cancel;
     InitializeComponent();
     //语言操作
     if (lang != null && !lang.Default)
     {
         this.lang = lang;
         Translate(lang);
     }
     frmMain   = frmmain;
     Templates = frmMain.Templates.ToArray();
     MSetins   = frmMain.MSetins.ToArray();
     relstmp();
     for (int i = 0; i < Templates.Length; i++)
     {
         if (Templates[i] == mi.UseTemp)
         {
             comboBoxItemTemplare.SelectedIndex = i;
             break;
         }
     }
     TmpItem              = new ModItem(mi);
     Nowed                = TmpItem.ItemID;
     textBoxName.Text     = TmpItem.Name;
     textBoxItemInfo.Text = TmpItem.Info;
     setShow();
 }//加载
Example #2
0
 public ModItem(ModItem mi)//拷贝一个一摸一样的ITEM
 {
     Name      = mi.Name;
     Data      = mi.Data.ToList();
     Info      = mi.Info;
     ItemID    = mi.ItemID;
     UseTemp   = mi.UseTemp;
     ItemImage = mi.ItemImage;
 }
Example #3
0
        public void Save()
        {
            if (comboBoxItemTemplare.SelectedIndex == -1)
            {
                this.DialogResult = DialogResult.No;
                return;
            }
            TmpItem.Name = textBoxName.Text;
            TmpItem.Info = textBoxItemInfo.Text;

            ModItem = new ModItem(TmpItem);
        }
Example #4
0
        int odsl = -1;//防止选择到同一个index时刷新
        private void comboBoxItemTemplare_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxItemTemplare.SelectedIndex == odsl)
            {
                return;
            }
            else
            {
                odsl = comboBoxItemTemplare.SelectedIndex;
            }
            addCustomStuffToolStripMenuItem.Visible = true;
            Template tm = Templates[odsl];

            TmpItem              = new ModItem(Nowed, "", "", tm, MSetins);
            textBoxName.Text     = TmpItem.UseTemp.Name;
            textBoxItemInfo.Text = TmpItem.UseTemp.Info;
            setShow();
        }
Example #5
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count == 0)
            {
                return;
            }

            int     id = listView1.SelectedIndices[0];
            ModItem mi = data.modItems[id];

            isChange = true;
            FrmItem fi = new FrmItem(mi, this, lang());

            if (fi.ShowDialog() == DialogResult.OK)
            {
                data.modItems[id] = fi.ModItem;
                listView1.Items[id].SubItems[1].Text = fi.ModItem.Name;
                listView1.Items[id].SubItems[2].Text = fi.ModItem.UseTemp.Name;
                listView1.Items[id].SubItems[3].Text = fi.ModItem.Info;
                ////序列+1
                //data.ItemID++;
            }
        }