添加退出登录按钮

This commit is contained in:
MrZ626
2021-04-09 17:33:50 +08:00
parent f7fa8d0758
commit 48ce3a3d8f
8 changed files with 34 additions and 8 deletions

View File

@@ -1,6 +1,9 @@
local lastLogoutTime
local scene={}
function scene.sceneInit()
lastLogoutTime=-1e99
BG.set("space")
end
function scene.sceneBack()
@@ -8,10 +11,25 @@ function scene.sceneBack()
end
scene.widgetList={
-- WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,font=40,code=NULL},
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120,font=40,code=goScene"net_rooms"},
-- WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,font=40,code=goScene"net_chat"},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,color="black",font=40,code=NULL},
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120, font=40,code=goScene"net_rooms"},
WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,color="black",font=40,code=NULL},
WIDGET.newButton{name="logout", x=1140, y=70,w=180,h=70,color="dR",code=function()
if TIME()-lastLogoutTime<1 then
if USER.uid then
NET.wsclose_play()
NET.wsclose_user()
USER.username=false
USER.uid=false
USER.authToken=false
FILE.save(USER,"conf/user","q")
SCN.back()
end
else
lastLogoutTime=TIME()
end
end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=backScene},
}
return scene