diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index 7c83bc3..f56fe73 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -579,6 +579,7 @@ var auto_end_turn_yes_button: Button var auto_end_turn_no_button: Button var auto_end_turn_prompt_declined_turn := -1 var end_turn_button: Button +var hud_command_grid: GridContainer var wait_button: Button var tactic_button: Button var tactic_menu: VBoxContainer @@ -3930,37 +3931,37 @@ func _create_hud() -> void: _apply_label_style(inventory_label, UI_PARCHMENT_TEXT, 14) inventory_status_row.add_child(inventory_label) - var button_row := GridContainer.new() - button_row.name = "HudCommandGrid" - button_row.columns = HUD_COMMAND_GRID_COLUMNS - button_row.custom_minimum_size = HUD_COMMAND_GRID_SIZE - button_row.add_theme_constant_override("h_separation", 6) - button_row.add_theme_constant_override("v_separation", 5) - side_column.add_child(button_row) + hud_command_grid = GridContainer.new() + hud_command_grid.name = "HudCommandGrid" + hud_command_grid.columns = HUD_COMMAND_GRID_COLUMNS + hud_command_grid.custom_minimum_size = HUD_COMMAND_GRID_SIZE + hud_command_grid.add_theme_constant_override("h_separation", 6) + hud_command_grid.add_theme_constant_override("v_separation", 5) + side_column.add_child(hud_command_grid) wait_button = Button.new() wait_button.text = "대기" _configure_hud_command_button(wait_button, "wait") wait_button.pressed.connect(_on_wait_pressed) - button_row.add_child(wait_button) + hud_command_grid.add_child(wait_button) tactic_button = Button.new() tactic_button.text = "책략" _configure_hud_command_button(tactic_button, "tactic") tactic_button.pressed.connect(_on_tactic_pressed) - button_row.add_child(tactic_button) + hud_command_grid.add_child(tactic_button) item_button = Button.new() item_button.text = "도구" _configure_hud_command_button(item_button, "item") item_button.pressed.connect(_on_item_pressed) - button_row.add_child(item_button) + hud_command_grid.add_child(item_button) equip_button = Button.new() equip_button.text = "병장" _configure_hud_command_button(equip_button, "equip") equip_button.pressed.connect(_on_equip_pressed) - button_row.add_child(equip_button) + hud_command_grid.add_child(equip_button) tactic_menu = VBoxContainer.new() tactic_menu.visible = false @@ -10247,6 +10248,7 @@ func _update_hud() -> void: inventory_status_icon.tooltip_text = inventory_detail var selected := state.get_selected_unit() + _update_hud_command_grid_visibility(selected) if selected.is_empty(): var hovered_unit := _hovered_unit_for_hud_portrait() _update_hud_unit_portrait(hovered_unit) @@ -10300,6 +10302,12 @@ func _update_hud() -> void: _update_auto_end_turn_prompt() +func _update_hud_command_grid_visibility(selected: Dictionary) -> void: + if hud_command_grid == null: + return + hud_command_grid.visible = not selected.is_empty() + + func _update_auto_end_turn_prompt() -> void: if auto_end_turn_prompt_panel == null: return diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index 681b518..1ff554d 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -3587,9 +3587,13 @@ func _check_hud_focus_text(failures: Array[String]) -> void: failures.append("empty battle inventory prompt should still be framed as an icon status chip") elif scene.inventory_status_panel.tooltip_text != scene.inventory_label.tooltip_text or scene.inventory_status_icon.tooltip_text != scene.inventory_label.tooltip_text: failures.append("empty battle inventory chip should carry the readable inventory tooltip") + if scene.hud_command_grid == null or scene.hud_command_grid.visible: + failures.append("empty battle HUD should hide disabled unit command buttons until a unit is selected") scene.state.selected_unit_id = "cao_cao" scene.hover_cell = Vector2i(1, 6) scene._update_hud() + if scene.hud_command_grid == null or not scene.hud_command_grid.visible: + failures.append("selected unit HUD should show the unit command grid") if scene.hud_unit_badge_row == null or not scene.hud_unit_badge_row.visible: failures.append("selected unit HUD should expose compact hover badges") else: