Class UpgradesDisplay

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

public class UpgradesDisplay extends UIComponent
A UI component for displaying and interacting with the upgrades menu in the game.
  • Field Details

    • isVisible

      public boolean isVisible
  • Constructor Details

    • UpgradesDisplay

      public UpgradesDisplay(MainGameScreen game)
      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 class UIComponent
    • 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 interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class RenderComponent
    • 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 class RenderComponent
      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

      public String[] getUpgradesMenuTexture()
    • getUpgradeTexturePaths

      public String[] getUpgradeTexturePaths()
    • getNotEnoughGoldImages

      public List<com.badlogic.gdx.scenes.scene2d.ui.Image> getNotEnoughGoldImages()