diff --git a/Zframework/init.lua b/Zframework/init.lua index 4fb5776e..4419fd9e 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -25,6 +25,7 @@ local Timer=love.timer.getTime local int,rnd,max,min=math.floor,math.random,math.max,math.min local abs=math.abs local ins,rem=table.insert,table.remove +local byte=string.byte local scr=scr local xOy=love.math.newTransform() @@ -127,6 +128,75 @@ local touchDown,touchUp,touchMove={},{},{} local keyDown,keyUp={},{} local gamepadDown,gamepadUp={},{} +function keyDown.calculator(k) + local S=sceneTemp + if byte(k)>=48 and byte(k)<=57 then + if S.sym=="="then + S.val=tonumber(k) + S.sym=false + elseif S.sym then + if not S.reg then + S.reg=S.val + S.val=tonumber(k) + elseif S.val<1e13 then + S.val=S.val*10+tonumber(k) + end + else + if S.val<1e13 then + S.val=S.val*10+tonumber(k) + end + end + elseif k=="backspace"then + if S.val>0 then + S.val=int(S.val/10) + end + elseif k=="+"or k=="="and kb.isDown("rshift","lshift")then + S.sym="+" + elseif k=="-"then + S.sym="-" + elseif k=="*"or k=="8"and kb.isDown("rshift","lshift")then + S.sym="*" + elseif k=="/"then + S.sym="/" + elseif k=="return"then + if S.val then + if S.sym and S.reg then + S.val= + S.sym=="+"and S.reg+S.val or + S.sym=="-"and S.reg-S.val or + S.sym=="*"and S.reg*S.val or + S.sym=="/"and S.reg/S.val or + -1 + end + S.sym="=" + S.reg=false + if S.val==626 then + S.pass=true + elseif S.val==196022 then + marking=nil + TEXT.show("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100",640,360,60,"stretch",.6) + SFX.play("clear") + elseif S.val==72943816 then + for name,M in next,Modes do + if not modeRanks[name]then + modeRanks[name]=M.score and 0 or 6 + end + end + FILE.saveUnlock() + TEXT.show("\68\69\86\58\85\78\76\79\67\75\65\76\76",640,360,60,"stretch",.6) + SFX.play("clear_2") + elseif S.val==137926261379 then + SCN.goto("debug") + end + end + elseif k=="space"then + if S.pass then + SCN.goto("load") + end + end +end + + function keyDown.load(k) if k=="a"then sceneTemp.skip=true @@ -738,34 +808,6 @@ function gamepadUp.play(key) end end -function keyDown.staff(key,RESET) - if key=="escape"then - SCN.back() - elseif key=="\122"then - if RESET or kb.isDown("\109")and kb.isDown("\114")then - SCN.goto("debug") - end - end -end -function touchDown.staff(id,x,y) - local pw=sceneTemp.pw - local t=pw%4 - if - t==0 and x<640 and y<360 or - t==1 and x>640 and y<360 or - t==2 and x<640 and y>360 or - t==3 and x>640 and y>360 - then - pw=pw+1 - if pw==8 then - SCN.goto("debug") - end - else - pw=x<640 and y<360==1 and 1 or 0 - end - sceneTemp.pw=pw -end - function wheelMoved.history(x,y) wheelScroll(y) end @@ -1050,7 +1092,7 @@ function love.run() local FCT=0--Framedraw counter love.resize(gc.getWidth(),gc.getHeight()) - SCN.init("load")--Scene Launch + SCN.init(setting.lock and "calculator"or"load")--Scene Launch marking=true return function() diff --git a/Zframework/languages.lua b/Zframework/languages.lua index 483b73cc..835bef5d 100644 --- a/Zframework/languages.lua +++ b/Zframework/languages.lua @@ -186,6 +186,17 @@ local langList={ support="支持作者", group="官方QQ群(如果没有被暗改的话就是这个):1080457319", WidgetText={ + calculator={ + _1="1",_2="2",_3="3", + _4="4",_5="5",_6="6", + _7="7",_8="8",_9="9", + _0="0",["<"]="<",["="]="=", + ["+"]="+", + ["-"]="-", + ["*"]="*", + ["/"]="/", + play="开始", + }, main={ play="开始", setting="设置", @@ -258,14 +269,15 @@ local langList={ graphic="←画面设置", sound="声音设置→", ctrl="控制设置", - reTime="开局等待时间", - maxNext="最大预览数量", - autoPause="失去焦点自动暂停", - layout="外观", key="键位设置", touch="触屏设置", + reTime="开局等待时间", + maxNext="最大预览数量", + layout="外观", + autoPause="失去焦点自动暂停", swap="组合键切换攻击模式", fine="极简操作提示音", + lock="软件锁(密码626)", back="返回", }, setting_video={ @@ -375,8 +387,6 @@ local langList={ back="返回", }, debug={ - killWTM="关闭水印", - unlock="解锁全模式", reset="重置?", reset1="重置解锁/等级", reset2="重置统计", @@ -645,6 +655,17 @@ local langList={ support="支持作者", group="官方QQ群(如果没有被暗改的话就是这个):1080457319", WidgetText={ + calculator={ + _1="1",_2="2",_3="3", + _4="4",_5="5",_6="6", + _7="7",_8="8",_9="9", + _0="0",["<"]="<",["="]="=", + ["+"]="+", + ["-"]="-", + ["*"]="*", + ["/"]="/", + play="开始", + }, main={ play="开始", setting="设置", @@ -717,14 +738,15 @@ local langList={ graphic="←画面设置", sound="声音设置→", ctrl="控制设置", - reTime="开局等待时间", - maxNext="最大预览数量", - autoPause="失去焦点自动暂停", - layout="外观", key="键位设置", touch="触屏设置", + reTime="开局等待时间", + maxNext="最大预览数量", + layout="外观", + autoPause="失去焦点自动暂停", swap="组合键切换攻击模式", fine="极简操作提示音", + lock="软件锁(密码626)", back="返回", }, setting_video={ @@ -834,8 +856,6 @@ local langList={ back="返回", }, debug={ - killWTM="关闭水印", - unlock="解锁全模式", reset="重置?", reset1="重置解锁/等级", reset2="重置统计", @@ -1093,6 +1113,17 @@ local langList={ support="Support author", group="Official QQ Group(if not hacked):1080457319", WidgetText={ + calculator={ + _1="1",_2="2",_3="3", + _4="4",_5="5",_6="6", + _7="7",_8="8",_9="9", + _0="0",["<"]="<",["="]="=", + ["+"]="+", + ["-"]="-", + ["*"]="*", + ["/"]="/", + play="Play", + }, main={ play="Play", setting="Settings", @@ -1165,14 +1196,15 @@ local langList={ graphic="←Video", sound="Sound→", ctrl="Control settings", - reTime="Start Delay", - maxNext="Next Queue Length", - autoPause="Pause when lose focus", - layout="Layout", key="Key Mappings", touch="Touch Settings", + reTime="Start Delay", + maxNext="Next Queue Length", + layout="Layout", + autoPause="Pause when lose focus", swap="Key Combination (Change Atk. Mode)", fine="Finesse Error Sound", + lock="Game Lock(pw=626)", back="Back", }, setting_video={ @@ -1282,8 +1314,6 @@ local langList={ back="Back", }, debug={ - killWTM="Kill watermark", - unlock="Unlock all", reset="Reset?", reset1="Reset rank", reset2="Reset data", @@ -1537,6 +1567,17 @@ local langList={ support="Support author", group="Official QQ Group(if not hacked):1080457319", WidgetText={ + calculator={ + _1="1",_2="2",_3="3", + _4="4",_5="5",_6="6", + _7="7",_8="8",_9="9", + _0="0",["<"]="<",["="]="=", + ["+"]="+", + ["-"]="-", + ["*"]="*", + ["/"]="/", + play="!!!", + }, main={ play="!!!", setting="_?_", @@ -1609,14 +1650,15 @@ local langList={ graphic="←Video", sound="Sound→", ctrl="=?=", - reTime="3-2-1", - maxNext="=123", - autoPause="A||", - layout="=-=-=", key="=?", touch="_?", + reTime="3-2-1", + maxNext="=123", + layout="=-=-=", + autoPause="A||", swap="=+=+=", fine="!#!X #!#", + lock="?XX(=626)", back="X", }, setting_video={ @@ -1726,8 +1768,6 @@ local langList={ back="X", }, debug={ - killWTM="Kill watermark", - unlock="Unlock all", reset="Reset?", reset1="Reset rank", reset2="Reset data", @@ -1999,6 +2039,17 @@ local langList={ support="支持作者", group="官方QQ群(如果没有被暗改的话就是这个):1080457319", WidgetText={ + calculator={ + _1="1",_2="2",_3="3", + _4="4",_5="5",_6="6", + _7="7",_8="8",_9="9", + _0="0",["<"]="<",["="]="=", + ["+"]="+", + ["-"]="-", + ["*"]="*", + ["/"]="/", + play="开始", + }, main={ play="开始", setting="设置", @@ -2071,14 +2122,15 @@ local langList={ graphic="←改画面", sound="改声音→", ctrl="改控制", - reTime="开局等待时间", - maxNext="最大预览数量", - autoPause="失去焦点自动暂停", - layout="外观", key="改键位", touch="改触屏", + reTime="开局等待时间", + maxNext="最大预览数量", + layout="外观", + autoPause="失去焦点自动暂停", swap="组合键切换攻击模式", fine="极简操作提示音", + lock="家长锁(密码626)", back="返回", }, setting_video={ @@ -2188,8 +2240,6 @@ local langList={ back="返回", }, debug={ - killWTM="关水印", - unlock="解锁全模式", reset="重置?", reset1="重置解锁/等级", reset2="重置统计", @@ -2351,7 +2401,6 @@ function LANG.set(l) end end for _,s in next,drawableTextLoad do - print(s) drawableText[s]:set(text[s]) end collectgarbage() diff --git a/Zframework/paint.lua b/Zframework/paint.lua index 6f5493c3..9f44eb3a 100644 --- a/Zframework/paint.lua +++ b/Zframework/paint.lua @@ -94,6 +94,16 @@ end local Pnt={} +function Pnt.calculator() + local S=sceneTemp + gc.setLineWidth(4) + gc.rectangle("line",100,80,650,150) + setFont(45) + if S.reg then gc.printf(S.reg,0,100,720,"right")end + if S.val then gc.printf(S.val,0,150,720,"right")end + setFont(50) + if S.sym then gc.print(S.sym,126,150)end +end function Pnt.load() local S=sceneTemp gc.setLineWidth(4) @@ -381,7 +391,6 @@ function Pnt.sequence() gc.draw(drawableText.question,980,470) end end - function Pnt.draw() local sx,sy=sceneTemp.x,sceneTemp.y gc.translate(200,60) @@ -531,10 +540,10 @@ function Pnt.play() end gc.pop() end + local hexList={1,0,.5,1.732*.5,-.5,1.732*.5}for i=1,6 do hexList[i]=hexList[i]*150 end local textPos={90,131,-90,131,-200,-25,-90,-181,90,-181,200,-25} local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13} - function Pnt.pause() local S=sceneTemp local T=S.timer*.02 @@ -646,6 +655,7 @@ function Pnt.setting_sound() gc.draw(IMG.miyaF4,129,98+3*sin(t*.7)) gc.translate(-x,-y) end + local function timeConv(t) return t.."F "..int(t*16.67).."ms" end diff --git a/Zframework/scene.lua b/Zframework/scene.lua index 24cb8051..f238f4b5 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -7,6 +7,14 @@ local scr=scr local sceneInit={} sceneInit.quit=love.event.quit +function sceneInit.calculator() + sceneTemp={ + reg=false, + val=0, + sym=false, + pass=false, + } +end function sceneInit.load() sceneTemp={ phase=1,--Loading stage @@ -221,7 +229,6 @@ function sceneInit.help() end function sceneInit.staff() sceneTemp={ - pw=0, time=0, v=1, } diff --git a/Zframework/widgetList.lua b/Zframework/widgetList.lua index d79a7acf..acf2284f 100644 --- a/Zframework/widgetList.lua +++ b/Zframework/widgetList.lua @@ -98,6 +98,25 @@ newSlider=WIDGET.newSlider --All widgets local Widgets={ load={},intro={},quit={}, + calculator={ + newKey({name="_1", x=300,y=300,w=90,h=90, color="white", font=50,code=pressKey("1")}), + newKey({name="_2", x=400,y=300,w=90,h=90, color="white", font=50,code=pressKey("2")}), + newKey({name="_3", x=500,y=300,w=90,h=90, color="white", font=50,code=pressKey("3")}), + newKey({name="_4", x=300,y=400,w=90,h=90, color="white", font=50,code=pressKey("4")}), + newKey({name="_5", x=400,y=400,w=90,h=90, color="white", font=50,code=pressKey("5")}), + newKey({name="_6", x=500,y=400,w=90,h=90, color="white", font=50,code=pressKey("6")}), + newKey({name="_7", x=300,y=500,w=90,h=90, color="white", font=50,code=pressKey("7")}), + newKey({name="_8", x=400,y=500,w=90,h=90, color="white", font=50,code=pressKey("8")}), + newKey({name="_9", x=500,y=500,w=90,h=90, color="white", font=50,code=pressKey("9")}), + newKey({name="_0", x=300,y=600,w=90,h=90, color="white", font=50,code=pressKey("0")}), + newKey({name="<", x=400,y=600,w=90,h=90, color="lRed", font=50,code=pressKey("backspace")}), + newKey({name="=", x=500,y=600,w=90,h=90, color="lYellow",font=50,code=pressKey("return")}), + newKey({name="+", x=600,y=300,w=90,h=90, color="lBlue", font=50,code=pressKey("+")}), + newKey({name="-", x=600,y=400,w=90,h=90, color="lBlue", font=50,code=pressKey("-")}), + newKey({name="*", x=600,y=500,w=90,h=90, color="lBlue", font=50,code=pressKey("*")}), + newKey({name="/", x=600,y=600,w=90,h=90, color="lBlue", font=50,code=pressKey("/")}), + newButton({name="play", x=800,y=600,w=180,h=90, color="lGreen", font=40,code=pressKey("space"),hide=function()return not sceneTemp.pass end}), + }, main={ newButton({name="play", x=150,y=280,w=200,h=160,color="lRed", font=55,code=function()SCN.goto("mode")end}), newButton({name="setting", x=370,y=280,w=200,h=160,color="lBlue", font=45,code=function()SCN.goto("setting_game")end}), @@ -230,6 +249,7 @@ local Widgets={ newSwitch({name="autoPause",x=1080, y=320, font=20,disp=SETval("autoPause"), code=SETrev("autoPause")}), newSwitch({name="swap", x=1080, y=380, font=20,disp=SETval("swap"), code=SETrev("swap")}), newSwitch({name="fine", x=1080, y=440, font=20,disp=SETval("fine"), code=SETrev("fine")}), + newSwitch({name="lock", x=1080, y=500, font=20,disp=SETval("lock"), code=SETrev("lock")}), newButton({name="back", x=1140, y=650, w=200,h=80,color="white", font=40,code=BACK}), }, setting_video={ @@ -457,27 +477,7 @@ local Widgets={ newButton({name="back", x=640, y=620,w=200,h=80,color="white",font=40,code=BACK}), }, debug={ - newButton({name="killWTM", x=340,y=200,w=260,h=100,color="white",font=35, - code=function() - marking=nil - TEXT.show("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100",640,360,60,"stretch",.6) - SFX.play("clear") - end, - hide=function() - return not marking - end}), - newButton({name="unlock", x=640,y=200,w=260,h=100,color="white",font=40, - code=function() - for name,M in next,Modes do - if not modeRanks[name]then - modeRanks[name]=M.score and 0 or 6 - end - end - FILE.saveUnlock() - TEXT.show("\68\69\86\58\85\78\76\79\67\75\65\76\76",640,360,60,"stretch",.6) - SFX.play("clear_2") - end}), - newButton({name="reset", x=940,y=200,w=260,h=100,color="yellow",font=40, + newButton({name="reset", x=640,y=200,w=260,h=100,color="yellow",font=40, code=function() sceneTemp.reset=true end, diff --git a/parts/default_data.lua b/parts/default_data.lua index fc54876e..dee02257 100644 --- a/parts/default_data.lua +++ b/parts/default_data.lua @@ -10,6 +10,7 @@ setting={ reTime=4, autoPause=true, fine=false, + lock=false, lang=1, skinSet=1, skin={1,5,8,2,10,3,7,1,5,1,5,8,2,10,3,7,10,7,8,2,8,2,1,5,3},