TopDown Engine  v3.6
MoreMountains.InventoryEngine.InventoryInputManager Class Reference

Example of how you can call an inventory from your game. I suggest having your Input and GUI manager classes handle that though. More...

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

Public Types

enum  ManageButtonsModes { ManageButtonsModes.Interactable, ManageButtonsModes.SetActive }
 

Public Member Functions

virtual void ToggleInventory ()
 Opens or closes the inventory panel based on its current status More...
 
virtual void OpenInventory ()
 Opens the inventory panel More...
 
virtual void CloseInventory ()
 Closes the inventory panel More...
 
virtual void EquipOrUse ()
 When pressing the equip/use button, we determine which of the two methods to call More...
 
virtual void Equip ()
 
virtual void Use ()
 
virtual void UnEquip ()
 
virtual void Move ()
 Triggers the selected slot's move method More...
 
virtual void Drop ()
 Triggers the selected slot's drop method 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

CanvasGroup TargetInventoryContainer
 The CanvasGroup containing all the elements you want to show/hide when pressing the open/close inventory button. More...
 
InventoryDisplay TargetInventoryDisplay
 The main inventory display. More...
 
CanvasGroup Overlay
 The Fader that will be used under it when opening/closing the inventory. More...
 
float OverlayActiveOpacity = 0.85f
 the opacity of the overlay when active More...
 
float OverlayInactiveOpacity = 0f
 the opacity of the overlay when inactive More...
 
bool HideContainerOnStart = true
 if this is true, the inventory container will be hidden automatically on start More...
 
bool InputOnlyWhenOpen = true
 if this is true, the inventory container will be hidden automatically on start More...
 
KeyCode ToggleInventoryKey = KeyCode.I
 the key used to open/close the inventory More...
 
KeyCode ToggleInventoryAltKey = KeyCode.Joystick1Button6
 the alt key used to open/close the inventory More...
 
KeyCode OpenInventoryKey
 the key used to open the inventory More...
 
KeyCode CloseInventoryKey
 the key used to close the inventory More...
 
KeyCode CancelKey = KeyCode.Escape
 the alt key used to open/close the inventory More...
 
KeyCode CancelKeyAlt = KeyCode.Joystick1Button7
 the alt key used to open/close the inventory More...
 
string MoveKey = "insert"
 the key used to move an item More...
 
string MoveAltKey = "joystick button 2"
 the alt key used to move an item More...
 
string EquipKey = "home"
 the key used to equip an item More...
 
string EquipAltKey = "home"
 the alt key used to equip an item More...
 
string UseKey = "end"
 the key used to use an item More...
 
string UseAltKey = "end"
 the alt key used to use an item More...
 
string EquipOrUseKey = "space"
 the key used to equip or use an item More...
 
string EquipOrUseAltKey = "joystick button 0"
 the alt key used to equip or use an item More...
 
string DropKey = "delete"
 the key used to drop an item More...
 
string DropAltKey = "joystick button 1"
 the alt key used to drop an item More...
 
string NextInvKey = "page down"
 the key used to go to the next inventory More...
 
string NextInvAltKey = "joystick button 4"
 the alt key used to go to the next inventory More...
 
string PrevInvKey = "page up"
 the key used to go to the previous inventory More...
 
string PrevInvAltKey = "joystick button 5"
 the alt key used to go to the previous inventory More...
 
List< string > CloseList
 a list of other inventories that should get force-closed when this one opens More...
 
bool ManageButtons = false
 if this is true, the InputManager will change the interactable state of inventory control buttons based on the currently selected slot More...
 
ManageButtonsModes ManageButtonsMode = ManageButtonsModes.SetActive
 the selected mode to enable buttons with (interactable will change the button's interactable state, SetActive will enable/disable the button's game object More...
 
Button EquipUseButton
 the button used to equip or use an item More...
 
Button MoveButton
 the button used to move an item More...
 
Button DropButton
 the button used to drop an item More...
 
Button EquipButton
 the button used to equip an item More...
 
Button UseButton
 the button used to use an item More...
 
Button UnEquipButton
 the button used to unequip an item More...
 
bool InventoryIsOpen
 if this is true, the associated inventory is open, closed otherwise More...
 

Protected Member Functions

virtual void Start ()
 On start, we grab references and prepare our hotbar list More...
 
virtual void Update ()
 Every frame, we check for input for the inventory, the hotbars and we check the current selection More...
 
virtual void CheckCurrentlySelectedSlot ()
 Every frame, we check and store what object is currently selected More...
 
virtual void HandleButtons ()
 Will turn inventory controls interactable or not based on the currently selected slot, if ManageButtons is set to true More...
 
virtual void SetButtonState (Button targetButton, bool state)
 An internal method used to turn a button on or off More...
 
virtual void HandleInventoryInput ()
 Handles the inventory related inputs and acts on them. More...
 
virtual void HandleHotbarsInput ()
 Checks for hotbar input and acts on it More...
 
virtual void OnEnable ()
 On Enable, we start listening for MMInventoryEvents More...
 
virtual void OnDisable ()
 On Disable, we stop listening for MMInventoryEvents More...
 

Protected Attributes

CanvasGroup _canvasGroup
 
GameObject _currentSelection
 
InventorySlot _currentInventorySlot
 
List< InventoryHotbar_targetInventoryHotbars
 
InventoryDisplay _currentInventoryDisplay
 
bool _toggleInventoryKeyPressed
 
bool _openInventoryKeyPressed
 
bool _closeInventoryKeyPressed
 
bool _cancelKeyPressed
 
bool _prevInvKeyPressed
 
bool _nextInvKeyPressed
 
bool _moveKeyPressed
 
bool _equipOrUseKeyPressed
 
bool _equipKeyPressed
 
bool _useKeyPressed
 
bool _dropKeyPressed
 
bool _hotbarInputPressed = false
 

Properties

virtual InventorySlot CurrentlySelectedInventorySlot [get, set]
 returns the active slot More...
 

Detailed Description

Example of how you can call an inventory from your game. I suggest having your Input and GUI manager classes handle that though.

Member Enumeration Documentation

◆ ManageButtonsModes

Enumerator
Interactable 
SetActive 

Member Function Documentation

◆ CheckCurrentlySelectedSlot()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.CheckCurrentlySelectedSlot ( )
protectedvirtual

Every frame, we check and store what object is currently selected

◆ CloseInventory()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.CloseInventory ( )
virtual

Closes the inventory panel

◆ Drop()

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

Triggers the selected slot's drop method

◆ Equip()

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

◆ EquipOrUse()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.EquipOrUse ( )
virtual

When pressing the equip/use button, we determine which of the two methods to call

◆ HandleButtons()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.HandleButtons ( )
protectedvirtual

Will turn inventory controls interactable or not based on the currently selected slot, if ManageButtons is set to true

◆ HandleHotbarsInput()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.HandleHotbarsInput ( )
protectedvirtual

Checks for hotbar input and acts on it

◆ HandleInventoryInput()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.HandleInventoryInput ( )
protectedvirtual

Handles the inventory related inputs and acts on them.

◆ Move()

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

Triggers the selected slot's move method

◆ OnDisable()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.OnDisable ( )
protectedvirtual

On Disable, we stop listening for MMInventoryEvents

◆ OnEnable()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.OnEnable ( )
protectedvirtual

On Enable, we start listening for MMInventoryEvents

◆ OnMMEvent()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.OnMMEvent ( MMInventoryEvent  inventoryEvent)
virtual

Catches MMInventoryEvents and acts on them

Parameters
inventoryEventInventory event.

◆ OpenInventory()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.OpenInventory ( )
virtual

Opens the inventory panel

◆ SetButtonState()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.SetButtonState ( Button  targetButton,
bool  state 
)
protectedvirtual

An internal method used to turn a button on or off

Parameters
targetButton
state

◆ Start()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.Start ( )
protectedvirtual

On start, we grab references and prepare our hotbar list

◆ ToggleInventory()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.ToggleInventory ( )
virtual

Opens or closes the inventory panel based on its current status

◆ UnEquip()

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

◆ Update()

virtual void MoreMountains.InventoryEngine.InventoryInputManager.Update ( )
protectedvirtual

Every frame, we check for input for the inventory, the hotbars and we check the current selection

◆ Use()

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

Member Data Documentation

◆ _cancelKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._cancelKeyPressed
protected

◆ _canvasGroup

CanvasGroup MoreMountains.InventoryEngine.InventoryInputManager._canvasGroup
protected

◆ _closeInventoryKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._closeInventoryKeyPressed
protected

◆ _currentInventoryDisplay

InventoryDisplay MoreMountains.InventoryEngine.InventoryInputManager._currentInventoryDisplay
protected

◆ _currentInventorySlot

InventorySlot MoreMountains.InventoryEngine.InventoryInputManager._currentInventorySlot
protected

◆ _currentSelection

GameObject MoreMountains.InventoryEngine.InventoryInputManager._currentSelection
protected

◆ _dropKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._dropKeyPressed
protected

◆ _equipKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._equipKeyPressed
protected

◆ _equipOrUseKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._equipOrUseKeyPressed
protected

◆ _hotbarInputPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._hotbarInputPressed = false
protected

◆ _moveKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._moveKeyPressed
protected

◆ _nextInvKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._nextInvKeyPressed
protected

◆ _openInventoryKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._openInventoryKeyPressed
protected

◆ _prevInvKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._prevInvKeyPressed
protected

◆ _targetInventoryHotbars

List<InventoryHotbar> MoreMountains.InventoryEngine.InventoryInputManager._targetInventoryHotbars
protected

◆ _toggleInventoryKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._toggleInventoryKeyPressed
protected

◆ _useKeyPressed

bool MoreMountains.InventoryEngine.InventoryInputManager._useKeyPressed
protected

◆ CancelKey

KeyCode MoreMountains.InventoryEngine.InventoryInputManager.CancelKey = KeyCode.Escape

the alt key used to open/close the inventory

◆ CancelKeyAlt

KeyCode MoreMountains.InventoryEngine.InventoryInputManager.CancelKeyAlt = KeyCode.Joystick1Button7

the alt key used to open/close the inventory

◆ CloseInventoryKey

KeyCode MoreMountains.InventoryEngine.InventoryInputManager.CloseInventoryKey

the key used to close the inventory

◆ CloseList

List<string> MoreMountains.InventoryEngine.InventoryInputManager.CloseList

a list of other inventories that should get force-closed when this one opens

◆ DropAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.DropAltKey = "joystick button 1"

the alt key used to drop an item

◆ DropButton

Button MoreMountains.InventoryEngine.InventoryInputManager.DropButton

the button used to drop an item

◆ DropKey

string MoreMountains.InventoryEngine.InventoryInputManager.DropKey = "delete"

the key used to drop an item

◆ EquipAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.EquipAltKey = "home"

the alt key used to equip an item

◆ EquipButton

Button MoreMountains.InventoryEngine.InventoryInputManager.EquipButton

the button used to equip an item

◆ EquipKey

string MoreMountains.InventoryEngine.InventoryInputManager.EquipKey = "home"

the key used to equip an item

◆ EquipOrUseAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.EquipOrUseAltKey = "joystick button 0"

the alt key used to equip or use an item

◆ EquipOrUseKey

string MoreMountains.InventoryEngine.InventoryInputManager.EquipOrUseKey = "space"

the key used to equip or use an item

◆ EquipUseButton

Button MoreMountains.InventoryEngine.InventoryInputManager.EquipUseButton

the button used to equip or use an item

◆ HideContainerOnStart

bool MoreMountains.InventoryEngine.InventoryInputManager.HideContainerOnStart = true

if this is true, the inventory container will be hidden automatically on start

◆ InputOnlyWhenOpen

bool MoreMountains.InventoryEngine.InventoryInputManager.InputOnlyWhenOpen = true

if this is true, the inventory container will be hidden automatically on start

◆ InventoryIsOpen

bool MoreMountains.InventoryEngine.InventoryInputManager.InventoryIsOpen

if this is true, the associated inventory is open, closed otherwise

◆ ManageButtons

bool MoreMountains.InventoryEngine.InventoryInputManager.ManageButtons = false

if this is true, the InputManager will change the interactable state of inventory control buttons based on the currently selected slot

◆ ManageButtonsMode

ManageButtonsModes MoreMountains.InventoryEngine.InventoryInputManager.ManageButtonsMode = ManageButtonsModes.SetActive

the selected mode to enable buttons with (interactable will change the button's interactable state, SetActive will enable/disable the button's game object

◆ MoveAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.MoveAltKey = "joystick button 2"

the alt key used to move an item

◆ MoveButton

Button MoreMountains.InventoryEngine.InventoryInputManager.MoveButton

the button used to move an item

◆ MoveKey

string MoreMountains.InventoryEngine.InventoryInputManager.MoveKey = "insert"

the key used to move an item

◆ NextInvAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.NextInvAltKey = "joystick button 4"

the alt key used to go to the next inventory

◆ NextInvKey

string MoreMountains.InventoryEngine.InventoryInputManager.NextInvKey = "page down"

the key used to go to the next inventory

◆ OpenInventoryKey

KeyCode MoreMountains.InventoryEngine.InventoryInputManager.OpenInventoryKey

the key used to open the inventory

◆ Overlay

CanvasGroup MoreMountains.InventoryEngine.InventoryInputManager.Overlay

The Fader that will be used under it when opening/closing the inventory.

◆ OverlayActiveOpacity

float MoreMountains.InventoryEngine.InventoryInputManager.OverlayActiveOpacity = 0.85f

the opacity of the overlay when active

◆ OverlayInactiveOpacity

float MoreMountains.InventoryEngine.InventoryInputManager.OverlayInactiveOpacity = 0f

the opacity of the overlay when inactive

◆ PrevInvAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.PrevInvAltKey = "joystick button 5"

the alt key used to go to the previous inventory

◆ PrevInvKey

string MoreMountains.InventoryEngine.InventoryInputManager.PrevInvKey = "page up"

the key used to go to the previous inventory

◆ TargetInventoryContainer

CanvasGroup MoreMountains.InventoryEngine.InventoryInputManager.TargetInventoryContainer

The CanvasGroup containing all the elements you want to show/hide when pressing the open/close inventory button.

◆ TargetInventoryDisplay

InventoryDisplay MoreMountains.InventoryEngine.InventoryInputManager.TargetInventoryDisplay

The main inventory display.

◆ ToggleInventoryAltKey

KeyCode MoreMountains.InventoryEngine.InventoryInputManager.ToggleInventoryAltKey = KeyCode.Joystick1Button6

the alt key used to open/close the inventory

◆ ToggleInventoryKey

KeyCode MoreMountains.InventoryEngine.InventoryInputManager.ToggleInventoryKey = KeyCode.I

the key used to open/close the inventory

◆ UnEquipButton

Button MoreMountains.InventoryEngine.InventoryInputManager.UnEquipButton

the button used to unequip an item

◆ UseAltKey

string MoreMountains.InventoryEngine.InventoryInputManager.UseAltKey = "end"

the alt key used to use an item

◆ UseButton

Button MoreMountains.InventoryEngine.InventoryInputManager.UseButton

the button used to use an item

◆ UseKey

string MoreMountains.InventoryEngine.InventoryInputManager.UseKey = "end"

the key used to use an item

Property Documentation

◆ CurrentlySelectedInventorySlot

virtual InventorySlot MoreMountains.InventoryEngine.InventoryInputManager.CurrentlySelectedInventorySlot
getset

returns the active slot


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