Class InventoryDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.inventory.InventoryDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,com.badlogic.gdx.utils.Json.Serializable
,Renderable
,Comparable<Renderable>
An ui component for displaying player stats, e.g. health.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
create()
Creates reusable ui styles and adds actors to the stage.void
dispose()
Dispose of the componentvoid
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) The draw stage of the UIComponent, it is handled by the stagecom.badlogic.gdx.scenes.scene2d.ui.Image
getBin()
com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop
getDnd()
Fetches the player inventory and returns itgetMap()
getSlots()
com.badlogic.gdx.scenes.scene2d.ui.Window
Get the current windowvoid
hide()
Hide the inventory.boolean
isOpen()
void
Fetch the updatedInventory and update displayvoid
setDragItems
(@NotNull ArrayList<com.badlogic.gdx.scenes.scene2d.Actor> actors, Map<com.badlogic.gdx.scenes.scene2d.ui.Stack, ItemSlot> map) Set Drag Itemsvoid
setPause()
void
Toggle the inventory open, and changes the window visibilityvoid
updateSelected
(int slotNum) Updates displayed number at top of inventory to represent what slot is selectedMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
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
-
Method Details
-
create
public void create()Creates reusable ui styles and adds actors to the stage.- Overrides:
create
in classUIComponent
-
setPause
public void setPause() -
setDragItems
public void setDragItems(@NotNull @NotNull ArrayList<com.badlogic.gdx.scenes.scene2d.Actor> actors, Map<com.badlogic.gdx.scenes.scene2d.ui.Stack, ItemSlot> map) Set Drag Items- Parameters:
actors
- list of actorsmap
- images and their respective item slot
-
getIndexes
-
getMap
-
getBin
public com.badlogic.gdx.scenes.scene2d.ui.Image getBin() -
getSlots
-
updateSelected
public void updateSelected(int slotNum) Updates displayed number at top of inventory to represent what slot is selected- Parameters:
slotNum
- number of slot updated
-
getWindow
public com.badlogic.gdx.scenes.scene2d.ui.Window getWindow()Get the current window- Returns:
- current window
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) The draw stage of the UIComponent, it is handled by the stage- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
toggleOpen
public void toggleOpen()Toggle the inventory open, and changes the window visibility -
hide
public void hide()Hide the inventory. But why would you ever want to do that? -
getInventory
Fetches the player inventory and returns it- Returns:
- inventory attached to display
-
refreshInventory
public void refreshInventory()Fetch the updatedInventory and update display -
dispose
public void dispose()Dispose of the component- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-
isOpen
public boolean isOpen() -
getDnd
public com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop getDnd() -
addTooltips
public void addTooltips()
-