Add visual reward strip to results
This commit is contained in:
@@ -47,6 +47,18 @@ func _init() -> void:
|
||||
_check_contains(failures, "next camp shop", result_text, "군상 물품 · 6종")
|
||||
_check_contains(failures, "next camp deploy", result_text, "출진 명부 · 2/4")
|
||||
_check_contains(failures, "next camp formation", result_text, "진형 배치 6칸")
|
||||
scene._create_hud()
|
||||
scene._rebuild_result_reward_strip()
|
||||
if scene.result_reward_strip == null or not scene.result_reward_strip.visible:
|
||||
failures.append("victory result should show a compact reward icon strip")
|
||||
elif scene.result_reward_strip.get_child_count() < 3:
|
||||
failures.append("reward icon strip should include gold, item, and officer chips")
|
||||
var reward_tooltips := _collect_tooltips(scene.result_reward_strip)
|
||||
_check_contains(failures, "reward strip gold tooltip", reward_tooltips, "군자금 +100냥")
|
||||
_check_contains(failures, "reward strip item tooltip", reward_tooltips, "물자: 콩 2점")
|
||||
_check_contains(failures, "reward strip officer tooltip", reward_tooltips, "합류: 전위")
|
||||
if not _has_texture_rect(scene.result_reward_strip):
|
||||
failures.append("reward icon strip should reuse item or officer artwork")
|
||||
|
||||
scene.battle_result_summary = {
|
||||
"saved": false,
|
||||
@@ -129,3 +141,23 @@ func _check_not_contains(failures: Array[String], label: String, text: String, u
|
||||
if not text.contains(unexpected):
|
||||
return
|
||||
failures.append("%s did not expect `%s` in `%s`" % [label, unexpected, text])
|
||||
|
||||
|
||||
func _collect_tooltips(root: Node) -> String:
|
||||
var parts := []
|
||||
if root is Control:
|
||||
var tooltip := (root as Control).tooltip_text
|
||||
if not tooltip.is_empty():
|
||||
parts.append(tooltip)
|
||||
for child in root.get_children():
|
||||
parts.append(_collect_tooltips(child))
|
||||
return "\n".join(parts)
|
||||
|
||||
|
||||
func _has_texture_rect(root: Node) -> bool:
|
||||
if root is TextureRect and (root as TextureRect).texture != null:
|
||||
return true
|
||||
for child in root.get_children():
|
||||
if _has_texture_rect(child):
|
||||
return true
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user