Class Docket
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.ordersystem.Docket
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
UI component class for displaying a docketImage and changing its appearance depending on time remaining.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
ConstructorsConstructorDescriptionDocket
(long totalRecipeTime) Constructs a docketImage component and initialises its skin. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the docketImage component.int
Returns the cell hash associated with this docketImage.Retrieves the name of the current drawable's texture.com.badlogic.gdx.scenes.scene2d.ui.Image
Gets the image associated with this docketcom.badlogic.gdx.scenes.scene2d.ui.Image
getImage()
Returns the image representing the docketImage.boolean
com.badlogic.gdx.scenes.scene2d.ui.Skin
getSkin()
Gets the skin associated with this docket.long
Returns the start time of when the docketImage was created.String[]
Returns the array of texture names corresponding to the different states of the docketImage.long
Gets the total recipe timevoid
setCellHash
(int cellHash) Sets the cell hash that uniquely identifies the cell this docketImage is associated with.void
setDocketImage
(com.badlogic.gdx.scenes.scene2d.ui.Image docketImage) Sets the image associated with this docketImage.void
setPaused
(boolean paused) void
setSkin
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) Sets the skin associated with this docketImage.void
setStage
(com.badlogic.gdx.scenes.scene2d.Stage mock) void
setTotalRecipeTime
(long totalRecipeTime) Sets the total recipe timevoid
updateDocketTexture
(double remainingTimeSecs) Updates the texture of the docketImage based on the remaining time before it disposes.Methods inherited from class com.csse3200.game.ui.UIComponent
create, getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, dispose, 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
-
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
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 classRenderComponent
- Parameters:
batch
- the SpriteBatch used for drawing
-
setStage
public void setStage(com.badlogic.gdx.scenes.scene2d.Stage mock) -
getCurrentTextureName
Retrieves the name of the current drawable's texture.- Returns:
- the name of the current texture, or "none" if no drawable is set
-