全局变量LATEST_VERSION改为ALLOW_ONLINE,ws-app能接收版本信息
This commit is contained in:
2
main.lua
2
main.lua
@@ -26,7 +26,7 @@ DAILYLAUNCH=false
|
|||||||
LOGIN=false
|
LOGIN=false
|
||||||
EDITING=""
|
EDITING=""
|
||||||
WSCONN=false
|
WSCONN=false
|
||||||
LATEST_VERSION=false
|
ALLOW_ONLINE=false
|
||||||
ERRDATA={}
|
ERRDATA={}
|
||||||
|
|
||||||
--System setting
|
--System setting
|
||||||
|
|||||||
@@ -1223,20 +1223,22 @@ do
|
|||||||
if message then
|
if message then
|
||||||
if op=="ping"then
|
if op=="ping"then
|
||||||
WS.send("app",message,"pong")
|
WS.send("app",message,"pong")
|
||||||
--TODO: ping animation
|
|
||||||
--TODO: what to do with res?
|
|
||||||
elseif op=="close"then
|
elseif op=="close"then
|
||||||
LOG.print(text.wsClose..message,"warn")
|
LOG.print(text.wsClose..message,"warn")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
message=JSON.decode(message)
|
message=JSON.decode(message)
|
||||||
|
if VERSION_CODE>=message.lowest then
|
||||||
|
ALLOW_ONLINE=true
|
||||||
|
end
|
||||||
|
if VERSION_CODE<message.newestCode then
|
||||||
|
LOG.print(text.oldVersion:gsub("$1",message.newestName),180,COLOR.sky)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif status=="dead"then
|
elseif status=="dead"then
|
||||||
for _=1,60 do YIELD()end
|
for _=1,60 do YIELD()end
|
||||||
WS.connect("app","/app",JSON.encode{
|
WS.connect("app","/app")
|
||||||
version=VERSION_CODE,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1249,8 +1251,6 @@ do
|
|||||||
if message then
|
if message then
|
||||||
if op=="ping"then
|
if op=="ping"then
|
||||||
WS.send("chat",message,"pong")
|
WS.send("chat",message,"pong")
|
||||||
--TODO: ping animation
|
|
||||||
--TODO: what to do with res?
|
|
||||||
elseif op=="close"then
|
elseif op=="close"then
|
||||||
LOG.print(text.wsClose..message,"warn")
|
LOG.print(text.wsClose..message,"warn")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function scene.keyDown(key)
|
|||||||
end
|
end
|
||||||
elseif key=="a"then
|
elseif key=="a"then
|
||||||
if testButton(3)then
|
if testButton(3)then
|
||||||
if not LATEST_VERSION then
|
if not ALLOW_ONLINE then
|
||||||
TEXT.show(text.notFinished,640,450,60,"flicker")
|
TEXT.show(text.notFinished,640,450,60,"flicker")
|
||||||
SFX.play("finesseError")
|
SFX.play("finesseError")
|
||||||
elseif LOGIN then
|
elseif LOGIN then
|
||||||
|
|||||||
Reference in New Issue
Block a user