75 lines
2.7 KiB
GDScript
75 lines
2.7 KiB
GDScript
class_name ABGM54ContractBoard
|
|
extends Control
|
|
|
|
const UIFactory = preload("res://ui/shared/ui_factory.gd")
|
|
const PageChrome = preload("res://ui/shared/page_chrome.gd")
|
|
const InitialCompanyArt = preload("res://entry/initial_company_art.gd")
|
|
|
|
var route_title := "风镜初渡"
|
|
var route_copy := ""
|
|
var recruits: Array = []
|
|
|
|
func configure(next_title: String, next_copy: String, next_recruits: Array) -> ABGM54ContractBoard:
|
|
route_title = next_title
|
|
route_copy = next_copy
|
|
recruits = next_recruits
|
|
return self
|
|
|
|
func _ready() -> void:
|
|
clip_contents = true
|
|
# The route title/copy sit over bright sky in the authored art, so they get
|
|
# a shared parchment backing before the copy is added.
|
|
var copy_card := PageChrome.new().configure("card")
|
|
copy_card.name = "ContractBoardCopyCard"
|
|
copy_card.anchor_right = 0.68
|
|
copy_card.anchor_bottom = 0.30
|
|
copy_card.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(copy_card)
|
|
var index_label := UIFactory.label("01", "micro", 1.0, PageChrome.INK_SOFT)
|
|
index_label.name = "ContractBoardIndex"
|
|
index_label.anchor_left = 0.05
|
|
index_label.anchor_right = 0.14
|
|
index_label.anchor_bottom = 0.10
|
|
add_child(index_label)
|
|
var title := UIFactory.label(route_title, "heading", 1.0, PageChrome.INK)
|
|
title.name = "ContractBoardTitle"
|
|
title.anchor_left = 0.15
|
|
title.anchor_right = 0.66
|
|
title.anchor_top = 0.03
|
|
title.anchor_bottom = 0.15
|
|
title.clip_text = true
|
|
title.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
add_child(title)
|
|
var copy := UIFactory.label(route_copy, "body", 1.0, PageChrome.INK_SOFT)
|
|
copy.name = "ContractBoardCopy"
|
|
copy.anchor_left = 0.06
|
|
copy.anchor_top = 0.17
|
|
copy.anchor_right = 0.63
|
|
copy.anchor_bottom = 0.28
|
|
copy.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
copy.clip_text = true
|
|
copy.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
add_child(copy)
|
|
var stage := Control.new()
|
|
stage.name = "ContractBoardPartyStage"
|
|
stage.anchor_top = 0.38
|
|
stage.anchor_right = 1.0
|
|
stage.anchor_bottom = 1.0
|
|
stage.clip_contents = true
|
|
add_child(stage)
|
|
for index in range(mini(2, recruits.size())):
|
|
var portrait := TextureRect.new()
|
|
portrait.name = "ContractBoardMember_%d" % index
|
|
portrait.texture = InitialCompanyArt.texture_for(Dictionary(recruits[index]))
|
|
portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
portrait.anchor_left = 0.16 + index * 0.38
|
|
portrait.anchor_top = 0.02
|
|
portrait.anchor_right = 0.42 + index * 0.38
|
|
portrait.anchor_bottom = 0.98
|
|
# The approved route master already contains the authored chibi party;
|
|
# keep these nodes for stable ownership/testing without double-painting.
|
|
portrait.visible = false
|
|
portrait.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
stage.add_child(portrait)
|