Corgi Engine v9.4
Loading...
Searching...
No Matches
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< T > MoreMountains.Tools.MMEventListenerBase

Public Types

enum  HotbarPossibleAction { Use , 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.
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)
virtual void Initialization (bool forceRedraw=false)
 Initializes lists and redraws the inventory display.
virtual void Focus ()
 
Sets the focus on the first item of the inventory
virtual InventorySlot CurrentlySelectedInventorySlot ()
 Returns the currently selected inventory slot.
virtual void SetCurrentlySelectedSlot (InventorySlot slot)
 Sets the currently selected slot.
virtual InventoryDisplay GoToInventory (int direction)
 Goes to the previous (-1) or next (1) inventory, based on the int direction passed in parameter.
virtual void SetReturnInventory (InventoryDisplay inventoryDisplay)
 Sets the return inventory display.
virtual void ReturnInventoryFocus ()
 If possible, returns the focus to the current return inventory focus (after equipping an item, usually)
virtual void DisableAllBut (ItemClasses itemClass)
 Disables all the slots in the inventory display, except those from a certain class.
virtual void ResetDisabledStates ()
 Enables back all slots (usually after having disabled some of them)
virtual void ChangeTargetInventory (string newInventoryName)
 A public method you can use to change the target inventory of this display to a new inventory.
virtual void OnMMEvent (MMInventoryEvent inventoryEvent)
 Catches MMInventoryEvents and acts on them.
Public Member Functions inherited from MoreMountains.Tools.MMEventListener< T >
void OnMMEvent (T eventType)

Public Attributes

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

Protected Member Functions

override void OnEnable ()
 On Enable, we start listening for MMInventoryEvents.
override void OnDisable ()
 On Disable, we stop listening for MMInventoryEvents.
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.
virtual void RedrawInventoryDisplay ()
 Redraws the inventory display's contents when needed (usually after a change in the target inventory)
virtual void InitializeSprites ()
 Initializes the sprites.
virtual void DrawInventoryTitle ()
 Adds and sets up the inventory title child object.
virtual void AddGridLayoutGroup ()
 Adds a grid layout group if there ain't one already.
virtual void ResizeInventoryDisplay ()
 Resizes the inventory panel, taking into account the number of rows/columns, the padding and margin.
virtual void DrawInventoryContent ()
 Draws the content of the inventory (slots and icons)
virtual void ContentHasChanged ()
 If the content has changed, we draw our inventory panel again.
virtual void FillLastUpdateContent ()
 Fills the last content of the update.
virtual void UpdateInventoryContent ()
 Draws the content of the inventory (slots and icons)
virtual void UpdateSlot (int i)
 Updates the slot's content and appearance.
virtual void InitializeSlotPrefab ()
 Creates the slot prefab to use in all slot creations.
virtual void DrawSlot (int i)
 Draws the slot and its content (icon, quantity...).
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.

Additional Inherited Members

Static Public Attributes inherited from MoreMountains.InventoryEngine.InventoryDisplay
static InventoryDisplay CurrentlyBeingMovedFromInventoryDisplay
 the item currently being moved
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.
virtual int InventorySize [get, set]
 the total number of slots in this inventory
virtual GridLayoutGroup InventoryGrid [get, protected set]
 the grid layout used to display the inventory in rows and columns
virtual InventoryDisplayTitle InventoryTitle [get, protected set]
 the gameobject used to display the inventory's name
virtual RectTransform InventoryRectTransform [get]
 the main panel
virtual List< InventorySlotSlotContainer [get, protected set]
 an internal list of slots
virtual InventoryDisplay ReturnInventory [get, protected set]
 the inventory the focus should return to after an action
virtual bool IsOpen [get, protected set]
 whether this inventory display is open or not
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:
  • Assets/CorgiEngine/ThirdParty/MoreMountains/InventoryEngine/InventoryEngine/Scripts/GUI/InventoryHotbar.cs