コード例 #1
0
        /// <summary>
        /// Attempts to use an item on the inventory
        /// </summary>
        /// <param name="index">The index to use</param>
        public void UseItem(int index)
        {
            if (index >= entities.Count || index < 0)
            {
                throw new System.ArgumentOutOfRangeException("Index is out of range!");
            }

            entities[index].Call("onItemUse");
            OnItemUse?.Invoke(entities[index]);
        }
コード例 #2
0
 private static int OnUseItem(void *pCreature, uint oidItem, byte nActivePropertyIndex, byte nSubPropertyIndex, uint oidTarget, Vector3 vTargetPosition, uint oidArea, int bUseCharges)
 {
     OnItemUse eventData = ProcessEvent(new OnItemUse
     {
         UsedBy               = CNWSCreature.FromPointer(pCreature).ToNwObject <NwCreature>() !,
         Item                 = oidItem.ToNwObject <NwItem>() !,
         TargetObject         = oidTarget.ToNwObject <NwGameObject>() !,
         ItemPropertyIndex    = nActivePropertyIndex,
         ItemSubPropertyIndex = nSubPropertyIndex,
         TargetPosition       = vTargetPosition,
         TargetArea           = oidArea.ToNwObject <NwArea>() !,
         UseCharges           = bUseCharges.ToBool(),
     });
コード例 #3
0
        public void Init()
        {
            equipmentManager = GameController.instance.playerManager.equipmentManager;
            equipmentManager.onItemUnequip += AddAfterUnequip;
            equipmentManager.onItemEquip   += Remove;

            onItemUse = null;
            onLoot    = null;
            onItemsChangedCallback = null;
            onLootEnd = null;

            defaultItemGameObject = Resources.Load <GameObject>("Equipments/EmptyItem");
        }
コード例 #4
0
        public PlayerInventory(int slotCount, int maxWeight)
        {
            CurrentSelected = -1;
            Slots           = new Dictionary <int, InventorySlot>();
            for (int i = 0; i < slotCount; ++i)
            {
                InventorySlot inventorySlot = new InventorySlot(i, maxWeight);
                inventorySlot.OnSet                    = (id, item) => { OnSet.Invoke(id, item); };
                inventorySlot.OnSetCount               = (id, count) => { OnSetCount.Invoke(id, count); };
                inventorySlot.OnUse                    = (item) => { OnItemUse.Invoke(item); };
                inventorySlot.OnEmptyHighlight        += (id) => { OnEmptyHighlight.Invoke(id); };
                inventorySlot.OnAvailableHighlight    += (id) => { OnAvailableHighlight.Invoke(id); };
                inventorySlot.OnInaccessibleHighlight += (id) => { OnInaccessibleHighlight.Invoke(id); };
                inventorySlot.OnOffHighlight          += (id) => { OnOffHighlight.Invoke(id); };

                HighlightSlot    += inventorySlot.Highlight;
                OffHighlightSlot += inventorySlot.OffHighlight;

                Slots.Add(i, inventorySlot);
            }
        }
コード例 #5
0
 protected void Used()
 {
     OnItemUse.Invoke(this);
 }
コード例 #6
0
 public static void InvokeOnItemUse(Mobile from, Item item)
 {
     OnItemUse?.Invoke(from, item);
 }
コード例 #7
0
ファイル: EventSink_Items.cs プロジェクト: jizzyjim/16Below
 public static void InvokeOnItemUse(OnItemUseEventArgs e)
 {
     OnItemUse?.Invoke(e);
 }