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

public class Docket extends UIComponent
UI component class for displaying a docketImage and changing its appearance depending on time remaining.
  • Constructor Details

    • Docket

      public Docket(long totalRecipeTime)
      Constructs a docketImage component and initialises its skin.
  • Method Details

    • setSkin

      public void setSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
      Sets the skin associated with this docketImage.
      Parameters:
      skin - the skin to be associated with this docketImage.
    • getSkin

      public com.badlogic.gdx.scenes.scene2d.ui.Skin getSkin()
      Gets the skin associated with this docket.
      Returns:
      The skin associated with this docket
    • setDocketImage

      public void setDocketImage(com.badlogic.gdx.scenes.scene2d.ui.Image docketImage)
      Sets the image associated with this docketImage.
      Parameters:
      docketImage - the image to be associated with this docketImage.
    • getDocketImage

      public com.badlogic.gdx.scenes.scene2d.ui.Image getDocketImage()
      Gets the image associated with this docket
      Returns:
      the image associated with this docket
    • setCellHash

      public void setCellHash(int cellHash)
      Sets the cell hash that uniquely identifies the cell this docketImage is associated with.
      Parameters:
      cellHash - the unique hash for the cell
    • getCellHash

      public int getCellHash()
      Returns the cell hash associated with this docketImage.
      Returns:
      the cell hash
    • getImage

      public com.badlogic.gdx.scenes.scene2d.ui.Image getImage()
      Returns the image representing the docketImage.
      Returns:
      the docketImage image
    • getTextureNameArray

      public String[] getTextureNameArray()
      Returns the array of texture names corresponding to the different states of the docketImage.
      Returns:
      an array of texture names
    • getStartTime

      public long getStartTime()
      Returns the start time of when the docketImage was created.
      Returns:
      the start time in milliseconds
    • setPaused

      public void setPaused(boolean paused)
    • getPaused

      public boolean getPaused()
    • getTotalRecipeTime

      public long getTotalRecipeTime()
      Gets the total recipe time
      Returns:
      the total recipe time
    • setTotalRecipeTime

      public void setTotalRecipeTime(long totalRecipeTime)
      Sets the total recipe time
      Parameters:
      totalRecipeTime - : the total recipe time to be set
    • updateDocketTexture

      public void updateDocketTexture(double remainingTimeSecs)
      Updates the texture of the docketImage based on the remaining time before it disposes. As the remaining time decreases, the texture changes to indicate the time state of the docketImage.
      Parameters:
      remainingTimeSecs - the remaining time in seconds
    • draw

      protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Draws the docketImage component.
      Specified by:
      draw in class RenderComponent
      Parameters:
      batch - the SpriteBatch used for drawing
    • setStage

      public void setStage(com.badlogic.gdx.scenes.scene2d.Stage mock)
    • getCurrentTextureName

      public String getCurrentTextureName()
      Retrieves the name of the current drawable's texture.
      Returns:
      the name of the current texture, or "none" if no drawable is set