1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

fix(多人游戏): 修复玩家实体与UI状态同步问题

修复多人游戏中玩家实体与UI状态不同步的问题,现在当玩家名称匹配时会自动设置UIState.player
移除单机游戏中重复设置UIState.player的代码
为WorldManager添加对象解析功能以支持多人游戏中的对象传输
This commit is contained in:
2025-11-15 07:33:06 +08:00
parent 427ca484d1
commit d8fafcf52a
4 changed files with 24 additions and 11 deletions
+5 -1
View File
@@ -12,6 +12,7 @@ func _ready():
rootNode = self
spawner = $%spawner
ComponentManager.init()
spawner.spawn_function = justReturn
func _physics_process(delta):
runningTime += delta * 1000
if EntityBase.mobCount() == 0 and runningTime > 1000:
@@ -29,9 +30,12 @@ func spawnWave():
func spawn(node: Node):
if MultiplayerState.isMultiplayer:
if multiplayer.is_server():
spawner.spawn(node)
spawner.spawn([node])
else:
add_child(node)
func justReturn(data):
print(ArrayTool.parseEncodedObject(data))
return ArrayTool.parseEncodedObject(data)[0]
static func getTime():
return runningTime