From 1cb4e17309a98ee01c60adf43a26c576e1c89152 Mon Sep 17 00:00:00 2001 From: cakipaul Date: Wed, 9 Jul 2025 20:48:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20closeup=20=E9=80=80?= =?UTF-8?q?=E5=87=BA=E9=80=BB=E8=BE=91=EF=BC=9Bquit=5Fcloseup=5Fon=5Fcance?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scene/entity/closeup.gd | 11 +++++------ scene/ground/scene/c01/s10_公寓楼道.tscn | 2 +- scene/ground/scene/c02/s05_一楼内侧楼道.tscn | 2 +- scene/ground/scene/c02/s06_二楼.tscn | 4 ++-- scene/ground/script/c02/敲门游戏.gd | 2 +- scene/little_game/八音盒/八音盒.gd | 2 +- scene/little_game/八音盒/八音盒_old.gd | 15 +++++++++------ scene/little_game/拼凑信件.gd | 6 ++---- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/scene/entity/closeup.gd b/scene/entity/closeup.gd index e70cf3aa..fb8d6783 100644 --- a/scene/entity/closeup.gd +++ b/scene/entity/closeup.gd @@ -7,7 +7,7 @@ class_name Closeup2D signal exit(arg) @export var packed_scene: PackedScene -@export var quit_closeup_on_escape := true +@export var quit_closeup_on_cancel := true @export_tool_button("新建特写场景") var create_closeup_scene = _create_scene_with_script var current_child: Node @@ -52,10 +52,7 @@ func _exit(arg = null): func _unhandled_input(event: InputEvent) -> void: if not current_child: return - if ( - quit_closeup_on_escape - and (event.is_action_pressed("cancel") or event.is_action_pressed("escape")) - ): + if quit_closeup_on_cancel and event.is_action_pressed("cancel"): _exit() get_viewport().set_input_as_handled() # 在有特写界面时,阻塞 interact 输入 @@ -73,7 +70,9 @@ var script_root_dir = "res://scene/ground/script/" func _create_scene_with_script(): if packed_scene: - print_rich("[color=orange][Closeup2D] packed_scene already exists, skip creating new scene and script.") + print_rich( + "[color=orange][Closeup2D] packed_scene already exists, skip creating new scene and script." + ) return var script = script_template.duplicate(true) as Script var new_packed_scene = PackedScene.new() diff --git a/scene/ground/scene/c01/s10_公寓楼道.tscn b/scene/ground/scene/c01/s10_公寓楼道.tscn index fe0e41e7..93f5fcd2 100644 --- a/scene/ground/scene/c01/s10_公寓楼道.tscn +++ b/scene/ground/scene/c01/s10_公寓楼道.tscn @@ -44,7 +44,7 @@ autoplay = "小蝶探头" [node name="Closeup鬼差探头" parent="Ground/DeployLayer" index="3" instance=ExtResource("8_2jx0x")] packed_scene = ExtResource("5_dnd0r") -quit_closeup_on_escape = false +quit_closeup_on_cancel = false [node name="Light" parent="Ground/AmbientLayer" index="0" instance=ExtResource("5_rw4mf")] position = Vector2(123, -20) diff --git a/scene/ground/scene/c02/s05_一楼内侧楼道.tscn b/scene/ground/scene/c02/s05_一楼内侧楼道.tscn index 4cfd467d..69bdbb02 100644 --- a/scene/ground/scene/c02/s05_一楼内侧楼道.tscn +++ b/scene/ground/scene/c02/s05_一楼内侧楼道.tscn @@ -176,7 +176,7 @@ hook_method = "wood_puppet" [node name="Closeup拿人偶后记忆闪回" parent="Ground/DeployLayer" index="5" instance=ExtResource("10_2yvhw")] position = Vector2(-108, -168) packed_scene = ExtResource("10_7mq0m") -quit_closeup_on_escape = false +quit_closeup_on_cancel = false action_key = 3 first_interact_os_key = "c02_一楼戏台" diff --git a/scene/ground/scene/c02/s06_二楼.tscn b/scene/ground/scene/c02/s06_二楼.tscn index db1dc8ef..8eb6e32e 100644 --- a/scene/ground/scene/c02/s06_二楼.tscn +++ b/scene/ground/scene/c02/s06_二楼.tscn @@ -1164,7 +1164,7 @@ frame_progress = 0.121203 [node name="Closeup弹珠游戏" parent="Ground/DeployLayer" index="15" instance=ExtResource("11_owxx3")] position = Vector2(322, -269) packed_scene = ExtResource("12_intre") -quit_closeup_on_escape = false +quit_closeup_on_cancel = false [node name="Closeup水盆" parent="Ground/DeployLayer" index="16" instance=ExtResource("11_owxx3")] position = Vector2(289, 16) @@ -1174,7 +1174,7 @@ first_interact_os_key = "c02_二楼水盆" [node name="Closeup谢幕演出" parent="Ground/DeployLayer" index="17" instance=ExtResource("11_owxx3")] position = Vector2(518, -272) packed_scene = ExtResource("25_m28ab") -quit_closeup_on_escape = false +quit_closeup_on_cancel = false action_key = 3 [node name="c02_final" type="Node2D" parent="Ground/DeployLayer" index="18"] diff --git a/scene/ground/script/c02/敲门游戏.gd b/scene/ground/script/c02/敲门游戏.gd index 917d69aa..6ab55c06 100644 --- a/scene/ground/script/c02/敲门游戏.gd +++ b/scene/ground/script/c02/敲门游戏.gd @@ -70,7 +70,7 @@ var quitting = false func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("escape") or event.is_action_pressed("cancel"): + if event.is_action_pressed("cancel"): if quitting: # 禁止手动退出,需要 exit.emit(true) get_viewport().set_input_as_handled() diff --git a/scene/little_game/八音盒/八音盒.gd b/scene/little_game/八音盒/八音盒.gd index d4d3b688..661fbc02 100644 --- a/scene/little_game/八音盒/八音盒.gd +++ b/scene/little_game/八音盒/八音盒.gd @@ -324,7 +324,7 @@ func _unhandled_input(event: InputEvent) -> void: else: # hud 无效shaking hud.on_toggle_invalid_prop() - elif event.is_action_pressed("escape"): + elif event.is_action_pressed("cancel"): get_viewport().set_input_as_handled() exit.emit(false) diff --git a/scene/little_game/八音盒/八音盒_old.gd b/scene/little_game/八音盒/八音盒_old.gd index 859d8243..901062c9 100644 --- a/scene/little_game/八音盒/八音盒_old.gd +++ b/scene/little_game/八音盒/八音盒_old.gd @@ -166,9 +166,8 @@ func _move_button(delta: int) -> void: func _unhandled_input(event: InputEvent) -> void: if not visible: return - # 阻止输入事件传递给其他节点 - get_viewport().set_input_as_handled() - if event.is_action_pressed("cancel") or event.is_action_pressed("escape"): + if event.is_action_pressed("cancel"): + get_viewport().set_input_as_handled() var success = ArchiveManager.archive.bayinhe_mode == "finished" exit.emit(success) visible = false @@ -178,12 +177,16 @@ func _unhandled_input(event: InputEvent) -> void: if ArchiveManager.archive.bayinhe_mode == "closed": # move button if event.is_action_pressed("up"): + get_viewport().set_input_as_handled() _move_button(1) elif event.is_action_pressed("down"): + get_viewport().set_input_as_handled() _move_button(-1) elif event.is_action_pressed("left"): + get_viewport().set_input_as_handled() current_selected_btn = clampi(current_selected_btn - 1, 0, 8) elif event.is_action_pressed("right"): + get_viewport().set_input_as_handled() current_selected_btn = clampi(current_selected_btn + 1, 0, 8) @@ -224,7 +227,7 @@ func _on_wheel_rotated(radiant: float) -> void: audio_player.play() else: audio_player.stream_paused = false - Util.timer(playing_step_sec, _on_playing_step_finished) + Util.timer(playing_step_sec, _on_playing_step_finished) func _on_playing_step_finished(): @@ -235,7 +238,7 @@ func _on_playing_step_finished(): return if continue_playing: continue_playing = false - Util.timer(playing_step_sec, _on_playing_step_finished) + Util.timer(playing_step_sec, _on_playing_step_finished) else: playing = false audio_player.stream_paused = true @@ -250,7 +253,7 @@ func _checkout_auto_play(): # var audio_len = audio_auto.get_length() # 音效 9.5 秒时关闭盒子 var audio_len = 9.5 - Util.timer(audio_len, _on_auto_play_finished) + Util.timer(audio_len, _on_auto_play_finished) func _on_auto_play_finished(): diff --git a/scene/little_game/拼凑信件.gd b/scene/little_game/拼凑信件.gd index c862f2f3..986c7257 100644 --- a/scene/little_game/拼凑信件.gd +++ b/scene/little_game/拼凑信件.gd @@ -156,11 +156,8 @@ func _post_success(): func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("escape") or event.is_action_pressed("bag"): - return - # block all input except "escape" or "bag" - get_viewport().set_input_as_handled() if event.is_action_pressed("cancel"): + get_viewport().set_input_as_handled() if game_finished: success.emit() else: @@ -194,6 +191,7 @@ func _unhandled_input(event: InputEvent) -> void: _rotate_part() handled = true if handled: + get_viewport().set_input_as_handled() $SfxMove.play() _display_selected() _check_answer()