End of Day Display - UQcsse3200/2024-studio-3 GitHub Wiki
End of Day Display by Team 8
Description
The end of day screen is to provide players with a comprehensive overview of their day’s performance as well as prompt a moral decision (that will affect future gameplay). This screen provides key metrics such as the current time of the system, amount of money gained or lost, number of orders fulfilled and unfulfilled. The summary is designed to encourage players to analyse their gameplay, helping them understand how efficiently they can manage orders and customer interactions, as well as make a moral decision that will either aid or hinder the gameplay experience.
EndDayDisplay
The EndDayDisplay class is intended to display to the player their end of day summary in which a moral decision will also be made. The objective of this task is to stop the player from moving and display a screen once 'p' is pressed. This task extends UIComponent.
Key Components and Fields
layout (Table)
: The main layout manager that organizes the UI elements on the screen.isVisible (boolean)
: Tracks whether the end-of-day screen is currently visible.gameScreen (MainGameScreen)
: Reference to the main game screen, allowing interaction with the game state (e.g., pausing and resuming the game).game (GdxGame)
: The game instance, used for transitioning between different game screens or states.birdImage, pointImage1, pointImage2, pointImage3 (Image)
: Visual elements that animate across the screen when displayed.goldLabel (Label)
: Displays the amount of gold the player has earned. It animates the change in gold value when updated.currentGold (int)
: The current amount of gold earned by the player.STARTING_GOLD (int)
: Initial gold amount at the beginning of the day, set to the current level’s starting gold.
Constructor
EndDayDisplay()
: Constructs a new instance of the end-of-day screen. It sets the initial gold amount and registers event listeners to handle gold updates, customer spawns, and screen visibility.
Method
create()
: Initializes the layout and UI elements, setting up the background, images, and customer lists. It also sets up event listeners to respond to game events such as the end of the day and gold updates.show()
: Makes the end-of-day screen visible. It pauses the game, animates the bird image, and starts the gold change animation.hide()
: Hides the end-of-day screen, resumes the game, and transitions to the next phase (such as the next day or moral decision screen).toggleVisibility()
: Toggles between showing and hiding the end-of-day screen.handleGoldUpdate(int gold)
: Updates the displayed gold value based on the new amount of gold passed via an event.setupImages()
: Loads and positions the bird image and other visual elements on the screen.setupUI()
: Sets up the primary UI layout, including the gold display and customer lists.updateCustomerList(String customerName)
: Adds a new customer name to the list of customers and updates the UI.animateGoldChange()
: Animates the transition from the starting gold amount to the current gold amount.
UPDATED
UPDATED
UML
UML UPDATED