48 lines
1.8 KiB
GDScript
48 lines
1.8 KiB
GDScript
class_name ABGM54ContractHeader
|
|
extends Control
|
|
|
|
const UIFactory = preload("res://ui/shared/ui_factory.gd")
|
|
const PageChrome = preload("res://ui/shared/page_chrome.gd")
|
|
|
|
var title_text := "委托板"
|
|
var subtitle_text := "风镜原野 · 首次远征"
|
|
var status_text := ""
|
|
|
|
func configure(next_title: String, next_subtitle: String, next_status: String) -> ABGM54ContractHeader:
|
|
title_text = next_title
|
|
subtitle_text = next_subtitle
|
|
status_text = next_status
|
|
return self
|
|
|
|
func _ready() -> void:
|
|
clip_contents = true
|
|
var title := UIFactory.label(title_text, "title", 1.0, PageChrome.INK)
|
|
title.name = "ContractHeaderTitle"
|
|
title.anchor_right = 0.68
|
|
# Keep the title and subtitle on separate authored rows at phone-landscape
|
|
# sizes; the previous 0.64/0.58 split let glyphs touch after scaling.
|
|
title.anchor_bottom = 0.54
|
|
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
|
title.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
title.clip_text = true
|
|
title.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
add_child(title)
|
|
var subtitle := UIFactory.label(subtitle_text, "micro", 1.0, PageChrome.INK_SOFT)
|
|
subtitle.name = "ContractHeaderSubtitle"
|
|
subtitle.anchor_top = 0.62
|
|
subtitle.anchor_right = 0.68
|
|
subtitle.anchor_bottom = 1.0
|
|
subtitle.clip_text = true
|
|
subtitle.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
add_child(subtitle)
|
|
var status := UIFactory.label(status_text, "micro", 1.0, PageChrome.INK_SOFT)
|
|
status.name = "ContractHeaderStatus"
|
|
status.anchor_left = 0.70
|
|
status.anchor_right = 1.0
|
|
status.anchor_bottom = 1.0
|
|
status.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
status.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
status.clip_text = true
|
|
status.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
add_child(status)
|