Class InventoryDisplay

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, com.badlogic.gdx.utils.Json.Serializable, Renderable, Comparable<Renderable>

public class InventoryDisplay extends UIComponent
An ui component for displaying player stats, e.g. health.
  • Constructor Details

    • InventoryDisplay

      public InventoryDisplay(String refreshEvent, String openEvent, Integer size, Integer rowSize, Boolean toolbar)
      Constructor for class
      Parameters:
      size - size of inventory
      rowSize - amount of items per row
  • Method Details

    • create

      public void create()
      Creates reusable ui styles and adds actors to the stage.
      Overrides:
      create in class UIComponent
    • 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 actors
      map - images and their respective item slot
    • getIndexes

      public Map<ItemSlot,Integer> getIndexes()
    • getMap

      public Map<com.badlogic.gdx.scenes.scene2d.ui.Stack,ItemSlot> getMap()
    • getBin

      public com.badlogic.gdx.scenes.scene2d.ui.Image getBin()
    • getSlots

      public ArrayList<ItemSlot> 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 class RenderComponent
      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

      public InventoryComponent 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 interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class RenderComponent
    • isOpen

      public boolean isOpen()
    • getDnd

      public com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop getDnd()
    • addTooltips

      public void addTooltips()