From 4e247ee4cce83e44962dd2fd0f96a897264f880d Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sat, 20 Jun 2026 08:43:23 +0900 Subject: [PATCH] Use icons for compact unit HUD badges --- scripts/scenes/battle_scene.gd | 52 ++++++++++++++++++++++++++-------- tools/smoke_visual_assets.gd | 3 ++ 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index 0931fa7..f42d8a2 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -1281,34 +1281,37 @@ func _update_hud_unit_badges(unit: Dictionary, detail_text: String) -> void: return hud_unit_badge_row.add_child(_make_hud_unit_badge( - _hud_unit_team_badge_text(unit), + "", _hud_unit_badge_tooltip(_unit_team_text(str(unit.get("team", ""))), detail_text), - _hud_unit_team_badge_color(unit) + _hud_unit_team_badge_color(unit), + _hud_unit_team_badge_icon_kind(unit) )) hud_unit_badge_row.add_child(_make_hud_unit_class_badge(unit, detail_text)) hud_unit_badge_row.add_child(_make_hud_unit_badge( - "동" if _unit_pixel_facing(unit) >= 0 else "서", + "", _hud_unit_badge_tooltip("시선 %s\n등 뒤를 잡히면 피해가 커집니다." % _unit_facing_text(unit), detail_text), - Color(0.24, 0.20, 0.12, 0.98) + Color(0.24, 0.20, 0.12, 0.98), + "formation" )) var hp_max := maxi(1, int(unit.get("max_hp", 1))) var hp_ratio := float(clampi(int(unit.get("hp", 0)), 0, hp_max)) / float(hp_max) if hp_ratio <= LOW_HP_WARNING_RATIO: hud_unit_badge_row.add_child(_make_hud_unit_badge( - "위", + "", _hud_unit_badge_tooltip("병력이 크게 낮습니다.", detail_text), - Color(0.56, 0.055, 0.028, 0.99) + Color(0.56, 0.055, 0.028, 0.99), + "status" )) var marker_kinds := _unit_status_marker_kinds(unit) if not marker_kinds.is_empty(): var marker_kind := marker_kinds[0] hud_unit_badge_row.add_child(_make_hud_unit_badge( - _unit_status_marker_glyph(marker_kind), + "", _hud_unit_badge_tooltip("상태 표식\n자세한 효과는 아래 상세를 확인합니다.", detail_text), _unit_status_marker_color(marker_kind), - "", + _unit_status_marker_icon_kind(marker_kind), _unit_status_marker_text_color(marker_kind) )) @@ -1405,6 +1408,15 @@ func _hud_unit_team_badge_color(unit: Dictionary) -> Color: return Color(0.24, 0.22, 0.16, 0.99) +func _hud_unit_team_badge_icon_kind(unit: Dictionary) -> String: + var team := str(unit.get("team", "")) + if team == BattleState.TEAM_PLAYER: + return "unit_list" + if team == BattleState.TEAM_ENEMY: + return "threat" + return "status" + + func _hud_unit_class_badge_text(unit: Dictionary) -> String: var class_id := str(unit.get("class_id", "")).to_lower() if class_id.contains("cavalry"): @@ -1439,21 +1451,21 @@ func _hud_unit_action_badges(unit: Dictionary, detail_text: String) -> Array: var result := [] var unit_id := str(unit.get("id", "")) if unit_id.is_empty(): - result.append(_hud_unit_action_badge("봉", "", "봉인", "명령할 수 없는 표식입니다.", detail_text, Color(0.20, 0.16, 0.11, 0.98))) + result.append(_hud_unit_action_badge("봉", "status", "봉인", "명령할 수 없는 표식입니다.", detail_text, Color(0.20, 0.16, 0.11, 0.98))) return result var team := str(unit.get("team", "")) if team != BattleState.TEAM_PLAYER: result.append(_hud_unit_action_badge("적", "threat", "적군", "직접 명령할 수 없습니다.", detail_text, Color(0.48, 0.045, 0.028, 0.99))) return result if not bool(unit.get("controllable", true)): - result.append(_hud_unit_action_badge("호", "", "호위", "호위 대상은 직접 명령할 수 없습니다.", detail_text, Color(0.31, 0.23, 0.12, 0.98))) + result.append(_hud_unit_action_badge("호", "unit_list", "호위", "호위 대상은 직접 명령할 수 없습니다.", detail_text, Color(0.31, 0.23, 0.12, 0.98))) return result if not bool(unit.get("alive", true)) or not bool(unit.get("deployed", true)) or bool(unit.get("acted", false)): - result.append(_hud_unit_action_badge("봉", "", "봉인", "이 부대는 이미 행동했거나 출진하지 않았습니다.", detail_text, Color(0.20, 0.16, 0.11, 0.98))) + result.append(_hud_unit_action_badge("봉", "wait", "봉인", "이 부대는 이미 행동했거나 출진하지 않았습니다.", detail_text, Color(0.20, 0.16, 0.11, 0.98))) return result var phase_block := _action_phase_block_reason() if not phase_block.is_empty(): - result.append(_hud_unit_action_badge("대", "", str(phase_block.get("label", "대기")), str(phase_block.get("tooltip", "")), detail_text, Color(0.20, 0.16, 0.11, 0.98))) + result.append(_hud_unit_action_badge("대", "wait", str(phase_block.get("label", "대기")), str(phase_block.get("tooltip", "")), detail_text, Color(0.20, 0.16, 0.11, 0.98))) return result if not bool(unit.get("moved", false)) and not state.get_movement_range(unit_id).is_empty(): result.append(_hud_unit_action_badge("행", "move", "행군", "이동 가능한 칸이 있습니다.", detail_text, Color(0.34, 0.23, 0.070, 0.99))) @@ -7241,6 +7253,22 @@ func _unit_status_marker_glyph(marker_kind: String) -> String: return "상" +func _unit_status_marker_icon_kind(marker_kind: String) -> String: + if marker_kind == "support": + return "formation" + if marker_kind == "debuff": + return "threat" + if marker_kind == "poison": + return "item" + if marker_kind == "seal": + return "tactic" + if marker_kind == "snare": + return "cancel" + if marker_kind == "disarm": + return "attack" + return "status" + + func _unit_status_marker_text_color(marker_kind: String) -> Color: if marker_kind == "poison" or marker_kind == "support": return UI_AGED_INK diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index fb0822c..a8138d3 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -3306,6 +3306,9 @@ func _check_hud_focus_text(failures: Array[String]) -> void: failures.append("selected unit action badges should expose available commands through tooltips: %s" % badge_tooltips) if not _has_descendant_texture(scene.hud_unit_badge_row): failures.append("selected unit action badges should use icon imagery, not only text") + var badge_visible_text := _collect_child_text(scene.hud_unit_badge_row).strip_edges() + if not badge_visible_text.is_empty(): + failures.append("selected unit compact badges should avoid one-letter class/action text and rely on icons: %s" % badge_visible_text) var xiahou_dun: Dictionary = scene.state.get_unit("xiahou_dun") xiahou_dun["pos"] = Vector2i(4, 1) var forest_text := scene._unit_current_terrain_text(xiahou_dun)