feat: polish personal space editor

This commit is contained in:
ANG-Server
2026-07-22 13:41:28 +08:00
parent e3accf6b71
commit d60444d2eb
10 changed files with 858 additions and 42 deletions

View File

@@ -39,6 +39,7 @@ var is_changing_scene: bool = false # 是否正在切换场景
var _next_scene_position: Variant = null # 下一个场景的初始位置 (Vector2 or null)
var _next_spawn_name: String = "" # 下一个场景的出生点名称 (String)
var _next_destination_id: String = "" # 快速传送目标,用于发现登记
var _room_visit_context: Dictionary = {} # 访客房间的房主与返回位置
# 场景路径映射表
# 将场景名称映射到实际的文件路径
@@ -203,6 +204,39 @@ func get_next_destination_id() -> String:
_next_destination_id = ""
return destination_id
# ============ 访客房间上下文 ============
func begin_room_visit(owner_user_id: String, owner_nickname: String, return_scene: String, return_position: Vector2) -> void:
_room_visit_context = {
"owner_user_id": owner_user_id.strip_edges(),
"owner_nickname": owner_nickname.strip_edges(),
"return_scene": return_scene.strip_edges(),
"return_position": return_position,
}
func get_room_visit_context() -> Dictionary:
return _room_visit_context.duplicate(true)
func has_room_visit_context() -> bool:
return not str(_room_visit_context.get("owner_user_id", "")).strip_edges().is_empty()
func clear_room_visit_context() -> void:
_room_visit_context.clear()
func return_from_room_visit() -> bool:
if not has_room_visit_context():
return false
var context: Dictionary = _room_visit_context.duplicate(true)
clear_room_visit_context()
var return_scene: String = str(context.get("return_scene", "square")).strip_edges()
if not scene_paths.has(return_scene):
return_scene = "square"
var return_position: Variant = context.get("return_position", null)
if return_position is Vector2:
set_next_scene_position(return_position as Vector2)
change_scene(return_scene)
return true
# ============ 场景注册方法 ============
# 注册新场景