[貓咪問答]開發筆記1
*Content generated by AI.
1. Mobile UI Layout Practices
Optimized the visual experience for 1080 x 1920 resolution to ensure seamless display on mobile devices
Question Display Settings: Utilized TextMeshPro for question text with a defined width of 900–1000. Enabled the Auto Size feature to ensure questions of varying lengths remain legible within the designated area
. Progress Bar Optimization: Implemented the Slider component and removed the Handle Slide Area to achieve a modern, minimalist progress indicator
. Auto-Layout Techniques: Applied "Stretch" anchor settings to both the progress bar background and fill area, allowing child objects to automatically scale and fill their parent containers
.
2. Structured Question Bank
Separated game content from core logic to improve management efficiency
JSON Integration: Developed a JSON-based question bank containing 20 cat-themed trivia questions, including question strings, option arrays, and correct answer indices
. Automated Resource Management: Stored question files in the Resources folder, enabling dynamic loading via code during runtime
.
3. Core Logic & Scripting
Developed the game’s central control system within the Unity 6 environment
QuizManager Script: Implemented core functionalities including data loading, randomized question shuffling, button event binding, and real-time progress bar updates
. Data Parsing Solutions: Designed a
QuestionWrapperclass to act as a container, overcoming the native JsonUtility limitation where arrays cannot be parsed directly from the root. Scene Integration: Established a
GameManagerempty object to serve as the "brain," linking all UI elements (Text, Buttons, Sliders) through the Inspector panel.
No comments:
Post a Comment