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