Class GGInventoryUI extends PanelContainer
Displays the contents of the [GGInventory] component.
The Inventory UI displays the contents of a [GGInventory] component. Most of the heavy lifting is performed by the [GGInventoryManagedSlotsController].
Presentation
The inventory UI supports three different presentation styles determined by the
- The Grid View uses a [GridContainer] with a fixed number of
- The Flow View uses a [FlowContainer] and displays as many items side-by-side as will fit. This allows for more responsive design for differently size devices.
- The List View uses a [VBoxContainer] to display vertically-arranged line items.
The grid view and flow view both use the
Presentation
The inventory UI supports three different presentation styles determined by the
view setting: - The Grid View uses a [GridContainer] with a fixed number of
grid_columns. - The Flow View uses a [FlowContainer] and displays as many items side-by-side as will fit. This allows for more responsive design for differently size devices.
- The List View uses a [VBoxContainer] to display vertically-arranged line items.
The grid view and flow view both use the
slot_scene, while the list view uses the list_item_scene to represent each individual inventory item slot.Uses a [FlowContainer] to display items in a responsive grid.Views.FLOW_VIEW = 0Uses a [VBoxContainer] to display a list of item.Views.LIST_VIEW = 1Uses a [GridContainer] to display item in a grid. The [member grid_columns] property determines the number of columns.Views.GRID_VIEW = 2# Signals
## Emitted for each slot's [signal Control.gui_input] signal.signal gui_input_slot(event_args: GGInventoryEventArgs) ## Emitted for each slot's [signal Control.focus_entered] signal.signal focus_entered_slot(event_args: GGInventoryEventArgs) ## Emitted for each slot's [signal Control.focus_exited] signal.signal focus_exited_slot(event_args: GGInventoryEventArgs) ## Emitted for each slot's [signal Control.mouse_entered] signal.signal mouse_entered_slot(event_args: GGInventoryEventArgs) ## Emitted for each slot's [signal Control.mouse_exited] signal.signal mouse_exited_slot(event_args: GGInventoryEventArgs) # Members
## Specify the inventory node this UI should usevar inventory: GGInventory## If provided, items can be transferred via the [member GGInventory.transfer_strategy].var remote_inventory: GGInventory## The search string used to filter and narrow down which inventory items are shown.var search: String## Determines which view to display the inventory in.var view: int = 0## The scene responsible for displaying an inventory item.var slot_scene: PackedScene = <Object>## Sets the size for each slot.var slot_size: Vector2## Determines whether inventory item slots can receive focus.var allow_slot_focus: bool = true## The scene used for each list item when the inventory is in list [member view].var list_item_scene: PackedScene = <Object>## Specifies how many columns the [member grid_container] should have.var grid_columns: int = 1var scroll_container_horizontal_mode: int = 0var scroll_container_vertical_mode: int = 1## Sets the [member ScrollContainer.custom_minimum_size] for all [Container]s listed in [member scroll_containers].var scroll_container_custom_minimum_size: Vector2 = Vector2(0, 0)## Handles the user input for each slot.var action_strategy: GGInventoryActionStrategy## Specifies the Drag-and-Drop handling implementationvar dnd_strategy: GGInventoryDndStrategy## Specifies the Split-Item handling implementationvar split_strategy: GGInventorySplitStrategy## Specifies the Search/filtering implementationvar search_strategy: GGInventorySearchStrategy## The controller that handles user input and interacts with the inventory.var inventory_controller: GGInventoryController## Defined so that the [member grid_columns] property can configure the [member GridContainer.columns].var grid_container: GridContainer## The [ScrollContainer]s for the different item presentations.var scroll_containers: ScrollContainer[] = []## Switches between different views when [member view] is updated.var tab_container: TabContainer## Used by [GGFocusControl] to determine which element should be focused.var default_focus: Node = null## Represents a [GGEntityAccessManager] context.var context_id: int = 0# Methods
## Forces all item slots to refresh.func refresh_slots() -> void## Returns the [Control] node for the [param slot_id].func get_slot(slot_id: int) -> Control