From 3ffe9fdd982f58af97916c251b1e46e2d5f49dc1 Mon Sep 17 00:00:00 2001 From: cakipaul Date: Fri, 11 Jul 2025 22:25:51 +0800 Subject: [PATCH] =?UTF-8?q?inspector=20lock=20=E6=94=B9=E4=B8=BA=20hold;?= =?UTF-8?q?=20=E6=9F=9C=E5=8F=B0=E6=94=BE=E6=8A=A5=E7=BA=B8=E5=8E=BB?= =?UTF-8?q?=E5=A4=84=E5=89=8D=E5=90=8E=E5=B7=A6/=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E5=90=91=E5=B8=A7=EF=BC=9Bprop=20hud=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E7=82=B9=E5=87=BBselected=20ignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/animation/entity_sprite_frames.tres | 34 +--------------------- scene/entity/interactable.gd | 15 +++++++--- scene/ux/prop_hud.tscn | 1 + scene/ux/prop_inspector.gd | 19 +++++++----- 4 files changed, 24 insertions(+), 45 deletions(-) diff --git a/config/animation/entity_sprite_frames.tres b/config/animation/entity_sprite_frames.tres index 7d5d1e12..aec62f1b 100644 --- a/config/animation/entity_sprite_frames.tres +++ b/config/animation/entity_sprite_frames.tres @@ -1,4 +1,4 @@ -[gd_resource type="SpriteFrames" load_steps=853 format=3 uid="uid://b7fhheih1hbvf"] +[gd_resource type="SpriteFrames" load_steps=845 format=3 uid="uid://b7fhheih1hbvf"] [ext_resource type="Texture2D" uid="uid://dvq64espa37lx" path="res://asset/art/animation/c00_吕萍_idle_left/zhhx1.png" id="1_ekv0l"] [ext_resource type="Texture2D" uid="uid://dcp4gk5lib4bl" path="res://asset/art/animation/c00_吕萍_idle_left/zhhx2.png" id="2_fq076"] @@ -371,16 +371,12 @@ [ext_resource type="Texture2D" uid="uid://ybj4hg6cvh4a" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/20.png" id="183_kirv5"] [ext_resource type="Texture2D" uid="uid://15ij6tgncpfn" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/21.png" id="184_30nqm"] [ext_resource type="Texture2D" uid="uid://cc0eb4ycclo1f" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右5.png" id="184_jrug8"] -[ext_resource type="Texture2D" uid="uid://cp71rayg8ynfr" path="res://asset/art/gif/c01_书店/小蝶拿报纸/0.png" id="184_tsskx"] -[ext_resource type="Texture2D" uid="uid://cjgj5oq5e2qt6" path="res://asset/art/gif/c01_书店/小蝶拿报纸/1.png" id="185_adpbv"] [ext_resource type="Texture2D" uid="uid://bdbx3uylvnn78" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右6.png" id="185_in30h"] [ext_resource type="Texture2D" uid="uid://dtt8xb0gkufps" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/22.png" id="185_ncltk"] [ext_resource type="Texture2D" uid="uid://emtd3r72ewhv" path="res://asset/art/animation/c02_吕萍_看小猫玩具_right/看玩具动作右7.png" id="186_ecyns"] [ext_resource type="Texture2D" uid="uid://lc6luwpq22il" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/23.png" id="186_if2a6"] -[ext_resource type="Texture2D" uid="uid://jk7vua3s68q0" path="res://asset/art/gif/c01_书店/小蝶拿报纸/2.png" id="186_xaqjo"] [ext_resource type="Texture2D" uid="uid://x0xakx6gceq3" path="res://asset/art/animation/c00_过道小猫/过道小猫1.png" id="186_yiibj"] [ext_resource type="Texture2D" uid="uid://lsx7qqkkka0b" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/24.png" id="187_7hrrj"] -[ext_resource type="Texture2D" uid="uid://cwakyp1uwatvc" path="res://asset/art/gif/c01_书店/小蝶拿报纸/3.png" id="187_exmgj"] [ext_resource type="Texture2D" uid="uid://1untb3vqajxc" path="res://asset/art/animation/c00_过道小猫/过道小猫2.png" id="187_qhkmm"] [ext_resource type="Texture2D" uid="uid://b6y8ggopkh8me" path="res://asset/art/gif/c01_书店外街道/小蝶看向橱窗/25.png" id="188_f1lc0"] [ext_resource type="Texture2D" uid="uid://dqdnrlwq5wreh" path="res://asset/art/gif/c01_书店/小蝶拿报纸/4.png" id="188_glo3y"] @@ -430,13 +426,9 @@ [ext_resource type="Texture2D" uid="uid://cxein2tgxbmpd" path="res://asset/art/gif/c01_书店/小蝶拿报纸/22.png" id="206_dlydb"] [ext_resource type="Texture2D" uid="uid://coiloe2kfxt3f" path="res://asset/art/gif/c01_公寓过道/小蝶探头/11.png" id="206_jtaix"] [ext_resource type="Texture2D" uid="uid://q5kqwixoexgc" path="res://asset/art/gif/c01_公寓过道/小蝶探头/12.png" id="207_rf1ax"] -[ext_resource type="Texture2D" uid="uid://cf16ivik5eico" path="res://asset/art/gif/c01_书店/小蝶拿报纸/23.png" id="207_xewty"] [ext_resource type="Texture2D" uid="uid://l1mfvgty8v12" path="res://asset/art/gif/c01_公寓过道/小蝶探头/13.png" id="208_ku7j2"] -[ext_resource type="Texture2D" uid="uid://du6u3l6v6ip88" path="res://asset/art/gif/c01_书店/小蝶拿报纸/24.png" id="208_yjsfv"] [ext_resource type="Texture2D" uid="uid://b5u6lc238aqah" path="res://asset/art/gif/c01_公寓过道/小蝶探头/14.png" id="209_37eje"] -[ext_resource type="Texture2D" uid="uid://clo66qwjl0naq" path="res://asset/art/gif/c01_书店/小蝶拿报纸/25.png" id="209_253oi"] [ext_resource type="Texture2D" uid="uid://m8ecqan6e2qk" path="res://asset/art/gif/c01_公寓过道/小蝶探头/15.png" id="210_ave4u"] -[ext_resource type="Texture2D" uid="uid://cuwflapilvolw" path="res://asset/art/gif/c01_书店/小蝶拿报纸/26.png" id="210_mlkjm"] [ext_resource type="Texture2D" uid="uid://duw51q2gu7cyu" path="res://asset/art/gif/c01_公寓过道/小蝶探头/16.png" id="211_o38qq"] [ext_resource type="Texture2D" uid="uid://bt2wosw7pdhmj" path="res://asset/art/gif/c01_公寓过道/小蝶探头/17.png" id="212_ddhdg"] [ext_resource type="Texture2D" uid="uid://cespji827yo4y" path="res://asset/art/animation/c02_吕萍_蹲下来查看/1.png" id="213_mydup"] @@ -1892,18 +1884,6 @@ animations = [{ }, { "frames": [{ "duration": 1.0, -"texture": ExtResource("184_tsskx") -}, { -"duration": 1.0, -"texture": ExtResource("185_adpbv") -}, { -"duration": 1.0, -"texture": ExtResource("186_xaqjo") -}, { -"duration": 1.0, -"texture": ExtResource("187_exmgj") -}, { -"duration": 1.0, "texture": ExtResource("188_glo3y") }, { "duration": 1.0, @@ -1959,18 +1939,6 @@ animations = [{ }, { "duration": 1.0, "texture": ExtResource("206_dlydb") -}, { -"duration": 1.0, -"texture": ExtResource("207_xewty") -}, { -"duration": 2.0, -"texture": ExtResource("208_yjsfv") -}, { -"duration": 2.0, -"texture": ExtResource("209_253oi") -}, { -"duration": 1.0, -"texture": ExtResource("210_mlkjm") }], "loop": false, "name": &"c01_小小蝶_书店递报纸", diff --git a/scene/entity/interactable.gd b/scene/entity/interactable.gd index 3d055d2b..e205ff60 100644 --- a/scene/entity/interactable.gd +++ b/scene/entity/interactable.gd @@ -139,8 +139,8 @@ var interact_mutex = Mutex.new() func is_key_matched(key) -> bool: return ( - # 第一个 prop_key 若空,则表示不需要匹配 - not prop_key + # prop_key 皆空,则表示不需要匹配 + (not prop_key and not prop_key2 and not prop_key3) or ( # 只要有一个 prop_key 匹配即可 (prop_key and key == prop_key) @@ -150,6 +150,14 @@ func is_key_matched(key) -> bool: ) +func check_if_disable_prop(key) -> void: + # prop_key 若空, 则表示不需要匹配, 也就不需要 disable 当前道具 + if not disable_prop_after_interacted or (not prop_key and not prop_key2 and not prop_key3): + return + if key: + SceneManager.disable_prop_item(key) + + func _pre_interacted() -> void: SceneManager.lock_player(0, action_key) if icount == 0 and first_interact_os_key: @@ -177,8 +185,7 @@ func _on_interacted() -> void: return if not mute_when_interacted: sfx_success.play() - if disable_prop_after_interacted and key: - SceneManager.disable_prop_item(key) + check_if_disable_prop(key) interacted_times += 1 if interacted_texture: texture = interacted_texture diff --git a/scene/ux/prop_hud.tscn b/scene/ux/prop_hud.tscn index 1297cf05..0981842e 100644 --- a/scene/ux/prop_hud.tscn +++ b/scene/ux/prop_hud.tscn @@ -216,6 +216,7 @@ offset_right = 65.0 offset_bottom = 65.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 2 texture = ExtResource("7_53yeo") [node name="RightMargin" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] diff --git a/scene/ux/prop_inspector.gd b/scene/ux/prop_inspector.gd index d211c94b..5a9f00e2 100644 --- a/scene/ux/prop_inspector.gd +++ b/scene/ux/prop_inspector.gd @@ -62,7 +62,7 @@ func _hide(): func _post_hide(): status = STATUS_HIDDEN scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE - locking = false + holding = false origin_texture.texture = null full_texture.texture = null texture_cover = null @@ -96,7 +96,7 @@ func pop_standard_inspection( content_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT if status != STATUS_HIDDEN: _hide() - locking = true + holding = true status = STATUS_INSPECTING_COVER visible = true full_texture.texture = cover_texture @@ -115,14 +115,17 @@ func pop_standard_inspection( _blink_label() -var locking = false: +var _lock_mutex := Mutex.new() +var holding = false: set(val): - if val != locking: - locking = val + _lock_mutex.lock() + if val != holding: + holding = val if val: - SceneManager.lock_player() + SceneManager.hold_player() else: - SceneManager.unlock_player() + SceneManager.unhold_player() + _lock_mutex.unlock() var balloon @@ -140,7 +143,7 @@ func pop_prop_inspection( # STATUS_INSPECTING_PROP 状态下不 hide,跳过重复 lock if status != STATUS_HIDDEN and status != STATUS_INSPECTING_PROP: _hide() - locking = true + holding = true status = STATUS_INSPECTING_PROP visible = true var tween = create_tween()