コード例 #1
0
        private void InventoryList_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                try
                {
                    InventoryList.SelectedIndex = InventoryList.IndexFromPoint(e.Location);
                    if (InventoryList.SelectedIndex != -1)
                    {
                        Armor selected = InventoryList.Items[InventoryList.SelectedIndex] as Armor;
                        if (relicsToolStripMenuItem.Text.Equals("Relics"))
                        {
                            // change equipment
                            Armor old = p.Set.Armor[selected.Piece];
                            p.Set.Armor[selected.Piece] = selected;
                            p.Inventory.Add(old);
                            p.Inventory.Remove(selected);

                            if (selectedArmor != null && selectedArmor.Name.Equals(selected.Name))
                            {
                                selectedArmor       = null;
                                SelectedArmor.Text  = "";
                                SelectedSkills.Text = "";
                            }

                            UpdateInventory();
                        }
                        else
                        {
                            // place in group for relic creation
                            UpdateRelicSkillDisplay(selected);
                        }
                    }
                }
                catch (NullReferenceException) { }
            }
        }