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

Special kind of inventory display, with a dedicated key associated to it, to allow for shortcuts for use and equip More...

Inheritance diagram for MoreMountains.InventoryEngine.InventoryHotbar:
MoreMountains.InventoryEngine.InventoryDisplay MoreMountains.Tools.MMEventListener< MMInventoryEvent >

Public Types

enum  HotbarPossibleAction { HotbarPossibleAction.Use, HotbarPossibleAction.Equip }
 the possible actions that can be done on objects in the hotbar More...
 

Public Member Functions

virtual void Action ()
 Executed when the key or alt key gets pressed, triggers the specified action More...
 
- Public Member Functions inherited from MoreMountains.InventoryEngine.InventoryDisplay
virtual void SetupInventoryDisplay ()
 Creates and sets up the inventory display (usually called via the inspector's dedicated button) More...
 
virtual void Focus ()
 
Sets the focus on the first item of the inventory
More...
 
virtual InventorySlot CurrentlySelectedInventorySlot ()
 Returns the currently selected inventory slot More...
 
virtual void SetCurrentlySelectedSlot (InventorySlot slot)
 Sets the currently selected slot More...
 
virtual InventoryDisplay GoToInventory (int direction)
 Goes to the previous (-1) or next (1) inventory, based on the int direction passed in parameter. More...
 
virtual void SetReturnInventory (InventoryDisplay inventoryDisplay)
 Sets the return inventory display More...
 
virtual void ReturnInventoryFocus ()
 If possible, returns the focus to the current return inventory focus (after equipping an item, usually) More...
 
virtual void DisableAllBut (ItemClasses itemClass)
 Disables all the slots in the inventory display, except those from a certain class More...
 
virtual void ResetDisabledStates ()
 Enables back all slots (usually after having disabled some of them) More...
 
virtual void OnMMEvent (MMInventoryEvent inventoryEvent)
 Catches MMInventoryEvents and acts on them More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMInventoryEvent >
void OnMMEvent (T eventType)
 

Public Attributes

string HotbarKey
 the key associated to the hotbar, that will trigger the action when pressed More...
 
string HotbarAltKey
 the alt key associated to the hotbar More...
 
HotbarPossibleAction ActionOnKey
 the action associated to the key or alt key press More...
 
- Public Attributes inherited from MoreMountains.InventoryEngine.InventoryDisplay
string TargetInventoryName = "MainInventory"
 the name of the inventory to display More...
 
string PlayerID = "Player1"
 
int NumberOfRows = 3
 the number of rows to display More...
 
int NumberOfColumns = 2
 the number of columns to display More...
 
InventoryDisplay TargetChoiceInventory
 
ItemClasses ItemClass
 
bool DrawEmptySlots =true
 if this is true, we'll draw slots even if they don't contain an object. Otherwise we don't draw them More...
 
bool AllowMovingObjectsToThisInventory = false
 if this is true, the Player will be allowed to move objects from another inventory to this one, using the Move button More...
 
int PaddingTop = 20
 The internal margin between the top of the inventory panel and the first slots. More...
 
int PaddingRight = 20
 The internal margin between the right of the inventory panel and the last slots. More...
 
int PaddingBottom = 20
 The internal margin between the bottom of the inventory panel and the last slots. More...
 
int PaddingLeft = 20
 The internal margin between the left of the inventory panel and the first slots. More...
 
InventorySlot SlotPrefab
 the game object to use as a Slot. If left empty, one will be automatically created at runtime
More...
 
Vector2 SlotSize = new Vector2(50,50)
 the horizontal and vertical size of the slots More...
 
Vector2 IconSize = new Vector2(30,30)
 the size of the icon in each slot More...
 
Vector2 SlotMargin = new Vector2(5,5)
 the horizontal and vertical margin to apply between slots rows and columns More...
 
Sprite EmptySlotImage
 The image to set as the background of each slot when the slot is empty. More...
 
Sprite FilledSlotImage
 The image to set as the background of each slot when the slot is not empty. More...
 
Sprite HighlightedSlotImage
 The image to set as the background of each slot when the slot is highlighted. More...
 
Sprite PressedSlotImage
 The image to set as the background of each slot when the slot is pressed. More...
 
Sprite DisabledSlotImage
 The image to set as the background of each slot when the slot is disabled. More...
 
Sprite MovedSlotImage
 The image to set as the background of each slot when the item in the slot is being moved around. More...
 
Image.Type SlotImageType
 The type of the image (sliced, normal, tiled...) More...
 
bool EnableNavigation = true
 if true, the engine will automatically create bindings to navigate through the different slots using keyboard or gamepad. More...
 
bool GetFocusOnStart = false
 if this is true, this inventory display will get the focus on start More...
 
bool DisplayTitle =true
 if true, will display the panel's title More...
 
string Title
 the title for the inventory that will be displayed More...
 
Font TitleFont
 the font used to display the quantity More...
 
int TitleFontSize =20
 the font size to use More...
 
Color TitleColor = Color.black
 the color to display the quantity in More...
 
Vector3 TitleOffset =Vector3.zero
 the padding (distance to the slot's edge) More...
 
TextAnchor TitleAlignment = TextAnchor.LowerRight
 where the quantity should be displayed More...
 
Font QtyFont
 the font used to display the quantity More...
 
int QtyFontSize =12
 the font size to use More...
 
Color QtyColor = Color.black
 the color to display the quantity in More...
 
float QtyPadding =10f
 the padding (distance to the slot's edge) More...
 
TextAnchor QtyAlignment = TextAnchor.LowerRight
 where the quantity should be displayed More...
 
InventoryDisplay PreviousInventory
 
InventoryDisplay NextInventory
 

Protected Member Functions

override void OnEnable ()
 On Enable, we start listening for MMInventoryEvents More...
 
override void OnDisable ()
 On Disable, we stop listening for MMInventoryEvents More...
 
- Protected Member Functions inherited from MoreMountains.InventoryEngine.InventoryDisplay
virtual void Awake ()
 On Awake, initializes the various lists used to keep track of the content of the inventory More...
 
virtual void RedrawInventoryDisplay ()
 Redraws the inventory display's contents when needed (usually after a change in the target inventory) More...
 
virtual void InitializeSprites ()
 Initializes the sprites. More...
 
virtual void DrawInventoryTitle ()
 Adds and sets up the inventory title child object More...
 
virtual void AddGridLayoutGroup ()
 Adds a grid layout group if there ain't one already More...
 
virtual void ResizeInventoryDisplay ()
 Resizes the inventory panel, taking into account the number of rows/columns, the padding and margin More...
 
virtual void DrawInventoryContent ()
 Draws the content of the inventory (slots and icons) More...
 
virtual void ContentHasChanged ()
 If the content has changed, we draw our inventory panel again More...
 
virtual void FillLastUpdateContent ()
 Fills the last content of the update. More...
 
virtual void UpdateInventoryContent ()
 Draws the content of the inventory (slots and icons) More...
 
virtual void UpdateSlot (int i)
 Updates the slot's content and appearance More...
 
virtual void InitializeSlotPrefab ()
 Creates the slot prefab to use in all slot creations More...
 
virtual void DrawSlot (int i)
 Draws the slot and its content (icon, quantity...). More...
 
virtual void SetupSlotNavigation ()
 Setups the slot navigation using Unity's GUI built-in system, so that the user can move using the left/right/up/down arrows More...
 

Additional Inherited Members

- Static Public Attributes inherited from MoreMountains.InventoryEngine.InventoryDisplay
static InventoryDisplay CurrentlyBeingMovedFromInventoryDisplay
 the item currently being moved More...
 
static int CurrentlyBeingMovedItemIndex = -1
 
- Static Protected Member Functions inherited from MoreMountains.InventoryEngine.InventoryDisplay
static void InitializeStatics ()
 
- Protected Attributes inherited from MoreMountains.InventoryEngine.InventoryDisplay
Inventory _targetInventory = null
 
List< ItemQuantity_contentLastUpdate
 
List< int > _comparison
 
SpriteState _spriteState = new SpriteState()
 
InventorySlot _currentlySelectedSlot
 
InventorySlot _slotPrefab = null
 
- Properties inherited from MoreMountains.InventoryEngine.InventoryDisplay
Inventory TargetInventory [get]
 Grabs the target inventory based on its name More...
 
virtual int InventorySize [get, set]
 the total number of slots in this inventory More...
 
virtual GridLayoutGroup InventoryGrid [get, protected set]
 the grid layout used to display the inventory in rows and columns More...
 
virtual InventoryDisplayTitle InventoryTitle [get, protected set]
 the gameobject used to display the inventory's name More...
 
virtual RectTransform InventoryRectTransform [get]
 the main panel More...
 
virtual List< InventorySlotSlotContainer [get, protected set]
 an internal list of slots More...
 
virtual InventoryDisplay ReturnInventory [get, protected set]
 the inventory the focus should return to after an action More...
 
virtual bool IsOpen [get, protected set]
 whether this inventory display is open or not More...
 
virtual bool InEquipSelection [get, set]
 

Detailed Description

Special kind of inventory display, with a dedicated key associated to it, to allow for shortcuts for use and equip

Member Enumeration Documentation

◆ HotbarPossibleAction

the possible actions that can be done on objects in the hotbar

Enumerator
Use 
Equip 

Member Function Documentation

◆ Action()

virtual void MoreMountains.InventoryEngine.InventoryHotbar.Action ( )
virtual

Executed when the key or alt key gets pressed, triggers the specified action

◆ OnDisable()

override void MoreMountains.InventoryEngine.InventoryHotbar.OnDisable ( )
protectedvirtual

On Disable, we stop listening for MMInventoryEvents

Reimplemented from MoreMountains.InventoryEngine.InventoryDisplay.

◆ OnEnable()

override void MoreMountains.InventoryEngine.InventoryHotbar.OnEnable ( )
protectedvirtual

On Enable, we start listening for MMInventoryEvents

Reimplemented from MoreMountains.InventoryEngine.InventoryDisplay.

Member Data Documentation

◆ ActionOnKey

HotbarPossibleAction MoreMountains.InventoryEngine.InventoryHotbar.ActionOnKey

the action associated to the key or alt key press

◆ HotbarAltKey

string MoreMountains.InventoryEngine.InventoryHotbar.HotbarAltKey

the alt key associated to the hotbar

◆ HotbarKey

string MoreMountains.InventoryEngine.InventoryHotbar.HotbarKey

the key associated to the hotbar, that will trigger the action when pressed


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