【不能用】继续改联网,能登录了
框架跟进
This commit is contained in:
@@ -895,39 +895,26 @@ local commands={}do
|
||||
"Example: switchhost 127.0.0.1 26000 /sock",
|
||||
},
|
||||
}
|
||||
function commands.manage()
|
||||
if WS.status('manage')=='running'then
|
||||
WS.close('manage')
|
||||
log{C.Y,"Disconnected"}
|
||||
else
|
||||
if({[1]=0,[2]=0,[26]=0})[USER.uid]then
|
||||
NET.wsconn_manage()
|
||||
log{C.Y,"Connecting"}
|
||||
else
|
||||
log{C.R,"Permission denied"}
|
||||
end
|
||||
end
|
||||
end
|
||||
function commands.m_broadcast(str)
|
||||
if #str>0 then
|
||||
WS.send('manage','{"action":0,"data":'..JSON.encode{message=str}..'}')
|
||||
WS.send('game',JSON.encode{action=0,data={message=str}})
|
||||
log{C.Y,"Request sent"}
|
||||
else
|
||||
log{C.R,"Format error"}
|
||||
end
|
||||
end
|
||||
function commands.m_shutdown(sec)
|
||||
sec=tonumber(sec)
|
||||
if sec and sec>0 and sec~=math.floor(sec) then
|
||||
WS.send('manage','{"action":9,"data":'..JSON.encode{countdown=tonumber(sec)}..'}')
|
||||
function commands.m_shutdown(time)
|
||||
time=tonumber(time)
|
||||
if time and time>1 then
|
||||
WS.send('game',JSON.encode{action=0,data={countdown=time}})
|
||||
log{C.Y,"Request sent"}
|
||||
else
|
||||
log{C.R,"Format error"}
|
||||
end
|
||||
end
|
||||
function commands.m_connInfo()WS.send('manage','{"action":10}')end
|
||||
function commands.m_playMgrInfo()WS.send('manage','{"action":11}')end
|
||||
function commands.m_streamMgrInfo()WS.send('manage','{"action":12}')end
|
||||
function commands.m_connInfo()WS.send('game',JSON.encode{action=10})end
|
||||
function commands.m_playMgrInfo()WS.send('game',JSON.encode{action=11})end
|
||||
function commands.m_streamMgrInfo()WS.send('game',JSON.encode{action=12})end
|
||||
|
||||
for cmd,body in next,commands do
|
||||
if type(body)=='function'then
|
||||
|
||||
@@ -10,7 +10,6 @@ local function _login()
|
||||
elseif #password==0 then
|
||||
MES.new('error',text.noPassword)return
|
||||
end
|
||||
-- password=STRING.digezt(password)
|
||||
NET.pwLogin(email,password)
|
||||
end
|
||||
|
||||
@@ -23,13 +22,18 @@ function scene.sceneInit()
|
||||
passwordBox:setText(USER.password)
|
||||
end
|
||||
|
||||
function scene.keyDown(key,rep)
|
||||
if key~='return' or rep then return true end
|
||||
_login()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name='register', x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('register','swipeR')end},
|
||||
emailBox,
|
||||
passwordBox,
|
||||
WIDGET.newSwitch{name='showEmail',x=550, y=420,disp=function()return showEmail end,code=function()showEmail=not showEmail emailBox.secret=not showEmail end},
|
||||
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=_login},
|
||||
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=pressKey'return'},
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ end
|
||||
|
||||
function scene.update(dt)
|
||||
if NET.checkPlayDisconn()then
|
||||
NET.wsclose_stream()
|
||||
NET.wsclose()
|
||||
SCN.back()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ function scene.sceneInit()
|
||||
BG.set()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
NET.wsclose_play()
|
||||
NET.wsclose()
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
@@ -21,11 +21,9 @@ scene.widgetList={
|
||||
code=function()
|
||||
if tryBack()then
|
||||
if USER.uid then
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_user()
|
||||
NET.wsclose()
|
||||
USER.uid=false
|
||||
USER.authToken=false
|
||||
saveFile(USER,'conf/user')
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,16 +34,16 @@ local function _setPW()
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
state=1
|
||||
state=SCN.args[1] or 1
|
||||
scene.fileDropped(state)
|
||||
end
|
||||
|
||||
function scene.keyDown(key,rep)
|
||||
if key=='escape' and not rep then
|
||||
if state==1 then
|
||||
SCN.back()
|
||||
else
|
||||
if state==2 then
|
||||
scene.fileDropped(state-1)
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif key=='return' then
|
||||
if state==1 then
|
||||
@@ -68,6 +68,14 @@ function scene.fileDropped(arg)-- Not designed for this, but it works and no sid
|
||||
scene.widgetList.password. hide=arg~=3
|
||||
scene.widgetList.password2. hide=arg~=3
|
||||
scene.widgetList.setPW. hide=arg~=3
|
||||
if arg==1 then
|
||||
scene.widgetList.email:setText(USER.email or "")
|
||||
elseif arg==2 then
|
||||
scene.widgetList.code:clear()
|
||||
elseif arg==3 then
|
||||
scene.widgetList.password:clear()
|
||||
scene.widgetList.password2:clear()
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
|
||||
Reference in New Issue
Block a user