Merge branch 'ws_test' into main

This commit is contained in:
MrZ626
2021-03-28 02:18:58 +08:00
7 changed files with 174 additions and 177 deletions

View File

@@ -176,12 +176,18 @@ local loadingThread=coroutine.create(function()
end
STAT.run=STAT.run+1
LOADED=true
--[[TODO
WS.send("user",JSON.encode{
--Connect to server
TASK.new(TICK_WS_app)
TASK.new(TICK_WS_user)
WS.connect("app","/app")
if USER.authToken then
WS.connect("user","/user",JSON.encode{
id=USER.id,
authToken=USER.authToken,
})
]]
end
while true do
if math.random()<.126 then
upFloor()

View File

@@ -6,20 +6,19 @@ local function login()
elseif #password==0 then
LOG.print(text.noPassword)return
end
--[[TODO
WS.send("user",JSON.encode{
email=email,
password=password,
})
]]
USER.email=email
WS.connect("user","/user",JSON.encode{
email=email,
password=password,
})
end
local scene={}
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="green",code=function()SCN.swapTo("register","swipeR")end},
WIDGET.newInputBox{name="email", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z@._-]"},
-- WIDGET.newButton{name="register",x=1140, y=100,w=170,h=80,color="green",code=function()SCN.swapTo("register","swipeR")end},
WIDGET.newInputBox{name="email", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z@._-]"},
WIDGET.newInputBox{name="password", x=380, y=300,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=login},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},

View File

@@ -77,25 +77,14 @@ function scene.keyDown(key)
end
elseif key=="a"then
if testButton(3)then
if not LATEST_VERSION then
if not ALLOW_ONLINE then
TEXT.show(text.notFinished,640,450,60,"flicker")
SFX.play("finesseError")
elseif LOGIN then
--[[TODO
if USER.accessToken then
WS.send("app",JSON.encode{
opration="access",
email=USER.email,
accessToken=USER.accessToken,
})
else
WS.send("app",JSON.encode{
opration="access",
email=USER.email,
authToken=USER.authToken,
})
end
]]
SCN.go("net_menu")
WS.send("user",JSON.encode{
action=0,
})
else
SCN.go("login")
end