两个输入验证码的地方添加粘贴按钮
整理代码
This commit is contained in:
Submodule Zframework updated: 24864eda21...8a56f3f9b0
@@ -51,7 +51,7 @@ do-- function tryDelete()
|
||||
end
|
||||
end
|
||||
do-- function loadFile(name,args), function saveFile(data,name,args)
|
||||
local t=setmetatable({},{__index=function() return"'$1' loading failed: $2" end})
|
||||
local t=setmetatable({},{__index=function() return "'$1' loading failed: $2" end})
|
||||
function loadFile(name,args)
|
||||
local text=text or t
|
||||
if not args then args='' end
|
||||
|
||||
@@ -40,7 +40,7 @@ return {
|
||||
end end
|
||||
end,
|
||||
score=function(P) return {P.modeData.place,P.modeData.ko} end,
|
||||
scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end,
|
||||
scoreDisp=function(D) return "NO."..D[1].." KO:"..D[2] end,
|
||||
comp=function(a,b) return a[1]<b[1] or a[1]==b[1] and a[2]>b[2] end,
|
||||
getRank=function(P)
|
||||
local R=P.modeData.place
|
||||
|
||||
@@ -40,7 +40,7 @@ return {
|
||||
end end
|
||||
end,
|
||||
score=function(P) return {P.modeData.place,P.modeData.ko} end,
|
||||
scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end,
|
||||
scoreDisp=function(D) return "NO."..D[1].." KO:"..D[2] end,
|
||||
comp=function(a,b) return a[1]<b[1] or a[1]==b[1] and a[2]>b[2] end,
|
||||
getRank=function(P)
|
||||
local R=P.modeData.place
|
||||
|
||||
@@ -40,7 +40,7 @@ return {
|
||||
end end
|
||||
end,
|
||||
score=function(P) return {P.modeData.place,P.modeData.ko} end,
|
||||
scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end,
|
||||
scoreDisp=function(D) return "NO."..D[1].." KO:"..D[2] end,
|
||||
comp=function(a,b) return a[1]<b[1] or a[1]==b[1] and a[2]>b[2] end,
|
||||
getRank=function(P)
|
||||
local R=P.modeData.place
|
||||
|
||||
@@ -40,7 +40,7 @@ return {
|
||||
end end
|
||||
end,
|
||||
score=function(P) return {P.modeData.place,P.modeData.ko} end,
|
||||
scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end,
|
||||
scoreDisp=function(D) return "NO."..D[1].." KO:"..D[2] end,
|
||||
comp=function(a,b) return a[1]<b[1] or a[1]==b[1] and a[2]>b[2] end,
|
||||
getRank=function(P)
|
||||
local R=P.modeData.place
|
||||
|
||||
@@ -40,7 +40,7 @@ return {
|
||||
end end
|
||||
end,
|
||||
score=function(P) return {P.modeData.place,P.modeData.ko} end,
|
||||
scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end,
|
||||
scoreDisp=function(D) return "NO."..D[1].." KO:"..D[2] end,
|
||||
comp=function(a,b) return a[1]<b[1] or a[1]==b[1] and a[2]>b[2] end,
|
||||
getRank=function(P)
|
||||
local R=P.modeData.place
|
||||
|
||||
@@ -40,7 +40,7 @@ return {
|
||||
end end
|
||||
end,
|
||||
score=function(P) return {P.modeData.place,P.modeData.ko} end,
|
||||
scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end,
|
||||
scoreDisp=function(D) return "NO."..D[1].." KO:"..D[2] end,
|
||||
comp=function(a,b) return a[1]<b[1] or a[1]==b[1] and a[2]>b[2] end,
|
||||
getRank=function(P)
|
||||
local R=P.modeData.place
|
||||
|
||||
@@ -1000,7 +1000,7 @@ local fleg={
|
||||
pw=the_secret,
|
||||
supw=7126,
|
||||
second_box="Coming soon",
|
||||
}setmetatable(fleg,{__tostring=function() return"The fl\97g." end})
|
||||
}setmetatable(fleg,{__tostring=function() return "The fl\97g." end})
|
||||
function userG.the_box(k)
|
||||
if k~=first_key then
|
||||
log"Usage:"log"*The box is locked*"
|
||||
|
||||
@@ -107,7 +107,7 @@ local loadingThread=coroutine.wrap(function()
|
||||
LOADED=true
|
||||
saveStats()
|
||||
Z.setPowerInfo(SETTING.powerInfo)
|
||||
return'finish'
|
||||
return 'finish'
|
||||
end)
|
||||
|
||||
function scene.sceneInit()
|
||||
|
||||
@@ -9,7 +9,6 @@ local function _getCode()
|
||||
NET.getCode(email)
|
||||
end
|
||||
end
|
||||
|
||||
local function _codeLogin()
|
||||
local code=scene.widgetList.code:getText():upper()
|
||||
if #code~=8 then
|
||||
@@ -18,6 +17,17 @@ local function _codeLogin()
|
||||
NET.codeLogin(USER.email,code)
|
||||
end
|
||||
end
|
||||
local function _paste()
|
||||
local t=love.system.getClipboardText()
|
||||
if t then
|
||||
t=STRING.trim(t)
|
||||
if #t==8 and t:match("[0-9]+") then
|
||||
scene.widgetList.code:setText(t)
|
||||
return
|
||||
end
|
||||
end
|
||||
MES.new('warn',text.wrongCode)
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
scene.widgetList.email:setText(USER.email or "")
|
||||
@@ -33,6 +43,8 @@ function scene.keyDown(key,rep)
|
||||
else
|
||||
_codeLogin()
|
||||
end
|
||||
elseif key=='v' and love.keyboard.isDown('lctrl','rctrl') then
|
||||
_paste()
|
||||
else
|
||||
return true
|
||||
end
|
||||
@@ -45,8 +57,9 @@ scene.widgetList={
|
||||
WIDGET.newInputBox{name='email', x=380, y=200,w=626,h=60,limit=128},
|
||||
WIDGET.newKey{name='send', x=640, y=330,w=300,h=80,font=40,code=_getCode},
|
||||
|
||||
WIDGET.newInputBox{name='code', x=380, y=400,w=626 ,h=60,limit=8},
|
||||
WIDGET.newInputBox{name='code', x=380, y=400,w=626,h=60,regex="[0-9a-zA-Z]",limit=8},
|
||||
WIDGET.newKey{name='verify', x=640, y=530,w=300,h=80,font=40,code=_codeLogin},
|
||||
WIDGET.newKey{name='paste', x=850, y=530,w=80,font=40,fText=CHAR.icon.import,code=_paste},
|
||||
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||
}
|
||||
|
||||
@@ -14,6 +14,17 @@ local function _setPW()
|
||||
NET.setPW(code,password)
|
||||
end
|
||||
end
|
||||
local function _paste()
|
||||
local t=love.system.getClipboardText()
|
||||
if t then
|
||||
t=STRING.trim(t)
|
||||
if #t==8 and t:match("[0-9]+") then
|
||||
scene.widgetList.code:setText(t)
|
||||
return
|
||||
end
|
||||
end
|
||||
MES.new('warn',text.wrongCode)
|
||||
end
|
||||
|
||||
function scene.enter()
|
||||
if SCN.args[1] then
|
||||
@@ -29,6 +40,8 @@ function scene.keyDown(key,rep)
|
||||
else
|
||||
_setPW()
|
||||
end
|
||||
elseif key=='v' and love.keyboard.isDown('lctrl','rctrl') then
|
||||
_paste()
|
||||
else
|
||||
return true
|
||||
end
|
||||
@@ -37,11 +50,13 @@ end
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
|
||||
|
||||
WIDGET.newInputBox{name='code', x=380, y=170,w=626,h=60,regex="[0-9a-zA-Z]",limit=8},
|
||||
WIDGET.newKey{name='send', x=640, y=300,w=300,h=80,font=40,code=function() NET.getCode(USER.email) end},
|
||||
WIDGET.newInputBox{name='code', x=380, y=170,w=626,h=60,limit=8},
|
||||
|
||||
WIDGET.newInputBox{name='password', x=380, y=370,w=626,h=60,secret=true,regex="[ -~]",limit=64},
|
||||
WIDGET.newInputBox{name='password2',x=380, y=470,w=626,h=60,secret=true,regex="[ -~]",limit=64},
|
||||
WIDGET.newKey{name='setPW', x=640, y=600,w=350,h=80,font=40,code=_setPW},
|
||||
WIDGET.newKey{name='paste', x=850, y=300,w=80,font=40,fText=CHAR.icon.import,code=_paste},
|
||||
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user