private void DropSlot_DropOccurred(DropSlot slot, API.Serialization.Interfaces.IRiotDroppable drop) { int index = this.dropSlots.IndexOf(slot); ItemInfo old_item = this.BuySet.GetItemAt(index); old_item.PricingStyleChanged -= this.ItemInfo_PricingStyleChanged; this.BuySet.RemoveItemAt(index); if (drop == null) { this.layoutMain.Controls.Remove(slot); this.dropSlots.Remove(slot); slot = null; } else { this.BuySet.AddItem(drop as ItemInfo); slot.Set(drop); } this.UpdateCost(); return; }
private void AddItem(string name) { ItemInfo item = Engine.Items.Get(name); this.BuySet.AddItem(item); item.PricingStyleChanged += this.ItemInfo_PricingStyleChanged; DropSlot box = new DropSlot { BorderStyle = BorderStyle.None, Dock = DockStyle.Left, ForeColor = Color.Black, Margin = new Padding(10, 0, 10, 0), Size = new Size(110, 110), Type = DropSlot.DataTypes.ItemBuy, }; this.dropSlots.Add(box); box.Set(item); box.DropOccurred += this.DropSlot_DropOccurred; this.layoutMain.Controls.Add(box); this.UpdateCost(); return; }