Corgi Engine  v8.8
MoreMountains.InventoryEngine.InventorySlot Class Reference

This class handles the display of the items in an inventory and will trigger the various things you can do with an item (equip, use, etc.) More...

Inheritance diagram for MoreMountains.InventoryEngine.InventorySlot:

Public Member Functions

virtual void DrawIcon (InventoryItem item, int index)
 If there's an item in this slot, draws its icon inside. More...
 
virtual void SetIcon (Sprite newSprite)
 
virtual void SetQuantity (int quantity)
 
virtual void DisableIconAndQuantity ()
 
override void OnSelect (BaseEventData eventData)
 When that slot gets selected (via a mouse over or a touch), triggers an event for other classes to act on More...
 
virtual void SlotClicked ()
 When that slot gets clicked, triggers an event for other classes to act on More...
 
virtual void Move ()
 Selects the item in this slot for a movement, or moves the currently selected one to that slot This will also swap both objects if possible More...
 
virtual void Use ()
 Consume one unity of the item in this slot, triggering a sound and whatever behaviour has been defined for this item being used More...
 
virtual void Equip ()
 Equip this item if possible. More...
 
virtual void UnEquip ()
 Unequip this item if possible. More...
 
virtual void Drop ()
 Drops this item. More...
 
virtual void DisableSlot ()
 Disables the slot. More...
 
virtual void EnableSlot ()
 Enables the slot. More...
 
virtual bool Equippable ()
 Returns true if the item at this slot can be equipped, false otherwise More...
 
virtual bool Usable ()
 Returns true if the item at this slot can be used, false otherwise More...
 
virtual bool Movable ()
 Returns true if the item at this slot can be dropped, false otherwise More...
 
virtual bool Droppable ()
 Returns true if the item at this slot can be dropped, false otherwise More...
 
virtual bool Unequippable ()
 Returns true if the item at this slot can be dropped, false otherwise More...
 
virtual bool EquipUseButtonShouldShow ()
 
virtual bool MoveButtonShouldShow ()
 
virtual bool DropButtonShouldShow ()
 
virtual bool EquipButtonShouldShow ()
 
virtual bool UseButtonShouldShow ()
 
virtual bool UnequipButtonShouldShow ()
 

Public Attributes

Sprite MovedSprite
 the sprite used as a background for the slot while an item is being moved More...
 
InventoryDisplay ParentInventoryDisplay
 the inventory display this slot belongs to More...
 
int Index
 the slot's index (its position in the inventory array) More...
 
bool SlotEnabled =true
 whether or not this slot is currently enabled and can be interacted with More...
 
Image TargetImage
 
CanvasGroup TargetCanvasGroup
 
RectTransform TargetRectTransform
 
RectTransform IconRectTransform
 
Image IconImage
 
Text QuantityText
 

Protected Member Functions

override void Awake ()
 
override void Start ()
 On Start, we start listening to click events on that slot More...
 

Static Protected Attributes

const float _disabledAlpha = 0.5f
 
const float _enabledAlpha = 1.0f
 

Detailed Description

This class handles the display of the items in an inventory and will trigger the various things you can do with an item (equip, use, etc.)

Member Function Documentation

◆ Awake()

override void MoreMountains.InventoryEngine.InventorySlot.Awake ( )
protected

◆ DisableIconAndQuantity()

virtual void MoreMountains.InventoryEngine.InventorySlot.DisableIconAndQuantity ( )
virtual

◆ DisableSlot()

virtual void MoreMountains.InventoryEngine.InventorySlot.DisableSlot ( )
virtual

Disables the slot.

◆ DrawIcon()

virtual void MoreMountains.InventoryEngine.InventorySlot.DrawIcon ( InventoryItem  item,
int  index 
)
virtual

If there's an item in this slot, draws its icon inside.

Parameters
itemItem.
indexIndex.

◆ Drop()

virtual void MoreMountains.InventoryEngine.InventorySlot.Drop ( )
virtual

Drops this item.

◆ DropButtonShouldShow()

virtual bool MoreMountains.InventoryEngine.InventorySlot.DropButtonShouldShow ( )
virtual

◆ Droppable()

virtual bool MoreMountains.InventoryEngine.InventorySlot.Droppable ( )
virtual

Returns true if the item at this slot can be dropped, false otherwise

◆ EnableSlot()

virtual void MoreMountains.InventoryEngine.InventorySlot.EnableSlot ( )
virtual

Enables the slot.

◆ Equip()

virtual void MoreMountains.InventoryEngine.InventorySlot.Equip ( )
virtual

Equip this item if possible.

◆ EquipButtonShouldShow()

virtual bool MoreMountains.InventoryEngine.InventorySlot.EquipButtonShouldShow ( )
virtual

◆ Equippable()

virtual bool MoreMountains.InventoryEngine.InventorySlot.Equippable ( )
virtual

Returns true if the item at this slot can be equipped, false otherwise

◆ EquipUseButtonShouldShow()

virtual bool MoreMountains.InventoryEngine.InventorySlot.EquipUseButtonShouldShow ( )
virtual

◆ Movable()

virtual bool MoreMountains.InventoryEngine.InventorySlot.Movable ( )
virtual

Returns true if the item at this slot can be dropped, false otherwise

◆ Move()

virtual void MoreMountains.InventoryEngine.InventorySlot.Move ( )
virtual

Selects the item in this slot for a movement, or moves the currently selected one to that slot This will also swap both objects if possible

◆ MoveButtonShouldShow()

virtual bool MoreMountains.InventoryEngine.InventorySlot.MoveButtonShouldShow ( )
virtual

◆ OnSelect()

override void MoreMountains.InventoryEngine.InventorySlot.OnSelect ( BaseEventData  eventData)

When that slot gets selected (via a mouse over or a touch), triggers an event for other classes to act on

Parameters
eventDataEvent data.

◆ SetIcon()

virtual void MoreMountains.InventoryEngine.InventorySlot.SetIcon ( Sprite  newSprite)
virtual

◆ SetQuantity()

virtual void MoreMountains.InventoryEngine.InventorySlot.SetQuantity ( int  quantity)
virtual

◆ SlotClicked()

virtual void MoreMountains.InventoryEngine.InventorySlot.SlotClicked ( )
virtual

When that slot gets clicked, triggers an event for other classes to act on

◆ Start()

override void MoreMountains.InventoryEngine.InventorySlot.Start ( )
protected

On Start, we start listening to click events on that slot

◆ UnEquip()

virtual void MoreMountains.InventoryEngine.InventorySlot.UnEquip ( )
virtual

Unequip this item if possible.

◆ UnequipButtonShouldShow()

virtual bool MoreMountains.InventoryEngine.InventorySlot.UnequipButtonShouldShow ( )
virtual

◆ Unequippable()

virtual bool MoreMountains.InventoryEngine.InventorySlot.Unequippable ( )
virtual

Returns true if the item at this slot can be dropped, false otherwise

◆ Usable()

virtual bool MoreMountains.InventoryEngine.InventorySlot.Usable ( )
virtual

Returns true if the item at this slot can be used, false otherwise

◆ Use()

virtual void MoreMountains.InventoryEngine.InventorySlot.Use ( )
virtual

Consume one unity of the item in this slot, triggering a sound and whatever behaviour has been defined for this item being used

◆ UseButtonShouldShow()

virtual bool MoreMountains.InventoryEngine.InventorySlot.UseButtonShouldShow ( )
virtual

Member Data Documentation

◆ _disabledAlpha

const float MoreMountains.InventoryEngine.InventorySlot._disabledAlpha = 0.5f
staticprotected

◆ _enabledAlpha

const float MoreMountains.InventoryEngine.InventorySlot._enabledAlpha = 1.0f
staticprotected

◆ IconImage

Image MoreMountains.InventoryEngine.InventorySlot.IconImage

◆ IconRectTransform

RectTransform MoreMountains.InventoryEngine.InventorySlot.IconRectTransform

◆ Index

int MoreMountains.InventoryEngine.InventorySlot.Index

the slot's index (its position in the inventory array)

◆ MovedSprite

Sprite MoreMountains.InventoryEngine.InventorySlot.MovedSprite

the sprite used as a background for the slot while an item is being moved

◆ ParentInventoryDisplay

InventoryDisplay MoreMountains.InventoryEngine.InventorySlot.ParentInventoryDisplay

the inventory display this slot belongs to

◆ QuantityText

Text MoreMountains.InventoryEngine.InventorySlot.QuantityText

◆ SlotEnabled

bool MoreMountains.InventoryEngine.InventorySlot.SlotEnabled =true

whether or not this slot is currently enabled and can be interacted with

◆ TargetCanvasGroup

CanvasGroup MoreMountains.InventoryEngine.InventorySlot.TargetCanvasGroup

◆ TargetImage

Image MoreMountains.InventoryEngine.InventorySlot.TargetImage

◆ TargetRectTransform

RectTransform MoreMountains.InventoryEngine.InventorySlot.TargetRectTransform

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