继续完善联网,调整玩家数据初始化过程

This commit is contained in:
MrZ626
2021-04-05 23:31:39 +08:00
parent d4a29db051
commit e9fd74ef5d
3 changed files with 32 additions and 8 deletions

View File

@@ -97,7 +97,7 @@ function NET.storeUserInfo(res)
--Get own name
if res.id==USER.id then
USER.name=res.name
USER.name=res.username
FILE.save(USER,"conf/user")
end
@@ -293,6 +293,15 @@ function NET.updateWS_play()
elseif res.action==2 then--Player join
if res.type=="Self"then
--Create room
TABLE.clear(PLY_NET)
local d=res.data
table.insert(PLY_NET,{
conf=dumpBasicConfig(),
username=USER.name,
uid=USER.id,
sid=d.sid,
ready=d.ready,
})
loadGame("netBattle",true,true)
_unlock("enterRoom")
else