private void CharacterSlot_MouseClick(object sender, MouseEventArgs e) { CharacterSlot senderObj = (CharacterSlot)sender; Character senderChar = senderObj.OChar; int index = CurrentAccount.Characters.IndexOf(senderChar); lastSelectedCharacterSlot = CurrentAccount.Characters[index]; if (e.Button == MouseButtons.Right) { contextMenuCharacter.Show(Cursor.Position); return; } //Ignore if already highlighted! if (senderObj.IsHighlighted) { return; } for (int i = 0; i < flowlayout_Characters.Controls.Count; i++) { CharacterSlot obj = ((CharacterSlot)flowlayout_Characters.Controls[i]); if (obj.Equals(senderObj)) { obj.IsHighlighted = true; obj.Invalidate(); continue; } obj.IsHighlighted = false; obj.BackColor = Color.Transparent; obj.Invalidate(); } panel_Items.Controls.Clear(); InventoryControl newInv = new InventoryControl(senderChar.InventoryItems, 10, 6); newInv.OnItemSelected += OnItemSelected; newInv.Dock = DockStyle.Fill; panel_Items.Controls.Add(newInv); //Clear Item Viewer itemViewer.CurrentItem = null; itemViewer.Invalidate(); //MessageBox.Show(CurrentAccount.Characters[index].InventoryItems.Count.ToString()); }
private void LoadCharacterData(string File) { CurrentAccount = Account.DeserializeFromXML(File); AllItems = new List <TrackedItem>(CurrentAccount.StashedItems); foreach (var i in CurrentAccount.Characters) { CharacterSlot cs = new CharacterSlot(i); AllItems.AddRange(i.InventoryItems); AllItems.AddRange(i.EquippedItems); cs.OnMouseClicked += CharacterSlot_MouseClick; flowlayout_Characters.Controls.Add(cs); } AllItems = AllItems.OrderBy(i => i.Name).ToList(); label1.Text = "Total Items: " + AllItems.Count.ToString(); }
private void LoadCharacterData(string File) { CurrentAccount = Account.DeserializeFromXML(File); AllItems = new List<TrackedItem>(CurrentAccount.StashedItems); foreach (var i in CurrentAccount.Characters) { CharacterSlot cs = new CharacterSlot(i); AllItems.AddRange(i.InventoryItems); AllItems.AddRange(i.EquippedItems); cs.OnMouseClicked += CharacterSlot_MouseClick; flowlayout_Characters.Controls.Add(cs); } AllItems = AllItems.OrderBy(i => i.Name).ToList(); label1.Text = "Total Items: " + AllItems.Count.ToString(); }
protected bool Equals(CharacterSlot other) { return(Equals(OChar, other.OChar)); }
protected bool Equals(CharacterSlot other) { return Equals(OChar, other.OChar); }