Class UpgradesDisplay
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.upgrades.UpgradesDisplay
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,Renderable,Comparable<Renderable>
A UI component for displaying and interacting with the upgrades menu in the game.
-
Field Summary
FieldsFields inherited from class com.csse3200.game.ui.UIComponent
skin, stage -
Constructor Summary
ConstructorsConstructorDescriptionThis initializes the list of upgrade images but does not create the menu UI components. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd associated upgrade image based on the generated upgradevoidcreate()Initializes the UI components of the upgrade display, loads the necessary textures, and sets up the event listeners for displaying or hiding the upgrade menu.com.badlogic.gdx.scenes.scene2d.ui.TableAllowing user to decide whether the upgrade is needed or not by pressing YES or NO buttoncom.badlogic.gdx.scenes.scene2d.ui.ImageCreate the upgrade menu to allow user to see which upgrade is generatedvoidDisplay a message when the user does not have enough gold to purchase the upgradevoiddispose()Called when the component is disposed.protected voiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.com.badlogic.gdx.scenes.scene2d.ui.ButtonList<com.badlogic.gdx.scenes.scene2d.ui.Image> com.badlogic.gdx.scenes.scene2d.ui.ImageString[]com.badlogic.gdx.scenes.scene2d.ui.TableString[]com.badlogic.gdx.scenes.scene2d.ui.ButtonbooleanvoidsetStage(com.badlogic.gdx.scenes.scene2d.Stage stage) voidsetUpgradesTable(com.badlogic.gdx.scenes.scene2d.ui.Table upgradesTable) voidvoidvoidToggles the visibility of the upgrades menuMethods 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, 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
-
Field Details
-
isVisible
public boolean isVisible
-
-
Constructor Details
-
UpgradesDisplay
This initializes the list of upgrade images but does not create the menu UI components.
-
-
Method Details
-
createUpgradesMenuDisplay
public com.badlogic.gdx.scenes.scene2d.ui.Image createUpgradesMenuDisplay()Create the upgrade menu to allow user to see which upgrade is generated- Returns:
- The upgrade menu background image
-
create
public void create()Initializes the UI components of the upgrade display, loads the necessary textures, and sets up the event listeners for displaying or hiding the upgrade menu.- Overrides:
createin classUIComponent
-
addUpgradeImage
public void addUpgradeImage()Add associated upgrade image based on the generated upgrade -
createButtonsTable
public com.badlogic.gdx.scenes.scene2d.ui.Table createButtonsTable()Allowing user to decide whether the upgrade is needed or not by pressing YES or NO button- Returns:
- The table with buttons
-
displayNotEnoughGoldUI
public void displayNotEnoughGoldUI()Display a message when the user does not have enough gold to purchase the upgrade -
toggleVisibility
public void toggleVisibility()Toggles the visibility of the upgrades menu -
getYesButton
public com.badlogic.gdx.scenes.scene2d.ui.Button getYesButton() -
getNoButton
public com.badlogic.gdx.scenes.scene2d.ui.Button getNoButton() -
simulateYesButtonClick
public void simulateYesButtonClick() -
simulateNoButtonClick
public void simulateNoButtonClick() -
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here.- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classRenderComponent
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponentDraw the renderable. Should be called only by the renderer, not manually.- Specified by:
drawin classRenderComponent- Parameters:
batch- Batch to render to.
-
setStage
public void setStage(com.badlogic.gdx.scenes.scene2d.Stage stage) -
setUpgradesTable
public void setUpgradesTable(com.badlogic.gdx.scenes.scene2d.ui.Table upgradesTable) -
getUpgradesTable
public com.badlogic.gdx.scenes.scene2d.ui.Table getUpgradesTable() -
isVisible
public boolean isVisible() -
getUpgradesMenuImage
public com.badlogic.gdx.scenes.scene2d.ui.Image getUpgradesMenuImage() -
getUpgradesMenuTexture
-
getUpgradeTexturePaths
-
getNotEnoughGoldImages
-