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 TypeMethodDescriptionvoid
Add associated upgrade image based on the generated upgradevoid
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.com.badlogic.gdx.scenes.scene2d.ui.Table
Allowing user to decide whether the upgrade is needed or not by pressing YES or NO buttoncom.badlogic.gdx.scenes.scene2d.ui.Image
Create the upgrade menu to allow user to see which upgrade is generatedvoid
Display a message when the user does not have enough gold to purchase the upgradevoid
dispose()
Called when the component is disposed.protected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.com.badlogic.gdx.scenes.scene2d.ui.Button
List
<com.badlogic.gdx.scenes.scene2d.ui.Image> com.badlogic.gdx.scenes.scene2d.ui.Image
String[]
com.badlogic.gdx.scenes.scene2d.ui.Table
String[]
com.badlogic.gdx.scenes.scene2d.ui.Button
boolean
void
setStage
(com.badlogic.gdx.scenes.scene2d.Stage stage) void
setUpgradesTable
(com.badlogic.gdx.scenes.scene2d.ui.Table upgradesTable) void
void
void
Toggles the visibility of the upgrades menuMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, 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
-
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:
create
in 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:Component
Called when the component is disposed. Dispose of any internal resources here.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponent
Draw the renderable. Should be called only by the renderer, not manually.- Specified by:
draw
in 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
-