|
Corgi Engine v9.3
|
A component that handles the visual representation of an Inventory, allowing the user to interact with it More...
Classes | |
| struct | ItemQuantity |
Public Member Functions | |
| virtual void | SetupInventoryDisplay () |
| Creates and sets up the inventory display (usually called via the inspector's dedicated button) More... | |
| virtual void | Initialization (bool forceRedraw=false) |
| Initializes lists and redraws the inventory display 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 | ChangeTargetInventory (string newInventoryName) |
| A public method you can use to change the target inventory of this display to a new inventory 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 | 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 |
Static Public Attributes | |
| static InventoryDisplay | CurrentlyBeingMovedFromInventoryDisplay |
| the item currently being moved More... | |
| static int | CurrentlyBeingMovedItemIndex = -1 |
Protected Member Functions | |
| 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... | |
| virtual void | OnEnable () |
| On Enable, we start listening for MMInventoryEvents More... | |
| virtual void | OnDisable () |
| On Disable, we stop listening for MMInventoryEvents More... | |
Static Protected Member Functions | |
| static void | InitializeStatics () |
Protected Attributes | |
| Inventory | _targetInventory = null |
| List< ItemQuantity > | _contentLastUpdate |
| List< int > | _comparison |
| SpriteState | _spriteState = new SpriteState() |
| InventorySlot | _currentlySelectedSlot |
| InventorySlot | _slotPrefab = null |
Properties | |
| Inventory | TargetInventory [get] |
| Grabs the target inventory based on its name More... | |
| virtual int | InventorySize [getset] |
| the total number of slots in this inventory More... | |
| virtual GridLayoutGroup | InventoryGrid [getprotected set] |
| the grid layout used to display the inventory in rows and columns More... | |
| virtual InventoryDisplayTitle | InventoryTitle [getprotected set] |
| the gameobject used to display the inventory's name More... | |
| virtual RectTransform | InventoryRectTransform [get] |
| the main panel More... | |
| virtual List< InventorySlot > | SlotContainer [getprotected set] |
| an internal list of slots More... | |
| virtual InventoryDisplay | ReturnInventory [getprotected set] |
| the inventory the focus should return to after an action More... | |
| virtual bool | IsOpen [getprotected set] |
| whether this inventory display is open or not More... | |
| virtual bool | InEquipSelection [getset] |
A component that handles the visual representation of an Inventory, allowing the user to interact with it
|
protectedvirtual |
Adds a grid layout group if there ain't one already
|
protectedvirtual |
On Awake, initializes the various lists used to keep track of the content of the inventory
|
virtual |
A public method you can use to change the target inventory of this display to a new inventory
| newInventoryName |
|
protectedvirtual |
If the content has changed, we draw our inventory panel again
|
virtual |
Returns the currently selected inventory slot
|
virtual |
Disables all the slots in the inventory display, except those from a certain class
| itemClass | Item class. |
|
protectedvirtual |
Draws the content of the inventory (slots and icons)
|
protectedvirtual |
Adds and sets up the inventory title child object
|
protectedvirtual |
Draws the slot and its content (icon, quantity...).
| i | The index. |
|
protectedvirtual |
Fills the last content of the update.
|
virtual |
Sets the focus on the first item of the inventory
|
virtual |
Goes to the previous (-1) or next (1) inventory, based on the int direction passed in parameter.
| direction | Direction. |
|
virtual |
Initializes lists and redraws the inventory display
|
protectedvirtual |
Creates the slot prefab to use in all slot creations
|
protectedvirtual |
Initializes the sprites.
|
staticprotected |
|
protectedvirtual |
On Disable, we stop listening for MMInventoryEvents
Reimplemented in MoreMountains.InventoryEngine.InventoryHotbar.
|
protectedvirtual |
On Enable, we start listening for MMInventoryEvents
Reimplemented in MoreMountains.InventoryEngine.InventoryHotbar.
|
virtual |
Catches MMInventoryEvents and acts on them
| inventoryEvent | Inventory event. |
|
protectedvirtual |
Redraws the inventory display's contents when needed (usually after a change in the target inventory)
|
virtual |
Enables back all slots (usually after having disabled some of them)
|
protectedvirtual |
Resizes the inventory panel, taking into account the number of rows/columns, the padding and margin
|
virtual |
If possible, returns the focus to the current return inventory focus (after equipping an item, usually)
|
virtual |
Sets the currently selected slot
| slot | Slot. |
|
virtual |
Sets the return inventory display
| inventoryDisplay | Inventory display. |
|
virtual |
Creates and sets up the inventory display (usually called via the inspector's dedicated button)
|
protectedvirtual |
Setups the slot navigation using Unity's GUI built-in system, so that the user can move using the left/right/up/down arrows
|
protectedvirtual |
Draws the content of the inventory (slots and icons)
|
protectedvirtual |
Updates the slot's content and appearance
| i | The index. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| bool MoreMountains.InventoryEngine.InventoryDisplay.AllowMovingObjectsToThisInventory = false |
if this is true, the Player will be allowed to move objects from another inventory to this one, using the Move button
|
static |
the item currently being moved
|
static |
| Sprite MoreMountains.InventoryEngine.InventoryDisplay.DisabledSlotImage |
The image to set as the background of each slot when the slot is disabled.
| bool MoreMountains.InventoryEngine.InventoryDisplay.DisplayTitle =true |
if true, will display the panel's title
| bool MoreMountains.InventoryEngine.InventoryDisplay.DrawEmptySlots =true |
if this is true, we'll draw slots even if they don't contain an object. Otherwise we don't draw them
| Sprite MoreMountains.InventoryEngine.InventoryDisplay.EmptySlotImage |
The image to set as the background of each slot when the slot is empty.
| bool MoreMountains.InventoryEngine.InventoryDisplay.EnableNavigation = true |
if true, the engine will automatically create bindings to navigate through the different slots using keyboard or gamepad.
| Sprite MoreMountains.InventoryEngine.InventoryDisplay.FilledSlotImage |
The image to set as the background of each slot when the slot is not empty.
| bool MoreMountains.InventoryEngine.InventoryDisplay.GetFocusOnStart = false |
if this is true, this inventory display will get the focus on start
| Sprite MoreMountains.InventoryEngine.InventoryDisplay.HighlightedSlotImage |
The image to set as the background of each slot when the slot is highlighted.
| Vector2 MoreMountains.InventoryEngine.InventoryDisplay.IconSize = new Vector2(30,30) |
the size of the icon in each slot
| ItemClasses MoreMountains.InventoryEngine.InventoryDisplay.ItemClass |
| Sprite MoreMountains.InventoryEngine.InventoryDisplay.MovedSlotImage |
The image to set as the background of each slot when the item in the slot is being moved around.
| InventoryDisplay MoreMountains.InventoryEngine.InventoryDisplay.NextInventory |
| int MoreMountains.InventoryEngine.InventoryDisplay.NumberOfColumns = 2 |
the number of columns to display
| int MoreMountains.InventoryEngine.InventoryDisplay.NumberOfRows = 3 |
the number of rows to display
| int MoreMountains.InventoryEngine.InventoryDisplay.PaddingBottom = 20 |
The internal margin between the bottom of the inventory panel and the last slots.
| int MoreMountains.InventoryEngine.InventoryDisplay.PaddingLeft = 20 |
The internal margin between the left of the inventory panel and the first slots.
| int MoreMountains.InventoryEngine.InventoryDisplay.PaddingRight = 20 |
The internal margin between the right of the inventory panel and the last slots.
| int MoreMountains.InventoryEngine.InventoryDisplay.PaddingTop = 20 |
The internal margin between the top of the inventory panel and the first slots.
| string MoreMountains.InventoryEngine.InventoryDisplay.PlayerID = "Player1" |
| Sprite MoreMountains.InventoryEngine.InventoryDisplay.PressedSlotImage |
The image to set as the background of each slot when the slot is pressed.
| InventoryDisplay MoreMountains.InventoryEngine.InventoryDisplay.PreviousInventory |
| TextAnchor MoreMountains.InventoryEngine.InventoryDisplay.QtyAlignment = TextAnchor.LowerRight |
where the quantity should be displayed
| Color MoreMountains.InventoryEngine.InventoryDisplay.QtyColor = Color.black |
the color to display the quantity in
| Font MoreMountains.InventoryEngine.InventoryDisplay.QtyFont |
the font used to display the quantity
| int MoreMountains.InventoryEngine.InventoryDisplay.QtyFontSize =12 |
the font size to use
| float MoreMountains.InventoryEngine.InventoryDisplay.QtyPadding =10f |
the padding (distance to the slot's edge)
| Image.Type MoreMountains.InventoryEngine.InventoryDisplay.SlotImageType |
The type of the image (sliced, normal, tiled...)
| Vector2 MoreMountains.InventoryEngine.InventoryDisplay.SlotMargin = new Vector2(5,5) |
the horizontal and vertical margin to apply between slots rows and columns
| InventorySlot MoreMountains.InventoryEngine.InventoryDisplay.SlotPrefab |
the game object to use as a Slot. If left empty, one will be automatically created at runtime
| Vector2 MoreMountains.InventoryEngine.InventoryDisplay.SlotSize = new Vector2(50,50) |
the horizontal and vertical size of the slots
| InventoryDisplay MoreMountains.InventoryEngine.InventoryDisplay.TargetChoiceInventory |
| string MoreMountains.InventoryEngine.InventoryDisplay.TargetInventoryName = "MainInventory" |
the name of the inventory to display
| string MoreMountains.InventoryEngine.InventoryDisplay.Title |
the title for the inventory that will be displayed
| TextAnchor MoreMountains.InventoryEngine.InventoryDisplay.TitleAlignment = TextAnchor.LowerRight |
where the quantity should be displayed
| Color MoreMountains.InventoryEngine.InventoryDisplay.TitleColor = Color.black |
the color to display the quantity in
| Font MoreMountains.InventoryEngine.InventoryDisplay.TitleFont |
the font used to display the quantity
| int MoreMountains.InventoryEngine.InventoryDisplay.TitleFontSize =20 |
the font size to use
| Vector3 MoreMountains.InventoryEngine.InventoryDisplay.TitleOffset =Vector3.zero |
the padding (distance to the slot's edge)
|
getset |
|
getprotected set |
the grid layout used to display the inventory in rows and columns
|
get |
the main panel
|
getset |
the total number of slots in this inventory
|
getprotected set |
the gameobject used to display the inventory's name
|
getprotected set |
whether this inventory display is open or not
|
getprotected set |
the inventory the focus should return to after an action
|
getprotected set |
an internal list of slots
|
get |
Grabs the target inventory based on its name
The target inventory.