public void GetItemList(string characterRace, string characterClass)
        {
            searchTextBox.Text = "";
            itemsListBox.Items.Clear();
            XmlSerializer serializer = new XmlSerializer(typeof(Items));

            using (StreamReader reader = new StreamReader(@"Data\ReagentItems.xml"))
            {
                items = (Items)serializer.Deserialize(reader.BaseStream);
            }
            RaceFilter(characterRace);
            ClassFilter(characterClass);
            list.Clear();
            list.AddRange(items.Item);
            list.Sort((x, y) => x.Name.CompareTo(y.Name));
            item = new ItemsItem
            {
                Name    = "None",
                ID      = "0",
                Quality = -1,
                Icon    = WoWHelper.SlotIcon("ammoReagent", characterClass)
            };
            itemsListBox.Items.Add(item);
            itemsListBox.Items.AddRange(list.ToArray());
            itemsListBox.SelectedIndex = 0;
        }
        public void GetItemList(string slot, string characterRace, string characterClass, CharacterModel character)
        {
            this.slot          = slot;
            searchTextBox.Text = "";
            itemsListBox.Items.Clear();
            this.character = character;
            rotation       = 0;
            XmlSerializer serializer = new XmlSerializer(typeof(Items));

            using (StreamReader reader = new StreamReader(@"Data\" + ItemsFile(slot)))
            {
                items = (Items)serializer.Deserialize(reader.BaseStream);
            }
            RaceFilter(characterRace);
            ClassFilter(characterClass);
            list.Clear();
            list.AddRange(items.Item);
            list.Sort((x, y) => x.Name.CompareTo(y.Name));
            item = new ItemsItem
            {
                Name    = "None",
                ID      = "0",
                Quality = -1,
                Icon    = WoWHelper.SlotIcon(slot, characterClass)
            };
            itemsListBox.Items.Add(item);
            itemsListBox.Items.AddRange(list.ToArray());
            itemsListBox.SelectedIndex = 0;
        }
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index >= Items.Count || e.Index <= -1)
            {
                return;
            }
            ItemsItem item = (ItemsItem)Items[e.Index];

            if (item == null)
            {
                return;
            }
            Graphics graphics = e.Graphics;

            graphics.FillRectangle((e.State & DrawItemState.Selected) == DrawItemState.Selected ? new SolidBrush(Color.FromArgb(75, 75, 75)) : new SolidBrush(BackColor), e.Bounds);
            Bitmap icon = new Bitmap(@"Icons\" + item.Icon + ".png");

            icon = new Bitmap(icon, e.Bounds.Height, e.Bounds.Height);
            graphics.FillRectangle(new TextureBrush(icon), e.Bounds.X, e.Bounds.Y, e.Bounds.Height, e.Bounds.Height);
            SizeF stringSize = graphics.MeasureString(item.Name, Font);
            Font  font       = (e.State & DrawItemState.Selected) == DrawItemState.Selected ? bold : Font;
            Color color      = item.Name == "None" ? Color.White : WoWHelper.QalityColor(item.Quality);

            graphics.DrawString(item.Name, font, new SolidBrush(color), 15, e.Bounds.Y + (e.Bounds.Height - stringSize.Height) / 2);
        }
示例#4
0
        //获取待上传的数据
        //获取后上传
        public void GetUpdateList(ItemsItem item)
        {
            //countUpdate++;
            List <DYGoods> listUpdateData = new List <DYGoods>();
            //获取有赞商店里商品的明细类别 如大小 L M 号的sku编码
            var skuRoot     = shopService.GetSku_Root(item.item_id, token);
            var itemDetails = skuRoot.response.item.skus;

            foreach (var itemDetail in itemDetails)
            {
                //编码处理
                string itemNo = string.Empty;
                int    index  = itemDetail.item_no.LastIndexOf("|");
                itemNo = index != -1 ? itemDetail.item_no.Substring(index + 1, itemDetail.item_no.Length - index - 1) : itemDetail.item_no;
                //获取erp系统中的库存明细
                var erpStorages = storeService.GetSrorage(listStockCk, itemNo);
                //计算库存量
                int qty = 0;
                foreach (var storage in erpStorages)
                {
                    int index1 = listStockCk.FindIndex(e => e == storage.StorageID);
                    if (index1 >= 0)
                    {
                        double a = Convert.ToDouble(storage.EndQty) * Convert.ToDouble(listStockPer[index1]);
                        if (a >= 1)
                        {
                            qty += Convert.ToInt32(Math.Floor(a));
                        }
                    }
                }
                listUpdateData.Add(new DYGoods {
                    ItemID = item.item_id, Qty = qty, ItemSku = itemDetail.sku_id.ToString()
                });
            }

            if (listUpdateData.Count == 0)
            {
                log.Error("erp系统中没有有赞商城的数据 itemId:" + item.item_id);
            }
            else
            {
                //同步数据
                foreach (var data in listUpdateData)
                {
                    if (data.Qty != item.quantity)
                    {
                        // log.Debug("准备开始同步 :" + CommonHelper.ToJson(data));
                        shopService.UpdateSrorage(data, token);
                        // log.Debug("同步成功 :" + CommonHelper.ToJson(data));
                    }
                    //else
                    //{
                    //    //log.Debug("库存数目与有赞商店相同不需要同步:" + CommonHelper.ToJson(data));
                    //}
                }
            }
            // log.Debug("已经库存同步了:" + countUpdate+"条数据");
        }
 public void GetItemList(string slot, string characterRace, string characterClass, CharacterModel character)
 {
     offHand             = character.Gear[17];
     this.character      = character;
     this.slot           = slot;
     this.characterRace  = characterRace;
     this.characterClass = characterClass;
     rotation            = 0;
     searchTextBox.Text  = "";
     SlotItems();
 }
 void itemsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     selected = (ItemsItem)itemsListBox.SelectedItem;
     if (selected.Name == "None")
     {
         reagentTooltip.Hide(itemsListBox);
     }
     else
     {
         reagentTooltip.Show(selected.Name, itemsListBox, itemsListBox.Size.Width, 0);
     }
 }
        void typeRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton radioButton = (RadioButton)sender;

            if (radioButton.Checked)
            {
                if (radioButton.Text == "Polearm" || radioButton.Text == "Staff" || radioButton.Text.Contains("2H"))
                {
                    character.Gear[17] = new ItemsItem
                    {
                        Name    = "None",
                        ID      = "0",
                        Quality = -1,
                        Icon    = WoWHelper.SlotIcon("offHand", characterClass)
                    };
                }
                else
                {
                    character.Gear[17] = offHand;
                }
                itemsListBox.Items.Clear();
                radioButton.Font = new Font(radioButton.Font, FontStyle.Bold);
                XmlSerializer serializer = new XmlSerializer(typeof(Items));
                using (StreamReader reader = new StreamReader(@"Data\" + ItemsFile(radioButton.Text) + "Items.xml"))
                {
                    items = (Items)serializer.Deserialize(reader.BaseStream);
                }
                RaceFilter();
                ClassFilter();
                SlotFilter();
                list.Clear();
                list.AddRange(items.Item);
                list.Sort((x, y) => x.Name.CompareTo(y.Name));
                item = new ItemsItem
                {
                    ID      = "0",
                    Name    = "None",
                    Type    = "",
                    Slot    = "",
                    Quality = -1,
                    Icon    = WoWHelper.SlotIcon(slot, characterClass)
                };
                itemsListBox.Items.Add(item);
                itemsListBox.Items.AddRange(list.ToArray());
                itemsListBox.SelectedIndex = 0;
            }
            else
            {
                radioButton.Font = new Font(radioButton.Font, FontStyle.Regular);
            }
        }
 void itemsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     selected = (ItemsItem)itemsListBox.SelectedItem;
     character.Gear[WoWHelper.Slot(slot)] = selected;
     if (selected.Name == "None")
     {
         cosmeticTooltip.Hide(itemsListBox);
     }
     else
     {
         cosmeticTooltip.Item = selected;
         cosmeticTooltip.Show(selected.Name, itemsListBox, itemsListBox.Size.Width + 6 + openGLControl.Width, 0);
     }
 }
 void itemsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     selected           = (ItemsItem)itemsListBox.SelectedItem;
     character.Gear[24] = selected;
     if (selected.Name == "None")
     {
         mountTooltip.Hide(itemsListBox);
         character.Mount(false);
     }
     else
     {
         mountTooltip.Item = selected;
         mountTooltip.Show(selected.Name, itemsListBox, itemsListBox.Size.Width + 6 + openGLControl.Width, 0);
         character.Mount(true);
     }
 }
 void itemsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     selected = (ItemsItem)itemsListBox.SelectedItem;
     character.Gear[WoWHelper.Slot(slot)] = selected;
     if (shieldRadioButton.Checked)
     {
         weaponTooltip.Hide(itemsListBox);
         heldInOffHandTooltip.Hide(itemsListBox);
         if (selected.Name == "None")
         {
             shieldTooltip.Hide(itemsListBox);
         }
         else
         {
             shieldTooltip.Item = selected;
             shieldTooltip.Show(selected.Name, itemsListBox, itemsListBox.Size.Width + 6 + openGLControl.Width, 0);
         }
     }
     else if (heldInOffHandRadioButton.Checked)
     {
         weaponTooltip.Hide(itemsListBox);
         shieldTooltip.Hide(itemsListBox);
         if (selected.Name == "None")
         {
             heldInOffHandTooltip.Hide(itemsListBox);
         }
         else
         {
             heldInOffHandTooltip.Item = selected;
             heldInOffHandTooltip.Show(selected.Name, itemsListBox, itemsListBox.Size.Width + 6 + openGLControl.Width, 0);
         }
     }
     else
     {
         shieldTooltip.Hide(itemsListBox);
         heldInOffHandTooltip.Hide(itemsListBox);
         if (selected.Name == "None")
         {
             weaponTooltip.Hide(itemsListBox);
         }
         else
         {
             weaponTooltip.Item = selected;
             weaponTooltip.Show(selected.Name, itemsListBox, itemsListBox.Size.Width + 6 + openGLControl.Width, 0);
         }
     }
 }