feat(m54): extract contract party summary

This commit is contained in:
2026-09-12 15:32:25 +08:00
parent c48a35efe5
commit 66d6549d45
2 changed files with 26 additions and 5 deletions
@@ -15,6 +15,7 @@ const InitialCompanyArt = preload("res://entry/initial_company_art.gd")
const GuildDestinationSticker = preload("res://entry/guild_destination_sticker.gd")
const M54_CONTRACT_HEADER = preload("res://ui/m54/contract_header.gd")
const M54_CONTRACT_BOARD = preload("res://ui/m54/contract_board.gd")
const M54_CONTRACT_PARTY_SUMMARY = preload("res://ui/m54/contract_party_summary.gd")
func _render_view(data: Dictionary) -> void:
@@ -100,7 +101,7 @@ func _render_view(data: Dictionary) -> void:
review.add_child(difficulty_copy)
var market_counts: Dictionary = Dictionary(contract_data.get("market_counts", {}))
var facts := make_label(localize(
var facts_text := localize(
"建立后:%d 金币 · 队列容量 %d\n市场:%d 名招募 · %d 件装备 · %d 条战斗路线",
"On creation: %d Coin · Line capacity %d\nMarket: %d Recruits · %d equipment · %d battle routes",
data
@@ -110,10 +111,11 @@ func _render_view(data: Dictionary) -> void:
int(market_counts.get("recruit", 0)),
int(market_counts.get("equipment", 0)),
int(market_counts.get("battle", 0)),
], scaled(11), Color("#9ed7aa"))
facts.name = "ContractCreationFacts"
facts.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
review.add_child(facts)
]
var party_summary := M54_CONTRACT_PARTY_SUMMARY.new().configure(facts_text)
party_summary.name = "ContractPartySummary"
party_summary.custom_minimum_size = Vector2(0, 48)
review.add_child(party_summary)
var notice := make_label(String(data.get("notice", "")), scaled(10), Color("#f0ca75"))
notice.name = "ContractNotice"
notice.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
+19
View File
@@ -0,0 +1,19 @@
class_name ABGM54ContractPartySummary
extends Control
const UIFactory = preload("res://ui/shared/ui_factory.gd")
var summary_text := ""
func configure(next_summary: String) -> ABGM54ContractPartySummary:
summary_text = next_summary
return self
func _ready() -> void:
clip_contents = true
var facts := UIFactory.label(summary_text, "body", 1.0, Color("#9ed7aa"))
facts.name = "ContractCreationFacts"
facts.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
facts.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
facts.clip_text = true
facts.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
add_child(facts)