Class EndDayDisplay

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

public class EndDayDisplay extends UIComponent
  • Field Details

    • customerNameArray

      public final List<String> customerNameArray
    • passedCustomerArray

      public final List<String> passedCustomerArray
    • failedCustomerArray

      public final List<String> failedCustomerArray
  • Constructor Details

    • EndDayDisplay

      public EndDayDisplay()
      Constructor for the EndDayDisplay class.
  • Method Details

    • create

      public void create()
      Initializes and creates the end-of-day display components. This method sets up the entire layout for the display including background, images, and interactive elements like buttons and lists.
      Overrides:
      create in class UIComponent
    • addListeners

      public void addListeners()
      Registers event listeners relevant to the end-of-day display operations, such as gold updates and customer events.
    • createBackground

      public void createBackground()
      Sets up a white background for the display using a predefined image. This method loads a texture from the resource service and sets it as the background for the layout. The image used is specified in the texture path 'images/endday.png'.
    • setupImages

      public void setupImages()
      Sets up the images for various UI elements in the display. This method initializes and positions images that are used to enhance the visual representation of the display, such as birds and points icons.
    • createImage

      public com.badlogic.gdx.scenes.scene2d.ui.Image createImage(String texturePath)
      Creates and returns an image actor for a given texture path. This utility method simplifies the creation of an image actor from a texture, making it easier to manage image setup throughout the class.
      Parameters:
      texturePath - the path to the texture asset
      Returns:
      an initialized Image actor with the specified texture
    • setupUI

      public void setupUI()
      Sets up the user interface elements for the display. This method arranges all the interactive and non-interactive elements within the display, ensuring proper layout and functionality.
    • addSpacer

      public void addSpacer()
      Adds a spacer to the layout to manage vertical spacing between components. This method helps in aligning other UI components by adding customizable space in the layout table.
    • setupGoldDisplay

      public void setupGoldDisplay()
      Sets up the display for showing the current gold amount. This method configures a label to show the amount of gold collected, updating its value in real time during the display.
    • setupCustomerLists

      public void setupCustomerLists()
      Sets up the lists displaying customer feedback. This method configures two lists to show which customers passed and which failed, providing direct feedback to the player.
    • addCloseButton

      public void addCloseButton()
      Adds a close button to the display that can hide this component. This method creates a button that when clicked, will toggle the visibility of the end-of-day display, effectively closing it.
    • handleGoldUpdate

      public void handleGoldUpdate(int gold)
      Handles updates to the gold display when the total gold changes. This method is typically called by event listeners responding to changes in the game state related to gold accumulation.
      Parameters:
      gold - the new total amount of gold to display
    • handlePassedCustomer

      public void handlePassedCustomer(String customerName)
      Handles the event when a customer has successfully completed their interaction, such as finishing an order. This method adds the customer's name in uppercase to the list of passed customers and logs the event.
      Parameters:
      customerName - The name of the customer who passed.
    • updateCustomerList

      public void updateCustomerList(String customerName)
      Updates the customer feedback lists when new customer feedback is received. This method is called whenever there is new data about customer interactions, allowing the display to refresh its lists accordingly.
      Parameters:
      customerName - the name of the customer to add to the feedback list
    • updateBirdPosition

      public void updateBirdPosition(float delta)
      Updates the position of the bird image on the display. This method is used to animate the bird image across the display, creating a dynamic visual effect.
      Parameters:
      delta - the time elapsed since the last frame update
    • animateGoldChange

      public void animateGoldChange()
      Animates the change in gold displayed, making the transition smooth. This method gradually updates the displayed gold amount from the previous value to the current value, using a simple animation.
    • show

      public void show()
      Shows the end-of-day display. This method makes the display visible and updates all dynamic content to reflect the current game state. It is usually called in response to a game event.
    • hide

      public void hide()
      Hides the display and triggers the game to continue. This method is called when the close button is activated, hiding the display and signaling the game to proceed with post-display actions.
    • toggleVisibility

      public void toggleVisibility()
      Toggles the visibility of the display between visible and hidden. This method is a convenience for quickly showing or hiding the end-of-day display based on its current visibility state.
    • draw

      public 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 mock)
    • isVisible

      public boolean isVisible()
    • setVisible

      public void setVisible(boolean visible)
    • getLayout

      public com.badlogic.gdx.scenes.scene2d.ui.Table getLayout()
    • setLayout

      public void setLayout(com.badlogic.gdx.scenes.scene2d.ui.Table layout)
    • getGame

      public GdxGame getGame()
    • setGame

      public void setGame(GdxGame game)
    • getBirdImage

      public com.badlogic.gdx.scenes.scene2d.ui.Image getBirdImage()
    • setBirdImage

      public void setBirdImage(com.badlogic.gdx.scenes.scene2d.ui.Image birdImage)
    • getPointImage1

      public com.badlogic.gdx.scenes.scene2d.ui.Image getPointImage1()
    • setPointImage1

      public void setPointImage1(com.badlogic.gdx.scenes.scene2d.ui.Image pointImage1)
    • getPointImage2

      public com.badlogic.gdx.scenes.scene2d.ui.Image getPointImage2()
    • setPointImage2

      public void setPointImage2(com.badlogic.gdx.scenes.scene2d.ui.Image pointImage2)
    • getPointImage3

      public com.badlogic.gdx.scenes.scene2d.ui.Image getPointImage3()
    • setPointImage3

      public void setPointImage3(com.badlogic.gdx.scenes.scene2d.ui.Image pointImage3)