The copy team rewrote ui-strings.yaml with multi-level nesting, renamed sections, and inline comments. Update the YAML parser to use a stack-based approach for arbitrary nesting depth, update HUD and interaction prompt to reference the new key names, and align tests with the new structure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
1.1 KiB
GDScript
33 lines
1.1 KiB
GDScript
extends Control
|
|
|
|
# HUD — displays player health, perception mode, time, etc.
|
|
|
|
@onready var health_label: Label = $MarginContainer/VBoxContainer/HealthLabel
|
|
@onready var perception_label: Label = $MarginContainer/VBoxContainer/PerceptionLabel
|
|
@onready var time_label: Label = $MarginContainer/VBoxContainer/TimeLabel
|
|
|
|
func _ready() -> void:
|
|
print("HUD: Initialized")
|
|
|
|
# Update HUD from snapshot data
|
|
func update_from_hud_data(data: Dictionary) -> void:
|
|
# Update perception mode display
|
|
if data.has("perception_mode"):
|
|
var prefix := UIStrings.get_text("hud.perception_mode_prefix")
|
|
if prefix.is_empty():
|
|
perception_label.text = data.perception_mode.capitalize()
|
|
else:
|
|
perception_label.text = prefix + ": " + data.perception_mode.capitalize()
|
|
|
|
# Update time display (per D-031)
|
|
if data.has("time"):
|
|
var prefix := UIStrings.get_text("hud.time_prefix")
|
|
if prefix.is_empty():
|
|
time_label.text = data.time
|
|
else:
|
|
time_label.text = prefix + ": " + data.time
|
|
|
|
# Update player health (from player data, not hud_data)
|
|
func update_health(health: int) -> void:
|
|
health_label.text = UIStrings.get_text("hud.health") + ": " + str(health)
|