Files
aetherbound-guild/runtime/ui/m52/guild_contract_board.gd
T

48 lines
1.9 KiB
GDScript

class_name ABGM52GuildContractBoard
extends Control
const UIFactory = preload("res://ui/shared/ui_factory.gd")
const PageChrome = preload("res://ui/shared/page_chrome.gd")
const UITokens = preload("res://foundation/ui_tokens.gd")
var title_text := "委托板"
var contract_text := ""
var market_text := ""
var notice_text := ""
func configure(next_title: String, next_contract: String, next_market: String, next_notice: String) -> ABGM52GuildContractBoard:
title_text = next_title
contract_text = next_contract
market_text = next_market
notice_text = next_notice
return self
func _ready() -> void:
clip_contents = true
# M65-B: copy sits on the authored cream board, so it uses the shared ink
# tokens instead of the old page-local browns/amber.
_add_copy("GuildKioskText", title_text, Rect2(0.03, 0.04, 0.94, 0.20), 13, PageChrome.INK)
_add_copy("GuildContractReason", contract_text, Rect2(0.04, 0.31, 0.92, 0.24), 9, PageChrome.INK)
_add_copy("GuildMarketReason", market_text, Rect2(0.04, 0.58, 0.92, 0.28), 9, PageChrome.INK_SOFT)
_add_copy("GuildNotice", notice_text, Rect2(0.03, 0.86, 0.94, 0.13), 8, UITokens.COLOR_DANGER)
func _add_copy(node_name: String, value: String, area: Rect2, design_size: int, color: Color) -> void:
var label := UIFactory.label(value, "body", 1.0, color)
label.name = node_name
label.anchor_left = area.position.x
label.anchor_top = area.position.y
label.anchor_right = area.end.x
label.anchor_bottom = area.end.y
label.offset_left = 0.0
label.offset_top = 0.0
label.offset_right = 0.0
label.offset_bottom = 0.0
label.add_theme_font_size_override("font_size", design_size)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
label.clip_text = true
label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(label)