44 lines
1.5 KiB
GDScript
44 lines
1.5 KiB
GDScript
class_name ABGM55ResultHeader
|
|
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 outcome_text := ""
|
|
var outcome_color := PageChrome.INK
|
|
|
|
func configure(next_title: String, next_subtitle: String, next_outcome: String, next_color: Color) -> ABGM55ResultHeader:
|
|
title_text = next_title
|
|
subtitle_text = next_subtitle
|
|
outcome_text = next_outcome
|
|
outcome_color = next_color
|
|
return self
|
|
|
|
func _ready() -> void:
|
|
clip_contents = true
|
|
var title := UIFactory.label(title_text, "title", 1.0, PageChrome.INK)
|
|
title.name = "BattleResultHeaderTitle"
|
|
title.anchor_right = 0.65
|
|
title.anchor_bottom = 0.62
|
|
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 = "BattleResultHeaderSubtitle"
|
|
subtitle.anchor_top = 0.58
|
|
subtitle.anchor_right = 0.65
|
|
subtitle.anchor_bottom = 1.0
|
|
subtitle.clip_text = true
|
|
add_child(subtitle)
|
|
var outcome := UIFactory.label(outcome_text, "heading", 1.0, outcome_color)
|
|
outcome.name = "BattleResultSummary"
|
|
outcome.anchor_left = 0.67
|
|
outcome.anchor_right = 1.0
|
|
outcome.anchor_bottom = 1.0
|
|
outcome.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
outcome.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
outcome.clip_text = true
|
|
outcome.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
add_child(outcome)
|