feat(ui): convert HUD status, stance, interaction prompt to implant theme (D-169)
- HUD: programmatically builds ImplantPanel with health/mode/time rows, replaces raw MarginContainer/VBoxContainer/Labels - Stance indicator: ImplantPanel with color-coded ImplantDataRow, replaces custom _draw() with hardcoded bg/text - Interaction prompt: applies implant theme StyleBox + colors to existing PanelContainer layout Minimap left as-is — its circular frame is a distinct diegetic element, not rectangular panel chrome. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
extends Control
|
||||
|
||||
## D-053: Stance indicator — shows current movement stance on HUD.
|
||||
## D-053: Stance indicator — implant-styled badge (D-169).
|
||||
## Sprint/Walk/Careful/Crouch. Color-coded for quick read.
|
||||
## Lives on UILayer (z-layer 7).
|
||||
|
||||
const STANCE_COLORS := {
|
||||
"Sprint": Color("#d45d5d"), # Red — fast, loud, dangerous
|
||||
@@ -11,16 +10,23 @@ const STANCE_COLORS := {
|
||||
"Crouch": Color("#e8c547"), # Amber — very quiet, slow
|
||||
}
|
||||
|
||||
const STANCE_DEFAULT_COLOR := Color("#c8d0e0")
|
||||
const BG_COLOR := Color(0.05, 0.05, 0.08, 0.5)
|
||||
const FONT_SIZE := 13
|
||||
const PADDING := Vector2(10, 6)
|
||||
|
||||
var _current_stance: String = "Walk"
|
||||
var _panel: ImplantPanel
|
||||
var _row: ImplantDataRow
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
var theme_res := load("res://ui/implant/default_implant.tres") as ImplantTheme
|
||||
|
||||
_panel = ImplantPanel.new()
|
||||
_panel.name = "StancePanel"
|
||||
_panel.theme_resource = theme_res
|
||||
_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
add_child(_panel)
|
||||
|
||||
_row = ImplantDataRow.new("Walk", STANCE_COLORS["Walk"])
|
||||
_panel.add_component(_row)
|
||||
|
||||
|
||||
func update_from_state() -> void:
|
||||
@@ -28,32 +34,8 @@ func update_from_state() -> void:
|
||||
if stance == _current_stance:
|
||||
return
|
||||
_current_stance = stance
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
var font := ThemeDB.fallback_font
|
||||
var text := _current_stance
|
||||
var text_size := font.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, FONT_SIZE)
|
||||
var box_size := text_size + PADDING * 2
|
||||
|
||||
# Background
|
||||
draw_rect(Rect2(Vector2.ZERO, box_size), BG_COLOR)
|
||||
|
||||
# Stance text
|
||||
var color: Color = STANCE_COLORS.get(_current_stance, STANCE_DEFAULT_COLOR)
|
||||
draw_string(
|
||||
font,
|
||||
PADDING + Vector2(0, text_size.y),
|
||||
text,
|
||||
HORIZONTAL_ALIGNMENT_LEFT,
|
||||
-1,
|
||||
FONT_SIZE,
|
||||
color
|
||||
)
|
||||
|
||||
|
||||
# -- Public API ---------------------------------------------------------------
|
||||
var color: Color = STANCE_COLORS.get(stance, Color("#c8d0e0"))
|
||||
_row.set_content(stance, color)
|
||||
|
||||
|
||||
func get_current_stance() -> String:
|
||||
|
||||
Reference in New Issue
Block a user