小程序arm添加计时器和重置按钮,删除测试用的跳过按钮
This commit is contained in:
@@ -611,6 +611,9 @@ return{
|
||||
reset="Reiniciar",
|
||||
invis="A ciegas",
|
||||
},
|
||||
app_arithmetic={
|
||||
reset="Reiniciar",
|
||||
},
|
||||
savedata={
|
||||
export="Exportar al portapapeles",
|
||||
import="Importar de portapapeles",
|
||||
|
||||
@@ -612,6 +612,9 @@ return{
|
||||
reset="Réinitialiser",
|
||||
invis="Aveugler",
|
||||
},
|
||||
app_arithmetic={
|
||||
reset="Réinitialiser",
|
||||
},
|
||||
savedata={
|
||||
-- export="Export to clipboard",
|
||||
-- import="Import from clipboard",
|
||||
|
||||
@@ -642,6 +642,9 @@ return{
|
||||
reset="Resetar",
|
||||
invis="Cego",
|
||||
},
|
||||
app_arithmetic={
|
||||
reset="Resetar",
|
||||
},
|
||||
savedata={
|
||||
-- export="Export to clipboard",
|
||||
-- import="Import from clipboard",
|
||||
|
||||
@@ -656,6 +656,9 @@ return{
|
||||
reset="重置",
|
||||
invis="盲打",
|
||||
},
|
||||
app_arithmetic={
|
||||
reset="重置",
|
||||
},
|
||||
savedata={
|
||||
export="导出到剪切板",
|
||||
import="从剪切板导入",
|
||||
|
||||
@@ -413,7 +413,6 @@ return{
|
||||
ihs="初始持有",
|
||||
irs="初始旋转",
|
||||
ims="初始运动",
|
||||
reset="重置",
|
||||
},
|
||||
setting_key={
|
||||
a1="向左移动",
|
||||
@@ -614,7 +613,6 @@ return{
|
||||
revKB="逆转",
|
||||
},
|
||||
app_schulteG={
|
||||
reset="重置",
|
||||
rank="大小",
|
||||
invis="英维斯",
|
||||
disappear="隐藏",
|
||||
@@ -626,30 +624,25 @@ return{
|
||||
app_AtoZ={
|
||||
level="水平仪",
|
||||
keyboard="键盘",
|
||||
reset="重置",
|
||||
},
|
||||
app_2048={
|
||||
reset="重置",
|
||||
invis="英维斯",
|
||||
tapControl="抽头控制",
|
||||
|
||||
skip="跳转",
|
||||
},
|
||||
app_ten={
|
||||
reset="重置",
|
||||
next="下一个",
|
||||
invis="英维斯",
|
||||
fast="快速的",
|
||||
},
|
||||
app_dtw={
|
||||
reset="重置",
|
||||
color="颜色",
|
||||
mode="模式",
|
||||
bgm="血糖监测",
|
||||
arcade="游乐中心",
|
||||
},
|
||||
app_link={
|
||||
reset="重置",
|
||||
invis="英维斯",
|
||||
},
|
||||
savedata={
|
||||
|
||||
@@ -655,6 +655,9 @@ return{
|
||||
reset="重設",
|
||||
invis="盲打",
|
||||
},
|
||||
app_arithmetic={
|
||||
reset="重設",
|
||||
},
|
||||
savedata={
|
||||
export="導出到剪貼板",
|
||||
import="從剪貼板導入",
|
||||
|
||||
@@ -3,6 +3,8 @@ local rnd=math.random
|
||||
local int,ceil=math.floor,math.ceil
|
||||
local char=string.char
|
||||
|
||||
local timing,time
|
||||
|
||||
local function b2(i)
|
||||
if i==0 then return 0 end
|
||||
local s=""
|
||||
@@ -114,17 +116,27 @@ local levels={
|
||||
local a=rnd(17,int(s/2))
|
||||
return{COLOR.J,b16(a),COLOR.Z,"+",COLOR.J,b16(s-a)},s
|
||||
end,nil,nil,
|
||||
function()return "Coming S∞n"..(rnd()<.5 and""or" "),1e99 end,
|
||||
function()timing=false return "Coming S∞n"..(rnd()<.5 and""or" "),1e99 end,
|
||||
}setmetatable(levels,{__index=function(self,k)return self[k-1]end})
|
||||
|
||||
local level
|
||||
|
||||
local input,inputTime=0,0
|
||||
local question,answer
|
||||
|
||||
local function newQuestion(lv)
|
||||
return levels[lv]()
|
||||
end
|
||||
|
||||
local function reset()
|
||||
timing=true
|
||||
time=0
|
||||
input=""
|
||||
inputTime=0
|
||||
level=1
|
||||
question,answer=newQuestion(1)
|
||||
end
|
||||
|
||||
local function check(val)
|
||||
if val==answer then
|
||||
level=level+1
|
||||
@@ -142,10 +154,7 @@ end
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
input=""
|
||||
inputTime=0
|
||||
level=1
|
||||
question,answer=newQuestion(1)
|
||||
reset()
|
||||
BGM.play('truth')
|
||||
end
|
||||
|
||||
@@ -173,14 +182,15 @@ function scene.keyDown(key,isRep)
|
||||
elseif key=="backspace"then
|
||||
input=""
|
||||
inputTime=0
|
||||
elseif key=="s"then
|
||||
check(answer)
|
||||
elseif key=="r"then
|
||||
reset()
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if timing then time=time+dt end
|
||||
if inputTime>0 then
|
||||
inputTime=inputTime-dt
|
||||
if inputTime<=0 then
|
||||
@@ -189,8 +199,11 @@ function scene.update(dt)
|
||||
end
|
||||
end
|
||||
function scene.draw()
|
||||
FONT.set(35)
|
||||
gc.setColor(COLOR.Z)
|
||||
FONT.set(45)
|
||||
gc.print(("%.3f"):format(time),1026,70)
|
||||
|
||||
FONT.set(35)
|
||||
GC.mStr("["..level.."]",640,30)
|
||||
|
||||
FONT.set(100)
|
||||
@@ -203,6 +216,7 @@ function scene.draw()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name='reset',x=155,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
WIDGET.newKey{name='X',x=540,y=620,w=90,font=60,fText="X",code=pressKey"backspace"},
|
||||
WIDGET.newKey{name='0',x=640,y=620,w=90,font=60,fText="0",code=pressKey"0"},
|
||||
WIDGET.newKey{name='-',x=740,y=620,w=90,font=60,fText="-",code=pressKey"-"},
|
||||
|
||||
Reference in New Issue
Block a user