Improve readable battle text previews

This commit is contained in:
2026-06-20 17:54:09 +09:00
parent a5e5ddc310
commit b1884274ec
2 changed files with 184 additions and 27 deletions

View File

@@ -26,6 +26,7 @@ func _init() -> void:
_check_battle_start_notice_sequence(failures)
_check_readability_contract(failures)
_check_first_battle_rendered_text_fit(failures)
_check_command_notice_readable_preview(failures)
_check_korean_fallback_labels(failures)
_check_dialogue_localization_and_side(failures)
_check_event_dialogue_side_passthrough(failures)
@@ -698,7 +699,9 @@ func _check_text_fit_contract(scene, failures: Array[String]) -> void:
"_fit_font_size_for_text",
"_estimated_wrapped_text_height",
"_estimated_wrapped_line_count",
"_weighted_text_length"
"_weighted_text_length",
"_compact_visible_text",
"_set_readable_preview_label_text"
]:
if not scene.has_method(method_name):
failures.append("missing text fit helper: %s" % method_name)
@@ -730,6 +733,29 @@ func _check_text_fit_contract(scene, failures: Array[String]) -> void:
var fitted_objective_height := float(scene._estimated_wrapped_text_height(long_objective, objective_area.x, fitted_objective_size))
if fitted_objective_height > objective_area.y:
failures.append("fitted briefing objective text should stay within its panel")
var compact_lines := str(scene._compact_visible_text(
"첫 줄은 그대로 보인다.\n둘째 줄도 보인다.\n셋째 줄은 숨긴다.",
2,
18
)).split("\n")
if compact_lines.size() > 2:
failures.append("compact visible text should respect the requested line budget: %s" % str(compact_lines))
func _check_command_notice_readable_preview(failures: Array[String]) -> void:
var scene = BattleSceneScript.new()
scene._create_hud()
var long_body := "목표: 조조나 하후돈으로 동쪽 성채에 올라 깃발을 붙들고, 제11군령 이후 나타나는 마지막 황건 잔당까지 격파하라.\n주의: 조조가 퇴각하거나 제22턴이 시작되면 패한다.\n보급: 마을과 치료소를 오가며 장기전을 버틴다."
scene._show_command_notice("전투 개시", long_body)
_check_label_fits_visible_area(scene, failures, scene.objective_notice_label, "long command notice")
var notice_lines: Array = []
if scene.objective_notice_label != null:
notice_lines = str(scene.objective_notice_label.text).split("\n")
if notice_lines.size() > 3:
failures.append("long command notice should keep only title plus two readable body lines: %s" % str(notice_lines))
if scene.objective_notice_label != null and not scene.objective_notice_label.tooltip_text.contains("마지막 황건 잔당"):
failures.append("long command notice should preserve the full text in its tooltip")
scene.free()
func _check_first_battle_rendered_text_fit(failures: Array[String]) -> void:
@@ -753,6 +779,12 @@ func _check_first_battle_rendered_text_fit(failures: Array[String]) -> void:
_check_label_fits_visible_area(scene, failures, scene.briefing_objective_label, "opening briefing objective")
_check_label_fits_visible_area(scene, failures, scene.briefing_camp_overview_label, "opening briefing map overview")
_check_label_fits_visible_area(scene, failures, scene.briefing_label, "opening briefing body")
if scene.briefing_label != null:
var briefing_lines := str(scene.briefing_label.text).split("\n")
if briefing_lines.size() > BattleSceneScript.BRIEFING_VISIBLE_BODY_LINES:
failures.append("opening briefing body should keep a short visible summary: %s" % str(briefing_lines))
if not scene.briefing_label.tooltip_text.contains("적은 마을과 성채"):
failures.append("opening briefing body should keep the full briefing text in its tooltip")
var briefing: Dictionary = scene.state.get_briefing()
var dialogue_lines: Array = []