Пример #1
0
        public void RefreshItems()
        {
            mMenuEntries.Clear();
            for (int i = 0; i < mCharacter.EquippedInventory.Count; ++i)
            {
                if (mCharacter.EquippedInventory[i] == null)
                {
                    continue;
                }
                EquippedInventoryMenuEntry newEntry = new EquippedInventoryMenuEntry(mCharacter.EquippedInventory[i].Name, mCharacter.EquippedInventory[i]);
                newEntry.Unequip += UnequipHandler;
                mMenuEntries.Add(newEntry);
            }

            for (int i = 0; i < mCharacter.FreeInventory.Count; ++i)
            {
                FreeInventoryMenuEntry newEntry = new FreeInventoryMenuEntry(mCharacter.FreeInventory[i].Name);
                newEntry.Item     = mCharacter.FreeInventory[i];
                newEntry.Discard += DiscardHandler;
                newEntry.Equip   += EquipHandler;
                mMenuEntries.Add(newEntry);
            }

            if (mSelectedEntryIndex >= mMenuEntries.Count)
            {
                mSelectedEntryIndex = mMenuEntries.Count - 1;
            }
        }
Пример #2
0
        public void RefreshItems()
        {
            mMenuEntries.Clear();
            for (int i = 0; i < mCharacter.EquippedInventory.Count; ++i)
            {
                if (mCharacter.EquippedInventory[i] == null)
                    continue;
                EquippedInventoryMenuEntry newEntry = new EquippedInventoryMenuEntry(mCharacter.EquippedInventory[i].Name, mCharacter.EquippedInventory[i]);
                newEntry.Unequip += UnequipHandler;
                mMenuEntries.Add(newEntry);
            }

            for (int i = 0; i < mCharacter.FreeInventory.Count; ++i)
            {
                FreeInventoryMenuEntry newEntry = new FreeInventoryMenuEntry(mCharacter.FreeInventory[i].Name);
                newEntry.Item = mCharacter.FreeInventory[i];
                newEntry.Discard += DiscardHandler;
                newEntry.Equip += EquipHandler;
                mMenuEntries.Add(newEntry);
            }

            if (mSelectedEntryIndex >= mMenuEntries.Count)
                mSelectedEntryIndex = mMenuEntries.Count - 1;
        }
Пример #3
0
        private void EquipHandler(object sender, EventArgs e)
        {
            FreeInventoryMenuEntry entry = (FreeInventoryMenuEntry)sender;

            Manager.AddWindow(new EquipSlotMenu((EquippableItem)(entry.Item)), ControllingPlayer);
        }
Пример #4
0
        private void DiscardHandler(object sender, EventArgs e)
        {
            FreeInventoryMenuEntry entry = sender as FreeInventoryMenuEntry;

            mCharacter.DropItem(entry.Item);
        }