Files
step3/scripts/ui/main_menu.gd
T

81 lines
2.6 KiB
GDScript

extends VBoxContainer
const Style := preload("res://scripts/ui/ui_style.gd")
var main: Control
var stats_label: Label
func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT)
add_theme_constant_override("separation", 18)
var headline := Label.new()
headline.text = "Answer board-style questions. Earn XP. Unlock the map."
headline.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
Style.set_label(headline, 38, Style.TEXT)
add_child(headline)
var subhead := Label.new()
subhead.text = "A desktop study game for STEP 3-style single-best-answer blocks with tutor and timed modes."
subhead.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
Style.set_label(subhead, 18, Style.MUTED)
add_child(subhead)
var hero := PanelContainer.new()
hero.add_theme_stylebox_override("panel", Style.panel_box(Color("172337"), Color("2bdbff")))
hero.size_flags_vertical = Control.SIZE_EXPAND_FILL
add_child(hero)
var hero_content := VBoxContainer.new()
hero_content.add_theme_constant_override("separation", 16)
hero.add_child(hero_content)
var loop := Label.new()
loop.text = "XP Rush | Streak Heat | System Zones | Timed Blocks"
Style.set_label(loop, 24, Style.CYAN)
hero_content.add_child(loop)
var details := Label.new()
details.text = "Pick a clinical zone, clear a block, review every miss, and turn weak systems into unlock progress."
details.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
Style.set_label(details, 18, Style.TEXT)
hero_content.add_child(details)
var button_row := HBoxContainer.new()
button_row.add_theme_constant_override("separation", 12)
hero_content.add_child(button_row)
var start := Button.new()
start.text = "Start Block"
start.custom_minimum_size = Vector2(180, 52)
Style.style_primary_button(start)
start.pressed.connect(func(): main.show_screen("setup", "All Systems"))
button_row.add_child(start)
var map := Button.new()
map.text = "Open Study Map"
map.custom_minimum_size = Vector2(180, 52)
map.pressed.connect(func(): main.show_screen("map"))
button_row.add_child(map)
var profile := Button.new()
profile.text = "View Profile"
profile.custom_minimum_size = Vector2(180, 52)
profile.pressed.connect(func(): main.show_screen("profile"))
button_row.add_child(profile)
stats_label = Label.new()
stats_label.name = "Stats"
Style.set_label(stats_label, 20, Style.LIME)
hero_content.add_child(stats_label)
func on_show(_payload: Variant = null) -> void:
var profile := ProfileService.get_profile()
stats_label.text = "Level %d | %d XP | Current streak: %d | Badges: %d" % [
profile["level"],
profile["xp"],
profile["current_streak"],
profile["badges"].size()
]