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 voiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the docketImage component.intReturns the cell hash associated with this docketImage.Retrieves the name of the current drawable's texture.com.badlogic.gdx.scenes.scene2d.ui.ImageGets the image associated with this docketcom.badlogic.gdx.scenes.scene2d.ui.ImagegetImage()Returns the image representing the docketImage.booleancom.badlogic.gdx.scenes.scene2d.ui.SkingetSkin()Gets the skin associated with this docket.longReturns the start time of when the docketImage was created.String[]Returns the array of texture names corresponding to the different states of the docketImage.longGets the total recipe timevoidsetCellHash(int cellHash) Sets the cell hash that uniquely identifies the cell this docketImage is associated with.voidsetDocketImage(com.badlogic.gdx.scenes.scene2d.ui.Image docketImage) Sets the image associated with this docketImage.voidsetPaused(boolean paused) voidsetSkin(com.badlogic.gdx.scenes.scene2d.ui.Skin skin) Sets the skin associated with this docketImage.voidsetStage(com.badlogic.gdx.scenes.scene2d.Stage mock) voidsetTotalRecipeTime(long totalRecipeTime) Sets the total recipe timevoidupdateDocketTexture(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, getZIndexMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, dispose, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, updateMethods 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
-
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:
drawin 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
-