|
Eye of the Nile Docs
Everything you need to know to get started!
|
Implements the inventory slots in the ability inventory found in the skyhub. Adapted from InventorySlot.
Documentation updated 9/19/2024
Public Member Functions | |
| void | OnDrop (PointerEventData eventData) |
| When the user drops an item into this slot, run itemAccept() (unless this slot is full or only accepts a different item). | |
| Vector2 | GetPosition () |
| Returns the position of the slot. | |
| int | GetSlotNum () |
Public Attributes | |
| AbilityInventoryItemData | slotData |
| The ability item that this slot currently holds. | |
Events | |
| static Action< AbilityInventoryItemData, int > | receivedItem |
| Invoked when the slot receives an item. Contains the item data and slot ID number. | |
Private Member Functions | |
| void | OnEnable () |
| Shortly after the object is created or re-enabled, subscribe checkDuplicateName() to receivedItem and setTextboxes() to AbilityInventoryUI.abilityInventorySlotInitialized. | |
| void | OnDisable () |
| When the object is disabled, unsubscribe from all events. | |
| void | sendItem (int fromSlotNum, int toSlotNum) |
| void | itemAccepted (PointerEventData eventData, AbilityInventoryItemData itemData) |
| Add the item to the slot, updating the slot's data and textboxes. | |
| void | setTextboxes () |
| Displays details button (if enabled), and the name and level of the ability in this slot. | |
| void | checkDuplicateName (AbilityInventoryItemData thisSlot, int thisSlotNum) |
| Run when the slot receives an item. If the name of the item dropped into this slot is the same as an item in another slot, remove the duplicate item. | |
Private Attributes | |
| int | slotNum = -1 |
| The ID number of this slot. -1 is a default value to represent an error. | |
| bool | enableDetailsButton = true |
| If true, the details button will be displayed beneath the slot that displays extra info about the ability. Disabled for the 4 active ability slots at the bottom of the ability inventory. | |
| bool | acceptsOnlyOneItem = true |
| If enabled, the user can only drop acceptedItem into this slot. Enabled for the 9 inventory slots at the top. | |
| AbilityInventoryItemData | acceptedItem |
| If acceptsOnlyOneItem is true, this is the item this slot will accept and others will be rejected. | |
| int | holdSlotNum = 200 |
|
private |
Run when the slot receives an item. If the name of the item dropped into this slot is the same as an item in another slot, remove the duplicate item.
| Vector2 AbilityInventorySlot.GetPosition | ( | ) |
Returns the position of the slot.
| int AbilityInventorySlot.GetSlotNum | ( | ) |
|
private |
Add the item to the slot, updating the slot's data and textboxes.
|
private |
When the object is disabled, unsubscribe from all events.
| void AbilityInventorySlot.OnDrop | ( | PointerEventData | eventData | ) |
When the user drops an item into this slot, run itemAccept() (unless this slot is full or only accepts a different item).
|
private |
Shortly after the object is created or re-enabled, subscribe checkDuplicateName() to receivedItem and setTextboxes() to AbilityInventoryUI.abilityInventorySlotInitialized.
|
private |
Move item from one slot to another slot in the ability inventory menu. This will replace the data in the destination slot, so use the hold slot (slot #200) to swap item spots.
|
private |
Displays details button (if enabled), and the name and level of the ability in this slot.
|
private |
If acceptsOnlyOneItem is true, this is the item this slot will accept and others will be rejected.
|
private |
If enabled, the user can only drop acceptedItem into this slot. Enabled for the 9 inventory slots at the top.
|
private |
If true, the details button will be displayed beneath the slot that displays extra info about the ability. Disabled for the 4 active ability slots at the bottom of the ability inventory.
|
private |
This is the slot number of the hold slot, a slot that this script utilizes to make it easier to move items around. The hold slot should never be visible in-game. This variable exists only to make it easier to change which slot is considered the hold slot, if ever necessary.
| AbilityInventoryItemData AbilityInventorySlot.slotData |
The ability item that this slot currently holds.
|
private |
The ID number of this slot. -1 is a default value to represent an error.
|
static |
Invoked when the slot receives an item. Contains the item data and slot ID number.