feat(ui): add YAML-based UI string loading system (#409)
Adds UIStrings autoload that loads display text from a YAML file, replacing hardcoded strings in HUD and interaction prompt. Copy team can now author UI microcopy in client/data/ui-strings.yaml without touching GDScript. Includes 38 strings across 5 categories and 16 gdUnit4 tests for the parser and lookup API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -13,12 +13,12 @@ func _ready() -> void:
|
||||
func update_from_hud_data(data: Dictionary) -> void:
|
||||
# Update perception mode display
|
||||
if data.has("perception_mode"):
|
||||
perception_label.text = "Mode: " + data.perception_mode.capitalize()
|
||||
perception_label.text = UIStrings.get_text("hud.mode_label") + ": " + data.perception_mode.capitalize()
|
||||
|
||||
# Update time display (per D-031)
|
||||
if data.has("time"):
|
||||
time_label.text = "Time: " + data.time
|
||||
time_label.text = UIStrings.get_text("hud.time_label") + ": " + data.time
|
||||
|
||||
# Update player health (from player data, not hud_data)
|
||||
func update_health(health: int) -> void:
|
||||
health_label.text = "Health: " + str(health)
|
||||
health_label.text = UIStrings.get_text("hud.health_label") + ": " + str(health)
|
||||
|
||||
@@ -40,7 +40,7 @@ func _show_prompt(interaction: Dictionary) -> void:
|
||||
|
||||
# v0.1: pick first verb (sorted by priority from server)
|
||||
var verb_label: String = verbs[0].get("label", "")
|
||||
var display_text: String = "E - %s" % verb_label
|
||||
var display_text: String = "%s - %s" % [UIStrings.get_text("interaction.prompt_prefix"), verb_label]
|
||||
|
||||
if _current_target_id != target_id or prompt_label.text != display_text:
|
||||
prompt_label.text = display_text
|
||||
|
||||
Reference in New Issue
Block a user