fix: apply final dark fantasy HUD polish

This commit is contained in:
goose
2026-10-09 08:38:28 -04:00
parent 59d0b65eb6
commit f1b58935bf
10 changed files with 129 additions and 102 deletions
+40 -24
View File
@@ -34,6 +34,7 @@ const MIN_FONT_SCALE := 0.66
@onready var event_log: RichTextLabel = $EventLog
@onready var log_panel: PanelContainer = $ResponsiveLayout/LogPanel
@onready var context_prompt_label: Label = $ContextPromptLabel
@onready var action_hint_label: Label = $ResponsiveLayout/PromptPanel/ActionHintLabel
@onready var responsive_layout: Control = $ResponsiveLayout
var combat_summary := ""
@@ -92,29 +93,26 @@ func apply_viewport_layout(viewport_size: Vector2) -> void:
# Named rail sections establish the visible content hierarchy. The legacy
# panel paths remain as transparent compatibility hosts for existing callers.
_set_rect($ResponsiveLayout/CharacterSection, origin + Vector2(28, 110) * scale, Vector2(436, 300) * scale)
_set_rect($ResponsiveLayout/ObjectivesSection, origin + Vector2(28, 422) * scale, Vector2(436, 176) * scale)
_set_rect($ResponsiveLayout/StatusSection, origin + Vector2(28, 610) * scale, Vector2(436, 318) * scale)
_set_rect($ResponsiveLayout/ObjectivesSection, origin + Vector2(28, 422) * scale, Vector2(436, 156) * scale)
_set_rect($ResponsiveLayout/StatusSection, origin + Vector2(28, 602) * scale, Vector2(436, 326) * scale)
_set_rect($ResponsiveLayout/JournalSection, origin + Vector2(1456, 110) * scale, Vector2(436, 404) * scale)
_set_rect($ResponsiveLayout/MapSection, origin + Vector2(1456, 526) * scale, Vector2(436, 402) * scale)
_set_rect($ResponsiveLayout/StatsPanel, origin + Vector2(28, 110) * scale, Vector2(436, 300) * scale)
_set_rect($ResponsiveLayout/LogPanel, origin + Vector2(1456, 110) * scale, Vector2(436, 404) * scale)
_set_rect($ResponsiveLayout/PromptPanel, origin + Vector2(500, 968) * scale, Vector2(590, 84) * scale)
_set_rect($ResponsiveLayout/HelpPanel, origin + Vector2(1110, 968) * scale, Vector2(782, 84) * scale)
_set_rect($ResponsiveLayout/QuickSlotStrip, origin + Vector2(28, 968) * scale, Vector2(452, 84) * scale)
_set_rect($ResponsiveLayout/PromptPanel, origin + Vector2(490, 968) * scale, Vector2(610, 84) * scale)
_set_rect($ResponsiveLayout/HelpPanel, origin + Vector2(1120, 968) * scale, Vector2(772, 84) * scale)
_set_rect($ResponsiveLayout/QuickSlotStrip, origin + Vector2(28, 968) * scale, Vector2(442, 84) * scale)
_set_rect($ResponsiveLayout/CharacterSectionTitle, origin + Vector2(44, 118) * scale, Vector2(400, 24) * scale)
_set_rect($ResponsiveLayout/ObjectivesSectionTitle, origin + Vector2(44, 430) * scale, Vector2(400, 24) * scale)
_set_rect($ResponsiveLayout/StatusSectionTitle, origin + Vector2(44, 618) * scale, Vector2(400, 24) * scale)
_set_rect($ResponsiveLayout/StatusSectionTitle, origin + Vector2(44, 616) * scale, Vector2(400, 24) * scale)
_set_rect($ResponsiveLayout/JournalSectionTitle, origin + Vector2(1472, 118) * scale, Vector2(400, 24) * scale)
_set_rect($ResponsiveLayout/MapSectionTitle, origin + Vector2(1472, 534) * scale, Vector2(400, 24) * scale)
_set_rect($ResponsiveLayout/QuickSlotHint, origin + Vector2(40, 980) * scale, Vector2(428, 60) * scale)
_set_rect($ResponsiveLayout/QuickSlotHint, origin + Vector2(38, 980) * scale, Vector2(420, 60) * scale)
_set_rect($AchievementToast, origin + Vector2(1080, 18) * scale, Vector2(420, 25) * scale)
_set_rect($TitleLabel, origin + Vector2(480, 18) * scale, Vector2(570, 26) * scale)
_set_rect($HeaderValuesLabel, origin + Vector2(480, 51) * scale, Vector2(960, 26) * scale)
# Ornament is a left-side flourish; it never sits under live header text.
_set_rect($ResponsiveLayout/HeaderOrnament, origin + Vector2(42, 20) * scale, Vector2(360, 50) * scale)
# Identity leads the character card. The portrait stays at the mockup's 140px
# width and the source aspect ratio (127:140); vital gauges form a clear column.
_set_rect($ResponsiveLayout/PortraitIllustration, origin + Vector2(44, 160) * scale, Vector2(140, 154.33) * scale)
@@ -131,15 +129,14 @@ func apply_viewport_layout(viewport_size: Vector2) -> void:
_set_rect($QuestTrackerLabel, origin + Vector2(52, 462) * scale, Vector2(376, 112) * scale)
_set_rect($SpellLabel, origin + Vector2(44, 652) * scale, Vector2(386, 24) * scale)
_set_rect($EnemyHealthLabel, origin + Vector2(44, 682) * scale, Vector2(386, 24) * scale)
_set_rect($CombatSummaryLabel, origin + Vector2(44, 712) * scale, Vector2(386, 42) * scale)
_set_rect($DeadlineLabel, origin + Vector2(44, 764) * scale, Vector2(386, 58) * scale)
_set_rect($ResponsiveLayout/EquipmentIllustration, origin + Vector2(80, 836) * scale, Vector2(332, 78) * scale)
_set_rect($SpellLabel, origin + Vector2(44, 648) * scale, Vector2(386, 24) * scale)
_set_rect($EnemyHealthLabel, origin + Vector2(44, 678) * scale, Vector2(386, 24) * scale)
_set_rect($CombatSummaryLabel, origin + Vector2(44, 708) * scale, Vector2(386, 42) * scale)
_set_rect($DeadlineLabel, origin + Vector2(44, 760) * scale, Vector2(386, 116) * scale)
_set_rect($EventLog, origin + Vector2(1476, 154) * scale, Vector2(396, 340) * scale)
_set_rect($ContextPromptLabel, origin + Vector2(516, 980) * scale, Vector2(558, 58) * scale)
_set_rect($HelpLabel, origin + Vector2(1124, 980) * scale, Vector2(754, 58) * scale)
_set_rect($ContextPromptLabel, origin + Vector2(506, 1008) * scale, Vector2(578, 30) * scale)
_set_rect($HelpLabel, origin + Vector2(1132, 980) * scale, Vector2(742, 58) * scale)
var minimap := get_node_or_null("Minimap") as Control
if minimap != null:
minimap.call("_layout_in_hud")
@@ -171,6 +168,7 @@ func _apply_text_scale(layout_scale: float) -> void:
$CombatSummaryLabel,
$DeadlineLabel,
$EventLog,
action_hint_label,
$ContextPromptLabel,
$HelpLabel,
]:
@@ -193,7 +191,7 @@ func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunStat
_state = state
if run_state != null:
_run_state = run_state
player_health_label.text = "Player HP: %d/%d" % [state.player.hit_points, state.player.max_hit_points]
player_health_label.text = "PV du joueur : %d/%d" % [state.player.hit_points, state.player.max_hit_points]
player_focus_label.text = "Focus: %d/%d" % [state.player.focus, state.player.max_focus]
_refresh_live_gauge(health_bar, state.player.hit_points, state.player.max_hit_points)
_refresh_live_gauge(focus_bar, state.player.focus, state.player.max_focus)
@@ -204,20 +202,38 @@ func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunStat
character_status_label.text = "État : prêt à explorer"
if state.enemies.has(&"goblin"):
var goblin: ActorState = state.enemies[&"goblin"]
enemy_health_label.text = "Goblin HP: %d/%d" % [goblin.hit_points, goblin.max_hit_points]
combat_summary = "Target: Goblin HP: %d/%d" % [goblin.hit_points, goblin.max_hit_points]
combat_summary = "Gobelin — PV : %d/%d" % [goblin.hit_points, goblin.max_hit_points]
enemy_health_label.text = combat_summary
combat_summary_label.text = ""
else:
enemy_health_label.text = "No active target"
combat_summary = "No active target"
combat_summary_label.text = combat_summary
combat_summary = "Aucune cible active"
enemy_health_label.text = combat_summary
combat_summary_label.text = ""
deadline_label.text = _deadline_status()
gold_label.text = "Or: %d" % (_run_state.gold if _run_state != null else 0)
quest_tracker_label.text = _quest_tracker()
action_hint_label.text = "F : Distance • X : Magie • K : Familier"
context_prompt_label.text = get_context_prompt()
# The supplied RunState journal events are the only source for journal text.
event_log.clear()
for event in events:
event_log.append_text(event.message + "\n")
event_log.append_text(_localized_event_message(event) + "\n")
## Converts only the structured events the HUD owns into French. Domain messages
## remain untouched and provide the presentation fallback for every other kind.
func _localized_event_message(event: GameEvent) -> String:
match event.kind:
&"game_started":
return "%s commence une nouvelle aventure." % String(event.payload.get("player_name", "Sans-Nom"))
&"moved":
var destination: Variant = event.payload.get("to", event.payload.get("to_cell", event.cell))
return "Vous vous déplacez vers %s." % destination
&"companion_moved":
return "Votre familier vous suit."
&"episode_published":
return "Épisode %d publié." % int(event.payload.get("number", 0))
_:
return event.message
func _refresh_live_gauge(gauge: ProgressBar, current: int, maximum: int) -> void:
gauge.min_value = 0