Add icon chips to top battle HUD
This commit is contained in:
@@ -3176,6 +3176,9 @@ func _check_ancient_ui_theme(failures: Array[String]) -> void:
|
||||
failures.append("top objective label should avoid repeated visible heading: %s" % ("" if scene.objective_label == null else scene.objective_label.text))
|
||||
elif not scene.objective_label.tooltip_text.contains("승리:") or not scene.objective_label.tooltip_text.contains("패배:"):
|
||||
failures.append("top objective tooltip should retain objective detail: %s" % ("" if scene.objective_label == null else scene.objective_label.tooltip_text))
|
||||
_check_top_hud_chip(failures, scene, "TopStatusChip", scene.status_label, "군령")
|
||||
_check_top_hud_chip(failures, scene, "TopObjectiveChip", scene.objective_label, "승리:")
|
||||
_check_top_hud_chip(failures, scene, "TopCampaignChip", scene.campaign_status_label, "군자금")
|
||||
var mission_text := scene._format_mission_panel_text()
|
||||
for expected in ["승리:", "패배:", "진행:", "주의:"]:
|
||||
if not mission_text.contains(expected):
|
||||
@@ -3502,6 +3505,33 @@ func _find_descendant_by_name(root: Node, node_name: String) -> Node:
|
||||
return null
|
||||
|
||||
|
||||
func _is_descendant_of(node: Node, ancestor: Node) -> bool:
|
||||
var current := node
|
||||
while current != null:
|
||||
if current == ancestor:
|
||||
return true
|
||||
current = current.get_parent()
|
||||
return false
|
||||
|
||||
|
||||
func _check_top_hud_chip(failures: Array[String], scene, chip_name: String, expected_label: Label, expected_tooltip_text: String) -> void:
|
||||
var chip := _find_descendant_by_name(scene.ui_root_control, chip_name)
|
||||
if chip == null:
|
||||
failures.append("top HUD chip missing: %s" % chip_name)
|
||||
return
|
||||
if not chip is PanelContainer:
|
||||
failures.append("top HUD chip should be a framed panel: %s" % chip_name)
|
||||
if expected_label == null or not _is_descendant_of(expected_label, chip):
|
||||
failures.append("top HUD chip should contain the existing label var: %s" % chip_name)
|
||||
if not _has_descendant_texture(chip):
|
||||
failures.append("top HUD chip should contain an icon texture: %s" % chip_name)
|
||||
if (chip as Control).custom_minimum_size.x <= 0.0 or (chip as Control).custom_minimum_size.y <= 0.0:
|
||||
failures.append("top HUD chip should reserve stable space: %s" % chip_name)
|
||||
var tooltip_text := _collect_child_tooltips(chip)
|
||||
if not tooltip_text.contains(expected_tooltip_text):
|
||||
failures.append("top HUD chip tooltip should preserve detail `%s`: %s" % [expected_tooltip_text, tooltip_text])
|
||||
|
||||
|
||||
func _collect_child_tooltips(root: Node) -> String:
|
||||
if root == null:
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user