Use icon state badges in battle unit list
This commit is contained in:
@@ -4169,6 +4169,17 @@ func _count_descendants_by_name(root: Node, node_name: String) -> int:
|
||||
return count
|
||||
|
||||
|
||||
func _count_descendants_by_meta(root: Node, meta_key: String, expected_value: Variant) -> int:
|
||||
if root == null:
|
||||
return 0
|
||||
var count := 0
|
||||
if root.has_meta(meta_key) and root.get_meta(meta_key) == expected_value:
|
||||
count += 1
|
||||
for child in root.get_children():
|
||||
count += _count_descendants_by_meta(child, meta_key, expected_value)
|
||||
return count
|
||||
|
||||
|
||||
func _is_descendant_of(node: Node, ancestor: Node) -> bool:
|
||||
var current := node
|
||||
while current != null:
|
||||
@@ -4475,9 +4486,14 @@ func _check_battle_unit_list_panel(failures: Array[String]) -> void:
|
||||
failures.append("ally battle unit list should show compact zone badges: %s" % ally_badge_text)
|
||||
if _find_descendant_by_name(scene.battle_unit_list_rows, "BattleUnitListHpBar") == null:
|
||||
failures.append("ally battle unit list should show a visual HP bar instead of inline percent text")
|
||||
if _count_descendants_by_meta(scene.battle_unit_list_rows, "battle_unit_list_badge_kind", "action") < 2:
|
||||
failures.append("ally battle unit list should show action state as icon badges")
|
||||
for class_label in ["지휘관", "기병", "보병", "궁병", "책사"]:
|
||||
if ally_badge_text.contains(class_label):
|
||||
failures.append("ally battle unit list should move class names into icon hover text: %s" % ally_badge_text)
|
||||
for action_label in ["행동", "완료", "호위", "퇴각"]:
|
||||
if ally_badge_text.contains(action_label):
|
||||
failures.append("ally battle unit list should move action labels into icon hover text: %s" % ally_badge_text)
|
||||
if ally_visible_text.contains("좌 "):
|
||||
failures.append("ally battle unit list should keep raw coordinates out of visible badges: %s" % ally_visible_text)
|
||||
if ally_visible_text.contains("군령:") or ally_visible_text.contains("행군 4") or ally_visible_text.contains("타격 1-1"):
|
||||
@@ -4508,23 +4524,24 @@ func _check_battle_unit_list_panel(failures: Array[String]) -> void:
|
||||
var enemy_visible_text := _collect_child_text(scene.battle_unit_list_rows)
|
||||
var enemy_badge_text := _collect_descendant_text_by_name(scene.battle_unit_list_rows, "BattleUnitListBadgeLabel")
|
||||
var enemy_tooltips := _collect_child_tooltips(scene.battle_unit_list_rows)
|
||||
if not enemy_badge_text.contains("적"):
|
||||
failures.append("enemy battle unit list should show compact status badges: %s" % enemy_badge_text)
|
||||
if enemy_badge_text.contains("%"):
|
||||
failures.append("enemy battle unit list should move exact HP percent into the hover bar tooltip: %s" % enemy_badge_text)
|
||||
if _find_descendant_by_name(scene.battle_unit_list_rows, "BattleUnitListHpBar") == null:
|
||||
failures.append("enemy battle unit list should show a visual HP bar instead of inline percent text")
|
||||
if _count_descendants_by_meta(scene.battle_unit_list_rows, "battle_unit_list_badge_kind", "action") < 1:
|
||||
failures.append("enemy battle unit list should show AI state as icon badges")
|
||||
if not enemy_badge_text.contains("성채") and not enemy_badge_text.contains("동측"):
|
||||
failures.append("enemy battle unit list should show a readable zone badge instead of raw coordinates: %s" % enemy_badge_text)
|
||||
for class_label in ["지휘관", "기병", "보병", "궁병", "책사"]:
|
||||
if enemy_badge_text.contains(class_label):
|
||||
failures.append("enemy battle unit list should move class names into icon hover text: %s" % enemy_badge_text)
|
||||
for action_label in ["적", "대기", "수비", "경계"]:
|
||||
if enemy_badge_text.contains(action_label):
|
||||
failures.append("enemy battle unit list should move AI state labels into icon hover text: %s" % enemy_badge_text)
|
||||
if enemy_visible_text.contains("좌 "):
|
||||
failures.append("enemy battle unit list should keep raw coordinates out of visible badges: %s" % enemy_visible_text)
|
||||
if enemy_visible_text.contains("군령:") or enemy_visible_text.contains("직접 명령"):
|
||||
failures.append("enemy battle unit list rows should keep dense enemy detail in hover text: %s" % enemy_visible_text)
|
||||
if not (enemy_badge_text.contains("대기") or enemy_badge_text.contains("수비") or enemy_badge_text.contains("경계")):
|
||||
failures.append("enemy battle unit list should expose compact AI state badges: %s" % enemy_badge_text)
|
||||
if not enemy_tooltips.contains("군령: 적군 군기") or not enemy_tooltips.contains("클릭하면 위치로 이동"):
|
||||
failures.append("enemy battle unit list tooltips should retain enemy detail: %s" % enemy_tooltips)
|
||||
if not enemy_tooltips.contains("유인 반경") or not enemy_tooltips.contains("거점 경계 반경"):
|
||||
|
||||
Reference in New Issue
Block a user