New component library at client/ui/implant/: - ImplantTheme: shared Resource with colors, spacing, font sizes - ImplantPanel: PanelContainer root with themed background/border - ImplantHeader: title + subtitle - ImplantSeparator: themed horizontal rule with above/below spacing - ImplantDataRow: single-line text with optional color override - ImplantTextBlock: RichTextLabel for wrapping narrative text - default_implant.tres: default theme resource Star map info panel refactored from 140 lines of manual draw_string calls to 50 lines of component composition via _rebuild_info_panel(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
1.0 KiB
GDScript
38 lines
1.0 KiB
GDScript
@tool
|
|
class_name ImplantHeader
|
|
extends VBoxContainer
|
|
## Panel header — title + optional subtitle.
|
|
|
|
var _title_label: Label
|
|
var _subtitle_label: Label
|
|
|
|
|
|
func _init(title: String = "", subtitle: String = "") -> void:
|
|
_title_label = Label.new()
|
|
_title_label.text = title
|
|
_title_label.name = "Title"
|
|
|
|
_subtitle_label = Label.new()
|
|
_subtitle_label.text = subtitle
|
|
_subtitle_label.name = "Subtitle"
|
|
|
|
|
|
func _ready() -> void:
|
|
add_theme_constant_override("separation", 0)
|
|
add_child(_title_label)
|
|
add_child(_subtitle_label)
|
|
|
|
|
|
func set_content(title: String, subtitle: String = "") -> void:
|
|
_title_label.text = title
|
|
_subtitle_label.text = subtitle
|
|
_subtitle_label.visible = not subtitle.is_empty()
|
|
|
|
|
|
func apply_implant_theme(t: ImplantTheme) -> void:
|
|
_title_label.add_theme_font_size_override("font_size", t.font_header)
|
|
_title_label.add_theme_color_override("font_color", t.text_primary)
|
|
|
|
_subtitle_label.add_theme_font_size_override("font_size", t.font_small)
|
|
_subtitle_label.add_theme_color_override("font_color", t.text_dim)
|