书架游戏退出优化

This commit is contained in:
cakipaul 2025-04-21 01:36:44 +08:00
parent 039eafdf48
commit 8025350aa3
3 changed files with 30 additions and 43 deletions

View File

@ -264,7 +264,7 @@ func _on_success_finished() -> void:
func _unhandled_input(event: InputEvent) -> void:
# 阻塞输入
get_viewport().set_input_as_handled()
if event.is_action_pressed("cancel"):
if event.is_action_pressed("cancel") or event.is_action_pressed("escape"):
if not gameover:
exiting.emit()
get_parent().remove_child(self)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=53 format=3 uid="uid://fwfr0b2sylwx"]
[gd_scene load_steps=52 format=3 uid="uid://fwfr0b2sylwx"]
[ext_resource type="Script" uid="uid://b7iavnqno6e3s" path="res://scene/little_game/书架/书架.gd" id="1_8af23"]
[ext_resource type="AudioStream" uid="uid://6v8oqjaj01nj" path="res://asset/audio/sfx/交互/序章/04_书店内_书本掉落.wav" id="2_c6xiu"]
@ -164,21 +164,17 @@ region = Rect2(369, 457, 15, 99)
[sub_resource type="AtlasTexture" id="AtlasTexture_sungh"]
atlas = ExtResource("6_pxxx5")
region = Rect2(369, 457, 15, 99)
region = Rect2(391, 459, 13, 97)
[sub_resource type="AtlasTexture" id="AtlasTexture_yqrs8"]
atlas = ExtResource("6_pxxx5")
region = Rect2(391, 459, 13, 97)
region = Rect2(411, 459, 13, 97)
[sub_resource type="AtlasTexture" id="AtlasTexture_jrkcq"]
atlas = ExtResource("6_pxxx5")
region = Rect2(411, 459, 13, 97)
[sub_resource type="AtlasTexture" id="AtlasTexture_mc72l"]
atlas = ExtResource("6_pxxx5")
region = Rect2(432, 460, 13, 96)
[sub_resource type="AtlasTexture" id="AtlasTexture_ac7xn"]
[sub_resource type="AtlasTexture" id="AtlasTexture_mc72l"]
atlas = ExtResource("6_pxxx5")
region = Rect2(453, 459, 13, 97)
@ -431,12 +427,12 @@ anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -82.0
offset_right = 16.0
offset_right = 15.0
grow_vertical = 0
texture_normal = SubResource("AtlasTexture_485b4")
[node name="Book17" type="Node2D" parent="Shelf/Layer0"]
position = Vector2(279, 0)
position = Vector2(278, 0)
[node name="BookButton" type="TextureButton" parent="Shelf/Layer0/Book17"]
clip_contents = true
@ -444,12 +440,12 @@ anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -93.0
offset_right = 15.0
offset_right = 14.0
grow_vertical = 0
texture_normal = SubResource("AtlasTexture_bt0bc")
[node name="Book18" type="Node2D" parent="Shelf/Layer0"]
position = Vector2(296, 0)
position = Vector2(294, 0)
[node name="BookButton" type="TextureButton" parent="Shelf/Layer0/Book18"]
clip_contents = true
@ -654,9 +650,9 @@ texture_normal = SubResource("AtlasTexture_onny4")
[node name="Layer2" type="Control" parent="Shelf"]
layout_mode = 3
anchors_preset = 0
offset_left = -31.0
offset_left = -24.0
offset_top = 115.0
offset_right = -31.0
offset_right = -24.0
offset_bottom = 115.0
scale = Vector2(0.9, 0.9)
@ -719,13 +715,13 @@ clip_contents = true
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -99.0
offset_right = 15.0
offset_top = -97.0
offset_right = 13.0
grow_vertical = 0
texture_normal = SubResource("AtlasTexture_sungh")
[node name="Book5" type="Node2D" parent="Shelf/Layer2"]
position = Vector2(79, 0)
position = Vector2(77, 0)
[node name="BookButton" type="TextureButton" parent="Shelf/Layer2/Book5"]
clip_contents = true
@ -738,35 +734,22 @@ grow_vertical = 0
texture_normal = SubResource("AtlasTexture_yqrs8")
[node name="Book6" type="Node2D" parent="Shelf/Layer2"]
position = Vector2(94, 0)
position = Vector2(92, 0)
[node name="BookButton" type="TextureButton" parent="Shelf/Layer2/Book6"]
clip_contents = true
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -97.0
offset_right = 13.0
grow_vertical = 0
texture_normal = SubResource("AtlasTexture_jrkcq")
[node name="Book7" type="Node2D" parent="Shelf/Layer2"]
position = Vector2(109, 0)
[node name="BookButton" type="TextureButton" parent="Shelf/Layer2/Book7"]
clip_contents = true
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -96.0
offset_right = 13.0
grow_vertical = 0
texture_normal = SubResource("AtlasTexture_mc72l")
texture_normal = SubResource("AtlasTexture_jrkcq")
[node name="Book8" type="Node2D" parent="Shelf/Layer2"]
position = Vector2(124, 0)
[node name="Book7" type="Node2D" parent="Shelf/Layer2"]
position = Vector2(107, 0)
[node name="BookButton" type="TextureButton" parent="Shelf/Layer2/Book8"]
[node name="BookButton" type="TextureButton" parent="Shelf/Layer2/Book7"]
clip_contents = true
anchors_preset = 2
anchor_top = 1.0
@ -774,7 +757,7 @@ anchor_bottom = 1.0
offset_top = -97.0
offset_right = 13.0
grow_vertical = 0
texture_normal = SubResource("AtlasTexture_ac7xn")
texture_normal = SubResource("AtlasTexture_mc72l")
[node name="生死簿" type="AnimatedSprite2D" parent="Shelf"]
visible = false
@ -785,10 +768,14 @@ animation = &"书架倒下"
[node name="Button" type="Button" parent="Shelf/生死簿"]
custom_minimum_size = Vector2(17, 70)
offset_left = -7.77778
offset_top = -79.1209
offset_right = 9.22222
offset_bottom = -29.1209
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = -51.0
offset_top = -228.5
offset_right = -34.0
offset_bottom = -158.5
grow_vertical = 0
focus_mode = 0
flat = true

View File

@ -149,7 +149,7 @@ func _post_success():
func _unhandled_input(event: InputEvent) -> void:
# block all input
get_viewport().set_input_as_handled()
if event.is_action_pressed("cancel"):
if event.is_action_pressed("cancel") or event.is_action_pressed("escape"):
if game_finished:
success.emit()
else: