Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
AbilityInventorySlot Class Reference

Detailed Description

Implements the inventory slots in the ability inventory found in the skyhub. Adapted from InventorySlot.

Documentation updated 9/19/2024

Author
Stephen Nuttall, Alexander Art

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
 

Member Function Documentation

◆ checkDuplicateName()

void AbilityInventorySlot.checkDuplicateName ( AbilityInventoryItemData thisSlot,
int thisSlotNum )
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.

◆ GetPosition()

Vector2 AbilityInventorySlot.GetPosition ( )

Returns the position of the slot.

◆ GetSlotNum()

int AbilityInventorySlot.GetSlotNum ( )

◆ itemAccepted()

void AbilityInventorySlot.itemAccepted ( PointerEventData eventData,
AbilityInventoryItemData itemData )
private

Add the item to the slot, updating the slot's data and textboxes.

◆ OnDisable()

void AbilityInventorySlot.OnDisable ( )
private

When the object is disabled, unsubscribe from all events.

◆ OnDrop()

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).

◆ OnEnable()

void AbilityInventorySlot.OnEnable ( )
private

Shortly after the object is created or re-enabled, subscribe checkDuplicateName() to receivedItem and setTextboxes() to AbilityInventoryUI.abilityInventorySlotInitialized.

◆ sendItem()

void AbilityInventorySlot.sendItem ( int fromSlotNum,
int toSlotNum )
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.

◆ setTextboxes()

void AbilityInventorySlot.setTextboxes ( )
private

Displays details button (if enabled), and the name and level of the ability in this slot.

Member Data Documentation

◆ acceptedItem

AbilityInventoryItemData AbilityInventorySlot.acceptedItem
private

If acceptsOnlyOneItem is true, this is the item this slot will accept and others will be rejected.

◆ acceptsOnlyOneItem

bool AbilityInventorySlot.acceptsOnlyOneItem = true
private

If enabled, the user can only drop acceptedItem into this slot. Enabled for the 9 inventory slots at the top.

◆ enableDetailsButton

bool AbilityInventorySlot.enableDetailsButton = true
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.

◆ holdSlotNum

int AbilityInventorySlot.holdSlotNum = 200
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.

◆ slotData

AbilityInventoryItemData AbilityInventorySlot.slotData

The ability item that this slot currently holds.

◆ slotNum

int AbilityInventorySlot.slotNum = -1
private

The ID number of this slot. -1 is a default value to represent an error.

Event Documentation

◆ receivedItem

Action<AbilityInventoryItemData, int> AbilityInventorySlot.receivedItem
static

Invoked when the slot receives an item. Contains the item data and slot ID number.


The documentation for this class was generated from the following file: