Show combat merit progress clearly

This commit is contained in:
2026-06-21 05:55:10 +09:00
parent 45b8c39638
commit 121715659f
3 changed files with 88 additions and 3 deletions

View File

@@ -195,8 +195,8 @@ const OPENING_STORY_PROGRESS_LEDGER_SIZE := Vector2(326, 48)
const OPENING_STORY_PROGRESS_SEAL_SIZE := Vector2(34, 34)
const COMMAND_NOTICE_ICON_SIZE := Vector2(32, 32)
const COMMAND_NOTICE_MAX_ICONS := 5
const COMBAT_RESULT_PANEL_POSITION := Vector2(838, 430)
const COMBAT_RESULT_PANEL_SIZE := Vector2(396, 128)
const COMBAT_RESULT_PANEL_POSITION := Vector2(838, 402)
const COMBAT_RESULT_PANEL_SIZE := Vector2(396, 164)
const CHAPTER_SEAL_BADGE_SIZE := Vector2(54, 54)
const CHAPTER_SCENARIO_THUMBNAIL_SIZE := Vector2(72, 50)
const CHAPTER_INFO_BADGE_SIZE := Vector2(86, 22)
@@ -489,6 +489,8 @@ var objective_notice_label: Label
var combat_result_panel: PanelContainer
var combat_result_title_label: Label
var combat_result_primary_label: Label
var combat_result_growth_label: Label
var combat_result_merit_bar: ProgressBar
var combat_result_detail_label: Label
var ui_root_control: Control
var screen_backdrop: ColorRect
@@ -3753,8 +3755,26 @@ func _create_hud() -> void:
_apply_label_style(combat_result_primary_label, UI_RICE_PAPER_LIGHT, 15)
combat_result_column.add_child(combat_result_primary_label)
combat_result_growth_label = Label.new()
combat_result_growth_label.name = "CombatResultGrowth"
combat_result_growth_label.custom_minimum_size = Vector2(360, 20)
combat_result_growth_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
combat_result_growth_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
_apply_label_style(combat_result_growth_label, UI_PARCHMENT_TEXT, 13)
combat_result_column.add_child(combat_result_growth_label)
combat_result_merit_bar = ProgressBar.new()
combat_result_merit_bar.name = "CombatResultMeritBar"
combat_result_merit_bar.custom_minimum_size = Vector2(360, 14)
combat_result_merit_bar.min_value = 0.0
combat_result_merit_bar.max_value = BattleState.EXP_LEVEL
combat_result_merit_bar.show_percentage = false
combat_result_merit_bar.add_theme_stylebox_override("background", _make_panel_style(Color(0.050, 0.029, 0.018, 0.96), UI_LACQUER_EDGE, 1, 0, 0, 0))
combat_result_merit_bar.add_theme_stylebox_override("fill", _make_panel_style(Color(0.72, 0.50, 0.16, 1.0), Color(0.92, 0.80, 0.42, 1.0), 1, 0, 0, 0))
combat_result_column.add_child(combat_result_merit_bar)
combat_result_detail_label = Label.new()
combat_result_detail_label.custom_minimum_size = Vector2(360, 44)
combat_result_detail_label.custom_minimum_size = Vector2(360, 38)
combat_result_detail_label.vertical_alignment = VERTICAL_ALIGNMENT_TOP
combat_result_detail_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_apply_label_style(combat_result_detail_label, UI_PARCHMENT_TEXT, 13)
@@ -13033,6 +13053,7 @@ func _show_combat_result_report(report: Dictionary) -> void:
combat_result_detail_label.text = _join_strings(lines.slice(1), "\n")
combat_result_detail_label.tooltip_text = combat_result_primary_label.tooltip_text
combat_result_panel.tooltip_text = combat_result_primary_label.tooltip_text
_update_combat_result_growth_widgets(report, combat_result_primary_label.tooltip_text)
combat_result_panel.visible = true
combat_result_notice_timer = COMBAT_RESULT_NOTICE_DURATION
combat_result_panel.move_to_front()
@@ -13068,6 +13089,58 @@ func _format_combat_result_report_lines(report: Dictionary) -> Array[String]:
return lines
func _update_combat_result_growth_widgets(report: Dictionary, tooltip_text: String) -> void:
var progress := _primary_combat_progress(report)
var amount := int(progress.get("amount", 0))
var has_progress := amount > 0
if combat_result_growth_label != null:
combat_result_growth_label.visible = has_progress
combat_result_growth_label.text = _format_combat_growth_summary(progress) if has_progress else ""
combat_result_growth_label.tooltip_text = tooltip_text
if combat_result_merit_bar != null:
combat_result_merit_bar.visible = has_progress
combat_result_merit_bar.max_value = BattleState.EXP_LEVEL
combat_result_merit_bar.value = clampi(int(progress.get("exp_after", 0)), 0, BattleState.EXP_LEVEL) if has_progress else 0
combat_result_merit_bar.tooltip_text = tooltip_text
func _primary_combat_progress(report: Dictionary) -> Dictionary:
var attacker_progress := _as_dictionary(report.get("attacker_progress", {}))
var counter_progress := _as_dictionary(report.get("counter_progress", {}))
if int(attacker_progress.get("amount", 0)) > 0:
return attacker_progress
if int(counter_progress.get("amount", 0)) > 0:
return counter_progress
return {}
func _as_dictionary(value) -> Dictionary:
if typeof(value) == TYPE_DICTIONARY:
return (value as Dictionary).duplicate(true)
return {}
func _format_combat_growth_summary(progress: Dictionary) -> String:
if progress.is_empty():
return ""
var name := str(progress.get("name", "부대")).strip_edges()
if name.is_empty():
name = "부대"
var amount := int(progress.get("amount", 0))
var exp_after := clampi(int(progress.get("exp_after", 0)), 0, BattleState.EXP_LEVEL)
var next_needed := BattleState.EXP_LEVEL - exp_after
var level_before := int(progress.get("level_before", 0))
var level_after := int(progress.get("level_after", level_before))
var parts: Array[String] = ["%s 전공 +%d" % [name, amount]]
if level_after > level_before:
parts.append("등급 %d 달성" % level_after)
if bool(progress.get("promoted", false)):
var class_after := str(progress.get("class_after", "")).strip_edges()
parts.append("%s 승급" % class_after if not class_after.is_empty() else "승급")
parts.append("다음 등급까지 %d" % next_needed)
return _join_strings(parts, " · ")
func _format_combat_result_entry(entry: Dictionary) -> String:
var attacker_name := str(entry.get("attacker_name", "부대"))
var target_name := str(entry.get("target_name", ""))