forked from datawhale/whale-town-front
合并主场景和个人小屋
This commit is contained in:
@@ -102,7 +102,7 @@ func _validate_texture():
|
||||
return false
|
||||
|
||||
# ============================================================================
|
||||
# 调试方法
|
||||
# 信息方法
|
||||
# ============================================================================
|
||||
|
||||
# 获取瓦片信息
|
||||
@@ -113,10 +113,3 @@ func get_tile_info() -> Dictionary:
|
||||
"texture_size": texture.get_size() if texture else Vector2.ZERO,
|
||||
"auto_snap": auto_snap
|
||||
}
|
||||
|
||||
# 打印瓦片信息
|
||||
func print_info():
|
||||
var info = get_tile_info()
|
||||
print("=== 草地瓦片信息 ===")
|
||||
for key in info:
|
||||
print(key, ": ", info[key])
|
||||
11
scenes/prefabs/items/NoticeBoard.gd
Normal file
11
scenes/prefabs/items/NoticeBoard.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends StaticBody2D
|
||||
|
||||
func interact():
|
||||
# Check if dialog already exists
|
||||
if get_tree().root.has_node("NoticeDialog"):
|
||||
return
|
||||
|
||||
var dialog = preload("res://scenes/ui/notice_dialog.tscn").instantiate()
|
||||
dialog.name = "NoticeDialog"
|
||||
get_tree().root.add_child(dialog)
|
||||
return null # No bubble text needed
|
||||
1
scenes/prefabs/items/NoticeBoard.gd.uid
Normal file
1
scenes/prefabs/items/NoticeBoard.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://pnlgf420wktn
|
||||
13
scenes/prefabs/items/WelcomeBoard.gd
Normal file
13
scenes/prefabs/items/WelcomeBoard.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends StaticBody2D
|
||||
|
||||
func interact():
|
||||
# Prevent multiple dialogs
|
||||
if get_tree().root.has_node("WelcomeDialog"):
|
||||
return null
|
||||
|
||||
# Spawn the Welcome Dialog
|
||||
var dialog = preload("res://scenes/ui/welcome_dialog.tscn").instantiate()
|
||||
dialog.name = "WelcomeDialog"
|
||||
# Add to the Scene Root (World) or CanvasLayer if it has one
|
||||
get_tree().root.add_child(dialog)
|
||||
return null # Return null prevents Player from showing a bubble
|
||||
1
scenes/prefabs/items/WelcomeBoard.gd.uid
Normal file
1
scenes/prefabs/items/WelcomeBoard.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d2od22agputjt
|
||||
20
scenes/prefabs/items/notice_board.tscn
Normal file
20
scenes/prefabs/items/notice_board.tscn
Normal file
@@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://rdmrm7j4iokr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://pnlgf420wktn" path="res://scenes/prefabs/items/NoticeBoard.gd" id="1_script"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4aildrnhbpl4" path="res://assets/materials/NoticeBoard.png" id="2_sprite"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nb"]
|
||||
size = Vector2(160, 53.333332)
|
||||
|
||||
[node name="NoticeBoard" type="StaticBody2D"]
|
||||
scale = Vector2(0.6, 0.6)
|
||||
script = ExtResource("1_script")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -16)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("2_sprite")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 13.333335)
|
||||
shape = SubResource("RectangleShape2D_nb")
|
||||
19
scenes/prefabs/items/welcome_board.tscn
Normal file
19
scenes/prefabs/items/welcome_board.tscn
Normal file
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c7k8yay002w4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d2od22agputjt" path="res://scenes/prefabs/items/WelcomeBoard.gd" id="1_script"]
|
||||
[ext_resource type="Texture2D" uid="uid://v7loa3smfkrd" path="res://assets/materials/WelcomeBoard.png" id="2_sprite"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_board"]
|
||||
size = Vector2(112, 26.5)
|
||||
|
||||
[node name="WelcomeBoard" type="StaticBody2D"]
|
||||
collision_layer = 3
|
||||
script = ExtResource("1_script")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(0.25, 0.25)
|
||||
texture = ExtResource("2_sprite")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 18.75)
|
||||
shape = SubResource("RectangleShape2D_board")
|
||||
@@ -209,11 +209,3 @@ func _format_timestamp(timestamp: float) -> String:
|
||||
|
||||
# 格式化为 HH:MM
|
||||
return "%02d:%02d" % [datetime.hour, datetime.minute]
|
||||
|
||||
# 获取所有子节点名称(调试用)
|
||||
func _get_all_children_names(node: Node, _indent: int = 0) -> String:
|
||||
var result := ""
|
||||
for child in node.get_children():
|
||||
result += " ".repeat(_indent) + child.name + "\n"
|
||||
result += _get_all_children_names(child, _indent + 1)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user