拉取ws消息更不容易爆炸
This commit is contained in:
@@ -1130,13 +1130,17 @@ do
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
local res=JSON.decode(message)
|
local res=JSON.decode(message)
|
||||||
if VERSION_CODE>=res.lowest then
|
if res then
|
||||||
NET.allow_online=true
|
if VERSION_CODE>=res.lowest then
|
||||||
|
NET.allow_online=true
|
||||||
|
end
|
||||||
|
if VERSION_CODE<res.newestCode then
|
||||||
|
LOG.print(text.oldVersion:gsub("$1",res.newestName),180,COLOR.sky)
|
||||||
|
end
|
||||||
|
LOG.print(res.notice,300,COLOR.sky)
|
||||||
|
else
|
||||||
|
WS.alert("app")
|
||||||
end
|
end
|
||||||
if VERSION_CODE<res.newestCode then
|
|
||||||
LOG.print(text.oldVersion:gsub("$1",res.newestName),180,COLOR.sky)
|
|
||||||
end
|
|
||||||
LOG.print(res.notice,300,COLOR.sky)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif status=="dead"then
|
elseif status=="dead"then
|
||||||
@@ -1165,28 +1169,31 @@ do
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
local res=JSON.decode(message)
|
local res=JSON.decode(message)
|
||||||
if not res then return end
|
if res then
|
||||||
if res.message=="Connected"then
|
if res.message=="Connected"then
|
||||||
NET.login=true
|
NET.login=true
|
||||||
if res.id then
|
if res.id then
|
||||||
USER.id=res.id
|
USER.id=res.id
|
||||||
USER.authToken=res.authToken
|
USER.authToken=res.authToken
|
||||||
NET.getAccessToken()
|
NET.getAccessToken()
|
||||||
end
|
end
|
||||||
FILE.save(USER,"conf/user","q")
|
FILE.save(USER,"conf/user","q")
|
||||||
LOG.print(text.loginSuccessed)
|
LOG.print(text.loginSuccessed)
|
||||||
|
|
||||||
--Get self infos
|
--Get self infos
|
||||||
NET.getSelfInfo()
|
NET.getSelfInfo()
|
||||||
elseif res.action==0 then
|
elseif res.action==0 then
|
||||||
USER.accessToken=res.accessToken
|
USER.accessToken=res.accessToken
|
||||||
LOG.print(text.accessSuccessed)
|
LOG.print(text.accessSuccessed)
|
||||||
NET.wsConnectPlay()
|
NET.wsConnectPlay()
|
||||||
elseif res.action==1 then
|
elseif res.action==1 then
|
||||||
USER.name=res.username
|
USER.name=res.username
|
||||||
USER.motto=res.motto
|
USER.motto=res.motto
|
||||||
USER.avatar=res.avatar
|
USER.avatar=res.avatar
|
||||||
FILE.save(USER,"conf/user")
|
FILE.save(USER,"conf/user")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
WS.alert("user")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1211,7 +1218,11 @@ do
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
local res=JSON.decode(message)
|
local res=JSON.decode(message)
|
||||||
--TODO
|
if res then
|
||||||
|
--TODO
|
||||||
|
else
|
||||||
|
WS.alert("chat")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1235,8 +1246,12 @@ do
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
local res=JSON.decode(message)
|
local res=JSON.decode(message)
|
||||||
if res.message=="Connected"then
|
if res then
|
||||||
SCN.go("net_menu")
|
if res.message=="Connected"then
|
||||||
|
SCN.go("net_menu")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
WS.alert("play")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1260,7 +1275,6 @@ do
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
local res=JSON.decode(message)
|
|
||||||
--TODO
|
--TODO
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user