修复一些联网相关场景切换关系问题
修复重设密码场景回车键自动识别功能条件错误 框架跟进
This commit is contained in:
Submodule Zframework updated: d86dba11ea...b0b5981698
8
main.lua
8
main.lua
@@ -60,11 +60,11 @@ BGM.setMaxSources(5)
|
||||
VOC.setDiversion(.62)
|
||||
|
||||
WIDGET.setOnChange(function()
|
||||
if SCN.cur~='custom_field' then
|
||||
if SCN.stack[#SCN.stack-1]~='custom_field' then
|
||||
local colorList=THEME.getThemeColor()
|
||||
if not colorList then return end
|
||||
local rnd=math.random
|
||||
for _,W in next,SCN.scenes[SCN.cur].widgetList do
|
||||
for _,W in next,SCN.scenes[SCN.stack[#SCN.stack-1]].widgetList do
|
||||
if W.color then
|
||||
W.color=colorList[rnd(#colorList)]
|
||||
end
|
||||
@@ -218,10 +218,10 @@ do-- Z.setOnFocus
|
||||
TASK.new(task_autoSoundOn)
|
||||
end
|
||||
else
|
||||
if SCN.cur=='game' and SETTING.autoPause then
|
||||
if SCN.stack[#SCN.stack-1]=='game' and SETTING.autoPause then
|
||||
pauseGame()
|
||||
end
|
||||
if SETTING.autoMute and SCN.cur~='music' then
|
||||
if SETTING.autoMute and SCN.stack[#SCN.stack-1]~='music' then
|
||||
TASK.removeTask_code(task_autoSoundOn)
|
||||
TASK.new(task_autoSoundOff)
|
||||
end
|
||||
|
||||
@@ -32,10 +32,6 @@ local NET={
|
||||
inputBox=WIDGET.newInputBox{name='input',x=340,y=660,w=600,h=50,limit=256},
|
||||
}
|
||||
|
||||
function NET.connectLost()
|
||||
while SCN.stack[#SCN.stack-1]~='main' and #SCN.stack>0 do SCN.pop() end
|
||||
SCN.back()
|
||||
end
|
||||
function NET.freshRoomAllReady()
|
||||
local playCount,readyCount=0,0
|
||||
for j=1,#NETPLY.list do
|
||||
@@ -166,13 +162,13 @@ function NET.codeLogin(email,code)
|
||||
USER.aToken=res.data.accessToken
|
||||
saveUser()
|
||||
NET.ws_connect()
|
||||
SCN.pop()SCN.go('net_menu')
|
||||
SCN.swapTo('net_menu')
|
||||
elseif res.code==201 then
|
||||
USER.rToken=res.data.refreshToken
|
||||
USER.aToken=res.data.accessToken
|
||||
saveUser()
|
||||
SCN.pop()SCN.push('net_menu')
|
||||
SCN.swapTo('reset_password')
|
||||
SCN.go('reset_password')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -362,7 +358,7 @@ function NET.pwLogin(email,pw)
|
||||
USER.aToken=res.data.accessToken
|
||||
saveUser()
|
||||
NET.ws_connect()
|
||||
SCN.go('net_menu')
|
||||
SCN.swapTo('net_menu')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -435,10 +431,12 @@ end
|
||||
local function _playerLeaveRoom(uid)
|
||||
for i=1,#PLAYERS do if PLAYERS[i].uid==uid then table.remove(PLAYERS,i) break end end
|
||||
for i=1,#PLY_ALIVE do if PLY_ALIVE[i].uid==uid then table.remove(PLY_ALIVE,i) break end end
|
||||
if uid==USER.uid and SCN.cur=='net_game' then
|
||||
SCN.back()
|
||||
else
|
||||
NETPLY.remove(uid)
|
||||
if SCN.stack[#SCN.stack-1]=='net_game' then
|
||||
if uid==USER.uid then
|
||||
SCN.backTo('net_menu')
|
||||
else
|
||||
NETPLY.remove(uid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -577,7 +575,7 @@ function NET.wsCallBack.global_getOnlineCount(body)
|
||||
NET.onlineCount=tonumber(body.data) or "_"
|
||||
end
|
||||
function NET.wsCallBack.room_chat(body)
|
||||
if SCN.cur=='net_game' then
|
||||
if SCN.stack[#SCN.stack-1]=='net_game' then
|
||||
TASK.unlock('receiveMessage')
|
||||
TASK.lock('receiveMessage',1)
|
||||
NET.textBox:push{
|
||||
@@ -723,7 +721,7 @@ function NET.ws_update()
|
||||
TEST.yieldT(1/26)
|
||||
if WS.status('game')=='dead' then
|
||||
TEST.yieldUntilNextScene()
|
||||
NET.connectLost()
|
||||
SCN.backTo('main')
|
||||
return
|
||||
elseif WS.status('game')=='running' then
|
||||
break
|
||||
@@ -741,7 +739,7 @@ function NET.ws_update()
|
||||
USER.uid=res.data
|
||||
else
|
||||
TEST.yieldUntilNextScene()
|
||||
NET.connectLost()
|
||||
SCN.backTo('main')
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -756,7 +754,7 @@ function NET.ws_update()
|
||||
|
||||
if WS.status('game')=='dead' then
|
||||
TEST.yieldUntilNextScene()
|
||||
NET.connectLost()
|
||||
SCN.backTo('main')
|
||||
return
|
||||
end
|
||||
|
||||
@@ -774,7 +772,7 @@ function NET.ws_update()
|
||||
if msg and msg.message then LOG(msg.message) end
|
||||
end
|
||||
TEST.yieldUntilNextScene()
|
||||
NET.connectLost()
|
||||
SCN.backTo('main')
|
||||
return
|
||||
elseif msg then
|
||||
msg=JSON.decode(msg)
|
||||
|
||||
@@ -2192,7 +2192,7 @@ local function task_autoPause()
|
||||
while true do
|
||||
yield()
|
||||
time=time+1
|
||||
if SCN.cur~='game' or PLAYERS[1].frameRun<180 then
|
||||
if SCN.stack[#SCN.stack-1]~='game' or PLAYERS[1].frameRun<180 then
|
||||
return
|
||||
elseif time==120 then
|
||||
pauseGame()
|
||||
|
||||
@@ -127,7 +127,7 @@ function scene.mouseDown()
|
||||
SCN.push('main')
|
||||
SCN.swapTo('lang')
|
||||
else
|
||||
SCN.swapTo(SETTING.simpMode and 'main_simple' or 'main')
|
||||
SCN.go(SETTING.simpMode and 'main_simple' or 'main')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -108,7 +108,7 @@ function scene.keyDown(key,isRep)
|
||||
elseif key=='escape' then
|
||||
if tryBack() then
|
||||
VOC.play('bye')
|
||||
SCN.swapTo('quit','slowFade')
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
return true
|
||||
|
||||
@@ -185,7 +185,7 @@ function scene.update()
|
||||
end
|
||||
end
|
||||
|
||||
local _=SCN.stat.tar
|
||||
local _=SCN.state.tar
|
||||
mapCam.zoomMethod=_=="game" and 1 or _=="mode" and 2
|
||||
if mapCam.zoomMethod==1 then
|
||||
_=mapCam.zoomK
|
||||
|
||||
@@ -5,6 +5,7 @@ function scene.sceneInit()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
NET.ws_close()
|
||||
TASK.removeTask_code(NET.ws_update)
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
@@ -27,7 +28,6 @@ scene.widgetList={
|
||||
USER.__data.rToken=false
|
||||
USER.__data.aToken=false
|
||||
love.filesystem.remove('conf/user')
|
||||
NET.ws_close()
|
||||
SCN.back()
|
||||
end
|
||||
end},
|
||||
|
||||
@@ -20,9 +20,9 @@ function scene.keyDown(key,rep)
|
||||
SCN.back()
|
||||
elseif key=='return' then
|
||||
if #scene.widgetList.code:getText()==0 then
|
||||
_setPW()
|
||||
else
|
||||
NET.getCode(USER.email)
|
||||
else
|
||||
_setPW()
|
||||
end
|
||||
else
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user