From b0342ec8a8b28c0dac2f46c85510b352519a93a1 Mon Sep 17 00:00:00 2001 From: cakipaul Date: Thu, 26 Jun 2025 04:57:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20EditorInterface=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E6=89=93=E5=8C=85=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=20identifier=20"EditorInterface"=20?= =?UTF-8?q?not=20declared?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/audio_manager/vibe_group.gd | 15 --------------- project.godot | 1 + scene/entity/ux/sign_snapper.gd | 6 +++++- scene/ground/ground.tscn | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/manager/audio_manager/vibe_group.gd b/manager/audio_manager/vibe_group.gd index 5638cf4e..88eed41f 100644 --- a/manager/audio_manager/vibe_group.gd +++ b/manager/audio_manager/vibe_group.gd @@ -22,18 +22,3 @@ extends Resource # 你也可以直接在这里新建 Embellishment 资源,实现“特制wav”的需求。 @export var embellishments: Array[Embellishment] - -# func _init() -> void: -# if not Engine.is_editor_hint(): -# return -# var root = EditorInterface.get_edited_scene_root() -# if not root: -# return -# var ground = root.get_node_or_null("Ground") as Ground2D -# if not ground: -# return -# var scene_name = ground.scene_name -# # 检查 group_name 是否以 scene_name 开头 -# if not group_name.begins_with(scene_name): -# group_name = scene_name + "_" + group_name -# print("VibeGroup: Auto-prefixed group_name to %s" % group_name) diff --git a/project.godot b/project.godot index fb93cb8d..2104e06b 100644 --- a/project.godot +++ b/project.godot @@ -111,6 +111,7 @@ folder_colors={ [global_group] balloon="" +ground="" [gui] diff --git a/scene/entity/ux/sign_snapper.gd b/scene/entity/ux/sign_snapper.gd index 99ace52a..99df5bc5 100644 --- a/scene/entity/ux/sign_snapper.gd +++ b/scene/entity/ux/sign_snapper.gd @@ -62,7 +62,11 @@ func _on_interacted(): func _debug_check_player_pos(): if not Engine.is_editor_hint(): return - var ground = EditorInterface.get_edited_scene_root().get_node("Ground") as Ground2D + var grounds = get_tree().get_nodes_in_group("ground") + if not grounds: + printerr("no ground") + return + var ground = grounds[0] if use_x_only: ground.replace_player_to_portal = true var player = ground.player diff --git a/scene/ground/ground.tscn b/scene/ground/ground.tscn index 41d744ad..a840c9e2 100644 --- a/scene/ground/ground.tscn +++ b/scene/ground/ground.tscn @@ -14,7 +14,7 @@ gradient = SubResource("Gradient_p7aaq") width = 15000 height = 500 -[node name="Ground" type="Node2D"] +[node name="Ground" type="Node2D" groups=["ground"]] script = ExtResource("1_0vrlo") [node name="AnimationPlayer" type="AnimationPlayer" parent="."]