Compact prebattle shop rows
This commit is contained in:
@@ -2986,14 +2986,28 @@ func _check_scene_texture_loading(failures: Array[String]) -> void:
|
||||
if not sell_detail.contains("반값으로 넘김") or not sell_detail.contains("보유 2점"):
|
||||
failures.append("shop sell detail should summarize sale rule and owned count")
|
||||
var bean_action := scene._format_shop_buy_action_text("bean", bean, int(bean.get("price", 0)))
|
||||
if not bean_action.contains("매입 콩") or not bean_action.contains("50냥"):
|
||||
failures.append("shop buy action should be concise and priced")
|
||||
if bean_action.contains("매입") or not bean_action.contains("콩") or not bean_action.contains("50냥"):
|
||||
failures.append("shop buy action should stay compact and priced")
|
||||
var bean_tooltip := scene._format_shop_item_tooltip_text(
|
||||
scene._format_shop_item_button_text("bean", bean, int(bean.get("price", 0)), 0),
|
||||
bean_buy_detail
|
||||
)
|
||||
if not bean_tooltip.contains("\n") or not bean_tooltip.contains("보유 0점"):
|
||||
failures.append("shop item tooltip should preserve full item detail")
|
||||
scene._create_hud()
|
||||
scene.campaign_state.gold = 320
|
||||
scene.shop_sell_mode = false
|
||||
scene._rebuild_shop_menu()
|
||||
var shop_visible_text := _collect_child_text(scene.shop_list)
|
||||
var shop_tooltips := _collect_child_tooltips(scene.shop_list)
|
||||
if shop_visible_text.contains("병력 +20") or shop_visible_text.contains("보유 0점") or shop_visible_text.contains("잔량 0/"):
|
||||
failures.append("shop rows should keep effects and inventory details in hover text: %s" % shop_visible_text)
|
||||
if not shop_visible_text.contains("콩") or not shop_visible_text.contains("50냥"):
|
||||
failures.append("shop row should still show item name and price compactly: %s" % shop_visible_text)
|
||||
if not shop_tooltips.contains("병력 +20") or not shop_tooltips.contains("보유 0점"):
|
||||
failures.append("shop row tooltip should retain full item detail: %s" % shop_tooltips)
|
||||
if not _has_descendant_texture(scene.shop_list):
|
||||
failures.append("shop rows should use item icon artwork")
|
||||
scene.free()
|
||||
|
||||
_check_scenario_background_texture_loading(failures)
|
||||
@@ -3556,6 +3570,29 @@ func _collect_child_tooltips_into(root: Node, parts: Array[String]) -> void:
|
||||
_collect_child_tooltips_into(child, parts)
|
||||
|
||||
|
||||
func _collect_child_text(root: Node) -> String:
|
||||
if root == null:
|
||||
return ""
|
||||
var parts: Array[String] = []
|
||||
_collect_child_text_into(root, parts)
|
||||
return "\n".join(parts)
|
||||
|
||||
|
||||
func _collect_child_text_into(root: Node, parts: Array[String]) -> void:
|
||||
if root == null:
|
||||
return
|
||||
if root is Button:
|
||||
var button_text := str((root as Button).text).strip_edges()
|
||||
if not button_text.is_empty():
|
||||
parts.append(button_text)
|
||||
elif root is Label:
|
||||
var label_text := str((root as Label).text).strip_edges()
|
||||
if not label_text.is_empty():
|
||||
parts.append(label_text)
|
||||
for child in root.get_children():
|
||||
_collect_child_text_into(child, parts)
|
||||
|
||||
|
||||
func _has_descendant_texture(root: Node) -> bool:
|
||||
if root == null:
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user