全局变量LATEST_VERSION改为ALLOW_ONLINE,ws-app能接收版本信息

This commit is contained in:
MrZ626
2021-03-27 22:16:38 +08:00
parent 783defbbed
commit 86a696ad15
3 changed files with 9 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ DAILYLAUNCH=false
LOGIN=false
EDITING=""
WSCONN=false
LATEST_VERSION=false
ALLOW_ONLINE=false
ERRDATA={}
--System setting

View File

@@ -1223,20 +1223,22 @@ do
if message then
if op=="ping"then
WS.send("app",message,"pong")
--TODO: ping animation
--TODO: what to do with res?
elseif op=="close"then
LOG.print(text.wsClose..message,"warn")
return
else
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
elseif status=="dead"then
for _=1,60 do YIELD()end
WS.connect("app","/app",JSON.encode{
version=VERSION_CODE,
})
WS.connect("app","/app")
end
end
end
@@ -1249,8 +1251,6 @@ do
if message then
if op=="ping"then
WS.send("chat",message,"pong")
--TODO: ping animation
--TODO: what to do with res?
elseif op=="close"then
LOG.print(text.wsClose..message,"warn")
return

View File

@@ -77,7 +77,7 @@ function scene.keyDown(key)
end
elseif key=="a"then
if testButton(3)then
if not LATEST_VERSION then
if not ALLOW_ONLINE then
TEXT.show(text.notFinished,640,450,60,"flicker")
SFX.play("finesseError")
elseif LOGIN then