注册(登录)界面+功能初步完成
This commit is contained in:
@@ -66,6 +66,12 @@ local langList={
|
|||||||
getVersionFail="检测新版本失败",
|
getVersionFail="检测新版本失败",
|
||||||
versionIsNew="游戏已是最新版本",
|
versionIsNew="游戏已是最新版本",
|
||||||
versionIsOld="最新版本$1可以下载了!",
|
versionIsOld="最新版本$1可以下载了!",
|
||||||
|
registerSuccessed="注册成功!",
|
||||||
|
registerFailed="注册失败",
|
||||||
|
netErrorCode="网络错误码",
|
||||||
|
noUsername="请填写用户名",
|
||||||
|
noPassword="请填写密码",
|
||||||
|
diffPassword="两次密码不一致",
|
||||||
errorMsg="Techmino遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",
|
errorMsg="Techmino遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",
|
||||||
|
|
||||||
acts={
|
acts={
|
||||||
@@ -461,8 +467,10 @@ local langList={
|
|||||||
login={
|
login={
|
||||||
title="登录/注册",
|
title="登录/注册",
|
||||||
username="用户名",
|
username="用户名",
|
||||||
|
email="邮箱",
|
||||||
password="密码",
|
password="密码",
|
||||||
password2="确认密码",
|
password2="确认密码",
|
||||||
|
back="返回",
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="账户",
|
title="账户",
|
||||||
@@ -657,6 +665,12 @@ local langList={
|
|||||||
getVersionFail="检测新版本失败",
|
getVersionFail="检测新版本失败",
|
||||||
versionIsNew="游戏已是最新版本",
|
versionIsNew="游戏已是最新版本",
|
||||||
versionIsOld="最新版本$1可以下载了!",
|
versionIsOld="最新版本$1可以下载了!",
|
||||||
|
registerSuccessed="注册成功!",
|
||||||
|
registerFailed="注册失败",
|
||||||
|
netErrorCode="网络错误码",
|
||||||
|
noUsername="请填写用户名",
|
||||||
|
noPassword="请填写密码",
|
||||||
|
diffPassword="两次密码不一致",
|
||||||
errorMsg="Techmino遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",
|
errorMsg="Techmino遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",
|
||||||
|
|
||||||
acts={
|
acts={
|
||||||
@@ -1054,8 +1068,10 @@ local langList={
|
|||||||
login={
|
login={
|
||||||
title="登录/注册",
|
title="登录/注册",
|
||||||
username="用户名",
|
username="用户名",
|
||||||
|
email="邮箱",
|
||||||
password="密码",
|
password="密码",
|
||||||
password2="确认密码",
|
password2="确认密码",
|
||||||
|
back="返回",
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="账户",
|
title="账户",
|
||||||
@@ -1250,6 +1266,12 @@ local langList={
|
|||||||
getVersionFail="get newest version failed",
|
getVersionFail="get newest version failed",
|
||||||
versionIsNew="You are now on the latest version.",
|
versionIsNew="You are now on the latest version.",
|
||||||
versionIsOld="Version $1 is available now!",
|
versionIsOld="Version $1 is available now!",
|
||||||
|
registerSuccessed="Register successed!",
|
||||||
|
registerFailed="Register failed",
|
||||||
|
netErrorCode="Network error code",
|
||||||
|
noUsername="Input username",
|
||||||
|
noPassword="Input password",
|
||||||
|
diffPassword="Password don't match",
|
||||||
errorMsg="An error has occurred and Techmino needs to restart.\nError info has been created, and you can send it to the author.",
|
errorMsg="An error has occurred and Techmino needs to restart.\nError info has been created, and you can send it to the author.",
|
||||||
|
|
||||||
acts={
|
acts={
|
||||||
@@ -1637,8 +1659,10 @@ local langList={
|
|||||||
login={
|
login={
|
||||||
title="Log in / Sign up",
|
title="Log in / Sign up",
|
||||||
username="Username",
|
username="Username",
|
||||||
|
email="E-mail",
|
||||||
password="Password",
|
password="Password",
|
||||||
password2="Again Password",
|
password2="Again Password",
|
||||||
|
back="Back",
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Account",
|
title="Account",
|
||||||
@@ -1836,12 +1860,17 @@ local langList={
|
|||||||
noScore="?_____?",
|
noScore="?_____?",
|
||||||
highScore="__&:",
|
highScore="__&:",
|
||||||
newRecord="^!!!^",
|
newRecord="^!!!^",
|
||||||
getNoticeFail="ge7 no7!ce f@i1ed",
|
getNoticeFail="get notice failed",
|
||||||
getVersionFail="ge7 newe5t ver5i0n f@i1ed",
|
getVersionFail="get newest version failed",
|
||||||
versionIsNew="Y0u @re now 0n the l@7e57 ver5ion.",
|
versionIsNew="You are now on the latest version.",
|
||||||
versionIsOld="Versi0n $1 is @v@i1able n0w!",
|
versionIsOld="Version $1 is available now!",
|
||||||
|
registerSuccessed="Register successed!",
|
||||||
|
registerFailed="Register failed",
|
||||||
|
netErrorCode="Network error code",
|
||||||
|
noUsername="Input username",
|
||||||
|
noPassword="Input password",
|
||||||
|
diffPassword="Password don't match",
|
||||||
errorMsg="An e??o? h@s occ^__ed @nd Techmino n__ds to r_st@rt.\n&**o* in#o h@$ b==n cre@ted, @nd y0u c@n $&nd it to the @uth0r.",
|
errorMsg="An e??o? h@s occ^__ed @nd Techmino n__ds to r_st@rt.\n&**o* in#o h@$ b==n cre@ted, @nd y0u c@n $&nd it to the @uth0r.",
|
||||||
|
|
||||||
acts={
|
acts={
|
||||||
"←:","→:",
|
"←:","→:",
|
||||||
"R→:","←R:","R↑↓:",
|
"R→:","←R:","R↑↓:",
|
||||||
@@ -2234,8 +2263,10 @@ local langList={
|
|||||||
login={
|
login={
|
||||||
title="Log in / Sign up",
|
title="Log in / Sign up",
|
||||||
username="@",
|
username="@",
|
||||||
|
email="E-mail",
|
||||||
password="*",
|
password="*",
|
||||||
password2="*",
|
password2="*",
|
||||||
|
back="X",
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="@_@",
|
title="@_@",
|
||||||
@@ -2425,9 +2456,15 @@ local langList={
|
|||||||
highScore="最佳成绩",
|
highScore="最佳成绩",
|
||||||
newRecord="打破纪录",
|
newRecord="打破纪录",
|
||||||
getNoticeFail="拉取公告失败",
|
getNoticeFail="拉取公告失败",
|
||||||
getVersionFail="拉取公告失败",
|
getVersionFail="检测新版本失败",
|
||||||
versionIsNew="游戏已是最新版本",
|
versionIsNew="游戏已是最新版本",
|
||||||
versionIsOld="最新版本$1可以下载了!",
|
versionIsOld="最新版本$1可以下载了!",
|
||||||
|
registerSuccessed="注册成功!",
|
||||||
|
registerFailed="注册失败",
|
||||||
|
netErrorCode="网络错误码",
|
||||||
|
noUsername="账号密码都填不来?",
|
||||||
|
noPassword="账号密码都填不来?",
|
||||||
|
diffPassword="账号密码都填不来?",
|
||||||
errorMsg="Techmino遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",
|
errorMsg="Techmino遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",
|
||||||
|
|
||||||
acts={
|
acts={
|
||||||
@@ -2824,8 +2861,10 @@ local langList={
|
|||||||
login={
|
login={
|
||||||
title="登录/注册",
|
title="登录/注册",
|
||||||
username="用户名",
|
username="用户名",
|
||||||
|
email="邮箱",
|
||||||
password="密码",
|
password="密码",
|
||||||
password2="你觉得应该填啥",
|
password2="你觉得应该填啥",
|
||||||
|
back="返回",
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="账户",
|
title="账户",
|
||||||
|
|||||||
@@ -668,8 +668,10 @@ local Widgets={
|
|||||||
login={
|
login={
|
||||||
newText({name="title", x=80,y=50,font=70,align="L"}),
|
newText({name="title", x=80,y=50,font=70,align="L"}),
|
||||||
newTextBox({name="username",x=400,y=200,w=500,h=60}),
|
newTextBox({name="username",x=400,y=200,w=500,h=60}),
|
||||||
newTextBox({name="password",x=400,y=300,w=626,h=60,secret=true}),
|
newTextBox({name="email", x=400,y=300,w=626,h=60}),
|
||||||
newTextBox({name="password2",x=400,y=400,w=626,h=60,secret=true}),
|
newTextBox({name="password",x=400,y=400,w=626,h=60,secret=true,regex="[ -~]"}),
|
||||||
|
newTextBox({name="password2",x=400,y=500,w=626,h=60,secret=true,regex="[ -~]"}),
|
||||||
|
newButton({name="back", x=1140, y=640,w=170,h=80,font=40,code=BACK}),
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
newText({name="title", x=80,y=50,font=70,align="L"}),
|
newText({name="title", x=80,y=50,font=70,align="L"}),
|
||||||
@@ -750,4 +752,16 @@ local Widgets={
|
|||||||
newButton({name="back", x=640,y=620,w=200,h=80,font=40,code=BACK}),
|
newButton({name="back", x=640,y=620,w=200,h=80,font=40,code=BACK}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
local META={
|
||||||
|
__index=function(L,k)
|
||||||
|
for i=1,#L do
|
||||||
|
if L[i].name==k then
|
||||||
|
return L[i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
for _,v in next,Widgets do
|
||||||
|
setmetatable(v,META)
|
||||||
|
end
|
||||||
return Widgets
|
return Widgets
|
||||||
2
main.lua
2
main.lua
@@ -207,7 +207,7 @@ do
|
|||||||
if S.version~=gameVersion then
|
if S.version~=gameVersion then
|
||||||
S.version=gameVersion
|
S.version=gameVersion
|
||||||
newVersionLaunch=true
|
newVersionLaunch=true
|
||||||
if S.finesseRate<.3*S.piece then
|
if S.finesseRate<.5*S.piece then
|
||||||
S.finesseRate=10*S.finesseRate
|
S.finesseRate=10*S.finesseRate
|
||||||
end
|
end
|
||||||
FILE.saveData()
|
FILE.saveData()
|
||||||
|
|||||||
@@ -2767,6 +2767,38 @@ do--stat
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
do--login
|
do--login
|
||||||
|
function keyDown.login(key)
|
||||||
|
if key=="return"then
|
||||||
|
LOG.print("敬请期待!")
|
||||||
|
LOG.print("Coming Soon!")
|
||||||
|
-- local user= WIDGET.active.username.value
|
||||||
|
-- local email=WIDGET.active.email.value
|
||||||
|
-- local pw= WIDGET.active.password.value
|
||||||
|
-- local pw2= WIDGET.active.password2.value
|
||||||
|
-- if #user==0 then
|
||||||
|
-- LOG.print(text.noUsername)return
|
||||||
|
-- elseif #pw==0 or #pw2==0 then
|
||||||
|
-- LOG.print(text.noPassword)return
|
||||||
|
-- elseif pw~=pw2 then
|
||||||
|
-- LOG.print(text.diffPassword)return
|
||||||
|
-- end
|
||||||
|
-- httpRequest(
|
||||||
|
-- TICK.httpREQ_register,
|
||||||
|
-- "api/register",
|
||||||
|
-- "POST",
|
||||||
|
-- {["Content-Type"]="application/json"},
|
||||||
|
-- json.encode({
|
||||||
|
-- user=user,
|
||||||
|
-- email=email,
|
||||||
|
-- password=pw,
|
||||||
|
-- })
|
||||||
|
-- )
|
||||||
|
elseif key=="escape"then
|
||||||
|
SCN.back()
|
||||||
|
else
|
||||||
|
WIDGET.keyPressed(key)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
do--account
|
do--account
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -86,15 +86,39 @@ function Tick.httpREQ_launch(data)
|
|||||||
LOG.print(string.gsub(text.versionIsOld,"$1",res.version),"warn")
|
LOG.print(string.gsub(text.versionIsOld,"$1",res.version),"warn")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
LOG.print("Code error: "..res.code,"warn")
|
LOG.print(text.netErrorCode..res.code,"warn")
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
elseif err then
|
elseif err then
|
||||||
LOG.print(text.getNoticeFail..":"..err,"warn")
|
LOG.print(text.getNoticeFail..": "..err,"warn")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
data.time=data.time+1
|
data.time=data.time+1
|
||||||
if data.time==180 then
|
if data.time==300 then
|
||||||
|
LOG.print(text.httpTimeout,"message")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function Tick.httpREQ_register(data)
|
||||||
|
local res,err=client.poll(data.task)
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
res=json.decode(res.body)
|
||||||
|
if res.status then
|
||||||
|
LOG.print(text.registerSuccessed)
|
||||||
|
else
|
||||||
|
LOG.print(text.registerFailed..": "..res.msg)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
LOG.print(text.netErrorCode..res.code,"warn")
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
elseif err then
|
||||||
|
LOG.print(text.registerFailed..": "..err,"warn")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
data.time=data.time+1
|
||||||
|
if data.time==360 then
|
||||||
LOG.print(text.httpTimeout,"message")
|
LOG.print(text.httpTimeout,"message")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user