Exemple #1
0
 private void UpdateImages()
 {
     string[] imgNames = new string[] {
         "Armreif2",
         "Armreif1",
         "Ring2",
         "Ring1",
         "Reittier",
         "Amulett",
         "Mantel",
         "Schild",
         "Waffe",
         "Schuhe",
         "Handschuh",
         "Hose",
         "Rüstung",
         "Helm"
     };
     for (int i = 0; i < imgNames.Length; i++)
     {
         PictureBox box = this.panelStatus.Controls["img" + imgNames[i]] as PictureBox;
         if (box == null)
         {
             continue;
         }
         SItem item = mStats.GetItemFromName(imgNames[i]).Clone() as SItem;
         if (item.Equals(SItem.Empty))
         {
             continue;
         }
         box.Image = Bitmap.FromStream(mAssembly.GetManifestResourceStream("Ssc.Resources.EQ_" + imgNames[i] + ".png"));
     }
 }
Exemple #2
0
        private void EquipmentImg_Click(object sender, EventArgs e)
        {
            if (!(sender is PictureBox))
            {
                return;
            }

            PictureBox box      = sender as PictureBox;
            string     itemType = box.Name.Substring(3);
            SItem      item     = mStats.GetItemFromName(itemType).Clone() as SItem;

            if (box == imgWaffe)
            {
                frmItemBonusWeapon frm = new frmItemBonusWeapon(item, itemType);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                item.Name       = frm.txtName.Text;
                item.Sockel     = (int)frm.numSockel.Value;
                item.Bonus      = frm.GetBonusList();
                item.WeaponType = (EWeaponType)frm.cbWeaponType.SelectedIndex;
            }
            else
            {
                frmItemBonus frm = new frmItemBonus(item, itemType);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                item.Name       = frm.txtName.Text;
                item.Sockel     = (int)frm.numSockel.Value;
                item.Bonus      = frm.GetBonusList();
                item.WeaponType = EWeaponType.None;
            }
            if (item.Name == string.Empty && item.Bonus.Count > 0)
            {
                item.Name = itemType;
            }
            else if (item.Name == string.Empty && item.Bonus.Count == 0)
            {
                item = SItem.Empty.Clone() as SItem;
            }

            if (item.Equals(SItem.Empty))
            {
                box.Image = null;
            }
            else
            {
                box.Image = Bitmap.FromStream(mAssembly.GetManifestResourceStream("Ssc.Resources.EQ_" + itemType + ".png"));
            }

            mStats.SaveItemByName(itemType, item);
            if (mStats.GetItemFromName(itemType) == SItem.Empty)
            {
                box.Image = null;
            }

            box.Invalidate();
            UpdateAll();
        }