From f152db5137517b90281eaf5fcbce4efa0bf4ec5f Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sat, 20 Jun 2026 14:47:01 +0900 Subject: [PATCH] Polish auto end turn prompt controls --- scripts/scenes/battle_scene.gd | 26 ++++++++++++++++++++++++++ tools/smoke_post_move_action_flow.gd | 23 +++++++++++++++++++---- tools/smoke_visual_assets.gd | 4 ++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index ed383d0..7e47e85 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -723,6 +723,16 @@ func _unhandled_input(event: InputEvent) -> void: _advance_dialogue() return + if _is_auto_end_turn_prompt_visible(): + if event is InputEventKey and event.pressed and not event.echo: + if event.keycode == KEY_ENTER or event.keycode == KEY_SPACE: + _on_auto_end_turn_yes_pressed() + elif event.keycode == KEY_ESCAPE or event.keycode == KEY_BACKSPACE: + _on_auto_end_turn_no_pressed() + elif event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_RIGHT and event.pressed: + _on_auto_end_turn_no_pressed() + return + if event is InputEventMouseMotion: if _handle_minimap_mouse_motion(event): return @@ -3334,6 +3344,14 @@ func _create_hud() -> void: auto_end_turn_yes_button.text = "차례 넘김" auto_end_turn_yes_button.tooltip_text = "아군 차례를 마치고 적군 차례로 넘깁니다." auto_end_turn_yes_button.custom_minimum_size = Vector2(132, 38) + auto_end_turn_yes_button.icon = _make_toolbar_icon("end_turn") + auto_end_turn_yes_button.icon_alignment = HORIZONTAL_ALIGNMENT_LEFT + auto_end_turn_yes_button.vertical_icon_alignment = VERTICAL_ALIGNMENT_CENTER + auto_end_turn_yes_button.expand_icon = false + auto_end_turn_yes_button.add_theme_constant_override("icon_max_width", 28) + auto_end_turn_yes_button.add_theme_constant_override("h_separation", 8) + auto_end_turn_yes_button.set_meta("command_icon", "end_turn") + auto_end_turn_yes_button.set_meta("command_label", "차례 넘김") _apply_button_style(auto_end_turn_yes_button, true) auto_end_turn_yes_button.pressed.connect(_on_auto_end_turn_yes_pressed) auto_end_button_row.add_child(auto_end_turn_yes_button) @@ -3342,6 +3360,14 @@ func _create_hud() -> void: auto_end_turn_no_button.text = "머무름" auto_end_turn_no_button.tooltip_text = "이번 차례에는 자동 확인을 닫습니다." auto_end_turn_no_button.custom_minimum_size = Vector2(132, 38) + auto_end_turn_no_button.icon = _make_toolbar_icon("cancel") + auto_end_turn_no_button.icon_alignment = HORIZONTAL_ALIGNMENT_LEFT + auto_end_turn_no_button.vertical_icon_alignment = VERTICAL_ALIGNMENT_CENTER + auto_end_turn_no_button.expand_icon = false + auto_end_turn_no_button.add_theme_constant_override("icon_max_width", 28) + auto_end_turn_no_button.add_theme_constant_override("h_separation", 8) + auto_end_turn_no_button.set_meta("command_icon", "cancel") + auto_end_turn_no_button.set_meta("command_label", "머무름") _apply_button_style(auto_end_turn_no_button) auto_end_turn_no_button.pressed.connect(_on_auto_end_turn_no_pressed) auto_end_button_row.add_child(auto_end_turn_no_button) diff --git a/tools/smoke_post_move_action_flow.gd b/tools/smoke_post_move_action_flow.gd index 063c98e..30cbd56 100644 --- a/tools/smoke_post_move_action_flow.gd +++ b/tools/smoke_post_move_action_flow.gd @@ -104,8 +104,12 @@ func _check_auto_end_turn_prompt_flow(failures: Array[String]) -> void: return if scene.auto_end_turn_yes_button == null or scene.auto_end_turn_yes_button.text != "차례 넘김": failures.append("auto end turn confirm button should use contextual Korean text") + elif scene.auto_end_turn_yes_button.icon == null or str(scene.auto_end_turn_yes_button.get_meta("command_icon", "")) != "end_turn": + failures.append("auto end turn confirm button should expose a generated end-turn icon") if scene.auto_end_turn_no_button == null or scene.auto_end_turn_no_button.text != "머무름": failures.append("auto end turn decline button should use contextual Korean text") + elif scene.auto_end_turn_no_button.icon == null or str(scene.auto_end_turn_no_button.get_meta("command_icon", "")) != "cancel": + failures.append("auto end turn decline button should expose a generated cancel icon") for unit in scene.state.units: if str(unit.get("team", "")) == BattleStateScript.TEAM_PLAYER and bool(unit.get("controllable", true)): @@ -143,12 +147,23 @@ func _check_auto_end_turn_prompt_flow(failures: Array[String]) -> void: scene._update_hud() if not scene.auto_end_turn_prompt_panel.visible: failures.append("auto end turn prompt should reopen after the declined-turn guard is cleared") - var turn_before: int = scene.state.turn_number - scene._on_auto_end_turn_yes_pressed() + var escape_event := InputEventKey.new() + escape_event.keycode = KEY_ESCAPE + escape_event.pressed = true + scene._unhandled_input(escape_event) if scene.auto_end_turn_prompt_panel.visible: - failures.append("auto end turn prompt should hide after confirming turn end") + failures.append("Escape should decline the auto end turn prompt") + scene.auto_end_turn_prompt_declined_turn = -1 + scene._update_hud() + var turn_before: int = scene.state.turn_number + var enter_event := InputEventKey.new() + enter_event.keycode = KEY_ENTER + enter_event.pressed = true + scene._unhandled_input(enter_event) + if scene.auto_end_turn_prompt_panel.visible: + failures.append("Enter should confirm and hide the auto end turn prompt") if scene.state.turn_number <= turn_before and scene.state.battle_status == BattleStateScript.STATUS_ACTIVE: - failures.append("confirming auto end turn should advance through the enemy phase") + failures.append("confirming auto end turn by keyboard should advance through the enemy phase") scene.free() diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index c3a4bdb..fc93e2b 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -3688,8 +3688,12 @@ func _check_ancient_ui_theme(failures: Array[String]) -> void: failures.append("auto end turn prompt should show an old command-complete caption") if scene.auto_end_turn_yes_button == null or scene.auto_end_turn_yes_button.text != "차례 넘김": failures.append("auto end turn confirm button should use command wording") + elif scene.auto_end_turn_yes_button.icon == null or str(scene.auto_end_turn_yes_button.get_meta("command_icon", "")) != "end_turn": + failures.append("auto end turn confirm button should use a generated end-turn icon") if scene.auto_end_turn_no_button == null or scene.auto_end_turn_no_button.text != "머무름": failures.append("auto end turn decline button should use command wording") + elif scene.auto_end_turn_no_button.icon == null or str(scene.auto_end_turn_no_button.get_meta("command_icon", "")) != "cancel": + failures.append("auto end turn decline button should use a generated cancel icon") scene._on_log_added("적군 차례가 열렸습니다.") if scene.objective_notice_panel == null or not scene.objective_notice_panel.visible: failures.append("enemy turn log should show the command notice panel")