Class PlayerInventoryDisplay
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.PlayerInventoryDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
PlayerInventoryDisplay extends InventoryDisplay and adds features like hotbar and drag-and-drop functionality.
-
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
ConstructorsConstructorDescriptionPlayerInventoryDisplay
(Inventory inventory, int numCols, int hotBarCapacity, GdxGame game) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the inventory of the player (used to empty inventory when loss condition satisfied in combat)protected void
enterSlot
(AbstractItem item) protected void
exitSlot
(AbstractItem item) void
Regenerates the entire inventory and hotBar display (recreates every image) This should only be used if the inventory has been changed (ie after sorting or loading).void
updatePotions
(ItemUsageContext context) updates the potions effects if in or out of combatprotected void
useItem
(AbstractItem item, int index) Methods inherited from class com.csse3200.game.components.inventory.InventoryDisplay
addSlotListeners, consumeItem, create, dispose, draw, getNumCols, getToggle, getZIndex, isMainGameScreen, 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
-
PlayerInventoryDisplay
-
-
Method Details
-
updatePotions
updates the potions effects if in or out of combat -
toggleMsg
- Specified by:
toggleMsg
in classInventoryDisplay
-
useItem
- Specified by:
useItem
in classInventoryDisplay
-
enterSlot
- Specified by:
enterSlot
in classInventoryDisplay
-
exitSlot
- Specified by:
exitSlot
in classInventoryDisplay
-
regenerateDisplay
public void regenerateDisplay()Description copied from class:InventoryDisplay
Regenerates the entire inventory and hotBar display (recreates every image) This should only be used if the inventory has been changed (ie after sorting or loading). Otherwise, use updateDisplay.- Overrides:
regenerateDisplay
in classInventoryDisplay
-
clearInventory
public void clearInventory()Clears the inventory of the player (used to empty inventory when loss condition satisfied in combat)
-