Class CombatInventoryDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.inventory.InventoryDisplay
com.csse3200.game.components.inventory.CombatInventoryDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
-
Field Summary
Fields inherited from class com.csse3200.game.components.inventory.InventoryDisplay
inventory, logger, numCols, numRows
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
ConstructorsConstructorDescriptionCombatInventoryDisplay
(Inventory inventory, int numCols, int hotBarCapacity, GdxGame game) Constructs a PlayerInventoryDisplay with the specified capacity and number of columns. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Initializes the component by setting up event listeners for toggling the inventory display and adding items.protected void
enterSlot
(AbstractItem item) protected void
exitSlot
(AbstractItem item) protected void
useItem
(AbstractItem item, int index) Methods inherited from class com.csse3200.game.components.inventory.InventoryDisplay
addSlotListeners, consumeItem, dispose, draw, getNumCols, getToggle, getZIndex, isMainGameScreen, regenerateDisplay, toggleDisplay, updateDisplay
Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, setStage
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
CombatInventoryDisplay
Constructs a PlayerInventoryDisplay with the specified capacity and number of columns. The capacity must be evenly divisible by the number of columns.- Parameters:
inventory
- The inventory from which to build the displaynumCols
- The number of columns in the inventory display.hotBarCapacity
- The number of slots allocated to the hotBar- Throws:
IllegalArgumentException
- if numCols is less than 1 or if capacity is not divisible by numCols.
-
-
Method Details
-
create
public void create()Description copied from class:InventoryDisplay
Initializes the component by setting up event listeners for toggling the inventory display and adding items.- Overrides:
create
in classInventoryDisplay
-
toggleMsg
- Specified by:
toggleMsg
in classInventoryDisplay
-
enterSlot
- Specified by:
enterSlot
in classInventoryDisplay
-
exitSlot
- Specified by:
exitSlot
in classInventoryDisplay
-
useItem
- Specified by:
useItem
in classInventoryDisplay
-