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 TypeMethodDescriptionvoidvoidcreate()Creates reusable ui styles and adds actors to the stage.voiddispose()Dispose of the componentvoiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) The draw stage of the UIComponent, it is handled by the stagecom.badlogic.gdx.scenes.scene2d.ui.ImagegetBin()com.badlogic.gdx.scenes.scene2d.utils.DragAndDropgetDnd()Fetches the player inventory and returns itgetMap()getSlots()com.badlogic.gdx.scenes.scene2d.ui.WindowGet the current windowvoidhide()Hide the inventory.booleanisOpen()voidFetch the updatedInventory and update displayvoidsetDragItems(@NotNull ArrayList<com.badlogic.gdx.scenes.scene2d.Actor> actors, Map<com.badlogic.gdx.scenes.scene2d.ui.Stack, ItemSlot> map) Set Drag ItemsvoidsetPause()voidToggle the inventory open, and changes the window visibilityvoidupdateSelected(int slotNum) Updates displayed number at top of inventory to represent what slot is selectedMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndexMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods 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:
createin 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:
drawin 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:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classRenderComponent
-
isOpen
public boolean isOpen() -
getDnd
public com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop getDnd() -
addTooltips
public void addTooltips()
-