From 383b00d2c792016652c3288cc667c3ed4857ebfd Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 13 Nov 2020 22:40:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B0=8F=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=EF=BC=9AA=20to=20Z?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LANG/lang_en.lua | 4 ++ LANG/lang_fr.lua | 4 ++ LANG/lang_sp.lua | 4 ++ LANG/lang_symbol.lua | 4 ++ LANG/lang_zh.lua | 5 ++ parts/scenes/a_z.lua | 110 ++++++++++++++++++++++++++++++++++++++ parts/scenes/minigame.lua | 1 + 7 files changed, 132 insertions(+) create mode 100644 parts/scenes/a_z.lua diff --git a/LANG/lang_en.lua b/LANG/lang_en.lua index 6a92745e..15a7e3dd 100644 --- a/LANG/lang_en.lua +++ b/LANG/lang_en.lua @@ -550,6 +550,10 @@ return{ pong={ reset="Restart", }, + AtoZ={ + level="Level", + reset="Reset", + }, savedata={ exportUnlock="Export progress", exportData="Export statistics", diff --git a/LANG/lang_fr.lua b/LANG/lang_fr.lua index 54262dbf..a265fecb 100644 --- a/LANG/lang_fr.lua +++ b/LANG/lang_fr.lua @@ -549,6 +549,10 @@ return{ pong={ reset="Redémarrer", }, + AtoZ={ + -- level="Level", + reset="Redémarrer", + }, help={ dict="little Z", staff="Staff", diff --git a/LANG/lang_sp.lua b/LANG/lang_sp.lua index 6453462c..5fe86be0 100644 --- a/LANG/lang_sp.lua +++ b/LANG/lang_sp.lua @@ -554,6 +554,10 @@ return{ pong={ reset="Reiniciar", }, + AtoZ={ + -- level="Level", + reset="Reiniciar", + }, savedata={ -- exportUnlock="Export Unlock", -- exportData="Export Data", diff --git a/LANG/lang_symbol.lua b/LANG/lang_symbol.lua index 17865752..467cc759 100644 --- a/LANG/lang_symbol.lua +++ b/LANG/lang_symbol.lua @@ -486,6 +486,10 @@ return{ pong={ reset="R", }, + AtoZ={ + level="_ _ _", + reset="R", + }, }, getTip=function() local L="!@#$%^&*()-=_+[]{}\\|;:\'\",<.>/?" diff --git a/LANG/lang_zh.lua b/LANG/lang_zh.lua index abf7a2a4..f387e2a0 100644 --- a/LANG/lang_zh.lua +++ b/LANG/lang_zh.lua @@ -533,6 +533,7 @@ return{ p15="15 Puzzle", schulte_G="舒尔特方格", pong="Pong", + AtoZ="A to Z", }, p15={ reset="打乱", @@ -552,6 +553,10 @@ return{ pong={ reset="重置", }, + AtoZ={ + level="关卡", + reset="重置", + }, savedata={ exportUnlock="导出地图进度", exportData="导出统计数据", diff --git a/parts/scenes/a_z.lua b/parts/scenes/a_z.lua new file mode 100644 index 00000000..d45d1415 --- /dev/null +++ b/parts/scenes/a_z.lua @@ -0,0 +1,110 @@ +local gc=love.graphics +local Timer=love.timer.getTime +local rnd=math.random +local format=string.format + +local mStr=mStr + +local levels={ + A_Z="ABCDEFGHIJKLMNOPQRSTUVWXYZ", + Z_A="ZYXWVUTSRQPONMLKJIHGFEDCBA", + Tech1="TECHMINOHAOWAN", + Tech2="TECHMINOISFUN", + KeyTest1="THEQUICKBROWNFOXJUMPSOVERALAZYDOG", + KeyTest2="THEFIVEBOXINGWIZARDSJUMPQUICKLY", + hello="HELLOWORLD", + zzz="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", + zxzx="ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX", + stair="ZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCV", + bpw="OHOOOOOOOOOAAAAEAAIAUJOOOOOOOOOOOAAEOAAUUAEEEEEEEEEAAAAEAEIEAJOOOOOOOOOOEEEEOAAAAAAA", +} + +function sceneInit.AtoZ() + BG.set("bg2") + BGM.play("way") + sceneTemp={ + level="A_Z", + target=levels.A_Z, + count=1, + error=0, + startTime=0, + time=0, + state=0, + } +end + +function keyDown.AtoZ(key) + local S=sceneTemp + if #key==1 then + if S.state<2 then + if key:upper():byte()==S.target:byte(S.count)then + S.count=S.count+1 + TEXT.show(key:upper(),rnd(320,960),rnd(100,240),90,"score",2.6) + SFX.play("move") + if S.count==2 then + S.state=1 + S.startTime=Timer() + elseif S.count>#S.target then + S.time=Timer()-S.startTime + S.state=2 + SFX.play("reach") + end + elseif S.count>1 then + S.error=S.error+1 + SFX.play("finesseError") + end + end + elseif key=="space"then + S.count=1 + S.error=0 + S.time=0 + S.state=0 + elseif key=="escape"then + SCN.back() + end +end + +function Tmr.AtoZ() + local S=sceneTemp + if S.state==1 then + S.time=Timer()-S.startTime + end +end + +function Pnt.AtoZ() + local S=sceneTemp + + setFont(40) + gc.setColor(1,1,1) + gc.print(format("%.3f",S.time),1026,80) + gc.print(S.error,1026,150) + + if S.state>0 then + gc.print(format("%.3f/s",(S.count-1)/S.time),1026,220) + end + + if S.state==2 then + gc.setColor(.9,.9,0)--win + elseif S.state==1 then + gc.setColor(.9,.9,.9)--game + elseif S.state==0 then + gc.setColor(.2,.8,.2)--ready + end + + setFont(100) + mStr(S.state==1 and #S.target-S.count+1 or S.state==0 and"Ready"or S.state==2 and"Win",640,200) + + gc.setColor(1,1,1) + gc.print(S.target:sub(S.count,S.count),120,280,0,2) + gc.print(S.target:sub(S.count+1),310,380) + + gc.setColor(1,1,1,.7) + setFont(40) + gc.print(S.target,120,520) +end + +WIDGET.init("AtoZ",{ + WIDGET.newSelector({name="level",x=640,y=640,w=200,list={"A_Z","Z_A","Tech1","Tech2","KeyTest1","KeyTest2","hello","zzz","zxzx","stair"},disp=WIDGET.lnk_STPval("level"),code=function(i)sceneTemp.level=i;sceneTemp.target=levels[i]end,hide=function()return sceneTemp.state>0 end}), + WIDGET.newButton({name="reset",x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")}), + WIDGET.newButton({name="back",x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}), +}) \ No newline at end of file diff --git a/parts/scenes/minigame.lua b/parts/scenes/minigame.lua index a936edfd..200391d6 100644 --- a/parts/scenes/minigame.lua +++ b/parts/scenes/minigame.lua @@ -6,5 +6,6 @@ WIDGET.init("minigame",{ WIDGET.newButton({name="p15", x=240, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("p15")}), WIDGET.newButton({name="schulte_G", x=640, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("schulte_G")}), WIDGET.newButton({name="pong", x=1040, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("pong")}), + WIDGET.newButton({name="AtoZ", x=240, y=400,w=350,h=120,font=40,code=WIDGET.lnk_goScene("AtoZ")}), WIDGET.newButton({name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}), }) \ No newline at end of file