UI Module
The UI Module provides a collection of user interface components and page structures for the Property Tycoon game. It handles rendering visual elements like buttons and input fields, manages different game screens (pages), and processes user interactions (clicks, key presses) related to the UI. It relies heavily on the Pygame library for drawing and event handling, and uses Font_Manager and Sound_Manager for assets.
High-Level Design
Use Case Diagram
This diagram shows the main interactions a user can have with the UI system.
UI Module Use Cases
Dependency Diagram
Shows the primary external libraries and internal modules the UI components depend on.
UI Module Dependencies
Detailed Design
Class Diagrams
Core UI Elements
Core UI Elements Class Diagram
Page Hierarchy
Page Hierarchy Class Diagram
AI Emotion UI
AI Emotion UI Class Diagram
Sequence Diagrams
Main Menu Navigation
Sequence Diagram: Main Menu Navigation
Changing a Setting
Sequence Diagram: Changing a Setting
Player Setup (StartPage)
Sequence Diagram: Player Setup Interaction
Game Mode Selection
Sequence Diagram: Game Mode Selection
AI Mood Interaction
Sequence Diagram: AI Mood Interaction
Key Classes Overview
UIButton: A standard clickable button with text or image, hover effects, and active/inactive states.
UIInput: A text input field allowing user text entry, with active/inactive states and placeholder text.
BasePage: The foundation for all game screens, providing common drawing logic (background, title) and defining the interface for handling events.
MainMenuPage: The initial screen with options to start, view instructions, or change settings. Includes social media links.
SettingsPage: Allows modification of screen resolution, font, and sound/music volume. Interacts with Sound_Manager and Font_Manager.
StartPage: Handles the setup of human and AI players, including name entry and token selection. Manages player counts and associated data.
HowToPlayPage: Displays basic game instructions.
KeyboardShortcutsPage: Displays a list of keyboard shortcuts for game actions.
GameModePage: Allows selection between a full game or an abridged (timed) game, including setting a time limit.
EndGamePage: Shown after the game concludes, displaying the winner, final scores, and options to play again or quit. Includes a confetti effect.
CreditsPage: Displays the list of developers and special thanks.
AIDifficultyPage: Allows the user to select the difficulty level for AI opponents.
AIEmotionUI: An in-game UI element specifically for interacting with an AI player’s mood, featuring visual feedback and an easter egg.
API Documentation
- class src.UI.EndGamePage(winner_name, final_assets=None, bankrupted_players=None, voluntary_exits=None, tied_winners=None, lap_count=None)[source]
Bases:
BasePage