feat: 增加player从广场到房间互相跳转的动作逻辑

This commit is contained in:
2026-01-10 00:44:01 +08:00
parent 4bfe49d5b1
commit 6a3823ad16
7 changed files with 98 additions and 16 deletions

View File

@@ -36,6 +36,7 @@ signal scene_change_started(scene_name: String)
# 场景状态
var current_scene_name: String = "" # 当前场景名称
var is_changing_scene: bool = false # 是否正在切换场景
var _next_scene_position: Variant = null # 下一个场景的初始位置 (Vector2 or null)
# 场景路径映射表
# 将场景名称映射到实际的文件路径
@@ -47,7 +48,9 @@ var scene_paths: Dictionary = {
"battle": "res://scenes/maps/battle_scene.tscn", # 战斗场景 - 战斗系统
"inventory": "res://scenes/ui/InventoryWindow.tscn", # 背包界面
"shop": "res://scenes/ui/ShopWindow.tscn", # 商店界面
"settings": "res://scenes/ui/SettingsWindow.tscn" # 设置界面
"settings": "res://scenes/ui/SettingsWindow.tscn", # 设置界面
"room": "res://scenes/Maps/room.tscn", # 房间场景
"square": "res://scenes/Maps/square.tscn" # 广场场景
}
# ============ 生命周期方法 ============
@@ -134,6 +137,17 @@ func change_scene(scene_name: String, use_transition: bool = true):
func get_current_scene_name() -> String:
return current_scene_name
# 设置下一个场景的初始位置
func set_next_scene_position(pos: Vector2) -> void:
_next_scene_position = pos
# 获取并清除下一个场景的初始位置
func get_next_scene_position() -> Variant:
var pos = _next_scene_position
_next_scene_position = null
return pos
# ============ 场景注册方法 ============
# 注册新场景