整理网络相关全局变量放入NET,删除WSCONN,调整进入联网菜单的逻辑
This commit is contained in:
@@ -77,14 +77,13 @@ function scene.keyDown(key)
|
||||
end
|
||||
elseif key=="a"then
|
||||
if testButton(3)then
|
||||
if not ALLOW_ONLINE then
|
||||
TEXT.show(text.notFinished,640,450,60,"flicker")
|
||||
SFX.play("finesseError")
|
||||
elseif LOGIN then
|
||||
SCN.go("net_menu")
|
||||
WS.send("user",JSON.encode{
|
||||
action=0,
|
||||
})
|
||||
if LOGIN then
|
||||
if not NET.allow_online then
|
||||
TEXT.show(text.needUpdate,640,450,60,"flicker")
|
||||
SFX.play("finesseError")
|
||||
else
|
||||
WS.send("user",JSON.encode{action=0})
|
||||
end
|
||||
else
|
||||
SCN.go("login")
|
||||
end
|
||||
@@ -109,18 +108,18 @@ function scene.keyDown(key)
|
||||
if testButton(8)then
|
||||
SCN.go("manual")
|
||||
end
|
||||
elseif key=="f1"then
|
||||
if testButton(11)then
|
||||
SCN.go("about")
|
||||
end
|
||||
elseif key=="f2"then
|
||||
elseif key=="2"then
|
||||
if testButton(9)then
|
||||
SCN.go("music")
|
||||
end
|
||||
elseif key=="f3"then
|
||||
elseif key=="0"then
|
||||
if testButton(10)then
|
||||
SCN.go("lang")
|
||||
end
|
||||
elseif key=="x"then
|
||||
if testButton(11)then
|
||||
SCN.go("about")
|
||||
end
|
||||
elseif key=="escape"then
|
||||
if testButton(12)then
|
||||
SCN.back()
|
||||
|
||||
@@ -31,7 +31,6 @@ function scene.sceneInit()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
WS.send("chat","Q")
|
||||
WSCONN=false
|
||||
LOG.print(text.wsDisconnected,"warn")
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ local scene={}
|
||||
|
||||
function scene.sceneBack()
|
||||
WS.send("play","Q")
|
||||
WSCONN=false
|
||||
LOG.print(text.wsDisconnected,"warn")
|
||||
love.keyboard.setKeyRepeat(true)
|
||||
end
|
||||
@@ -123,7 +122,6 @@ end
|
||||
function scene.gamepadDown(key)
|
||||
if key=="back"then
|
||||
if TIME()-lastBackTime<1 then
|
||||
WSCONN=false
|
||||
SCN.back()
|
||||
else
|
||||
lastBackTime=TIME()
|
||||
@@ -263,7 +261,7 @@ function scene.update(dt)
|
||||
local _
|
||||
local GAME=GAME
|
||||
|
||||
if not WSCONN and not SCN.swapping then SCN.back()end
|
||||
if WS.status("play")~="running"and not SCN.swapping then SCN.back()end
|
||||
if not playing then
|
||||
heartBeatTimer=heartBeatTimer+dt
|
||||
if heartBeatTimer>42 then
|
||||
|
||||
Reference in New Issue
Block a user