Use icons for compact unit HUD badges

This commit is contained in:
2026-06-20 08:43:23 +09:00
parent 7e294194ae
commit 4e247ee4cc
2 changed files with 43 additions and 12 deletions

View File

@@ -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