淘汰sceneTemp技术

This commit is contained in:
MrZ626
2020-12-10 22:20:17 +08:00
parent 937eed1ee6
commit bb95c9e3a3
28 changed files with 898 additions and 901 deletions

View File

@@ -799,11 +799,6 @@ function WIDGET.lnk_SETval(k) return function() return SETTING[k] end end
function WIDGET.lnk_SETrev(k) return function() SETTING[k]=not SETTING[k] end end function WIDGET.lnk_SETrev(k) return function() SETTING[k]=not SETTING[k] end end
function WIDGET.lnk_SETsto(k) return function(i) SETTING[k]=i end end function WIDGET.lnk_SETsto(k) return function(i) SETTING[k]=i end end
function WIDGET.lnk_STPval(k) return function() return sceneTemp[k] end end
function WIDGET.lnk_STPrev(k) return function() sceneTemp[k]=not sceneTemp[k] end end
function WIDGET.lnk_STPsto(k) return function(i) sceneTemp[k]=i end end
function WIDGET.lnk_STPeq(k,v) return function() return sceneTemp[k]==v end end
function WIDGET.lnk_pressKey(k) return function() love.keypressed(k) end end function WIDGET.lnk_pressKey(k) return function() love.keypressed(k) end end
function WIDGET.lnk_goScene(t,s) return function() SCN.go(t,s) end end function WIDGET.lnk_goScene(t,s) return function() SCN.go(t,s) end end
function WIDGET.lnk_swapScene(t,s) return function() SCN.swapTo(t,s) end end function WIDGET.lnk_swapScene(t,s) return function() SCN.swapTo(t,s) end end

View File

@@ -138,7 +138,6 @@ function pasteSequence(str)
end end
BAG=bag BAG=bag
sceneTemp.cur=#bag
return true return true
end end
@@ -295,7 +294,6 @@ function pasteMission(str)
end end
MISSION=mission MISSION=mission
sceneTemp.cur=#mission
return true return true
end end

View File

@@ -3,7 +3,7 @@
local scene={} local scene={}
function scene.sceneInit() function scene.sceneInit()
sceneTemp={}
end end
scene.widgetList={ scene.widgetList={

View File

@@ -5,80 +5,82 @@ local find,sub,byte=string.find,string.sub,string.byte
local scene={} local scene={}
local reg--register
local val--value
local sym--symbol
local pass--if password correct
function scene.sceneInit() function scene.sceneInit()
BG.set("none") BG.set("none")
sceneTemp={ reg=false
reg=false, val="0"
val="0", sym=false
sym=false, pass=false
pass=false,
}
end end
scene.mouseDown=NULL scene.mouseDown=NULL
function scene.keyDown(k) function scene.keyDown(k)
local S=sceneTemp
if byte(k)>=48 and byte(k)<=57 then if byte(k)>=48 and byte(k)<=57 then
if S.sym=="="then if sym=="="then
S.val=k val=k
S.sym=false sym=false
elseif S.sym and not S.reg then elseif sym and not reg then
S.reg=S.val reg=val
S.val=k val=k
else else
if #S.val<14 then if #val<14 then
if S.val=="0"then S.val=""end if val=="0"then val=""end
S.val=S.val..k val=val..k
end end
end end
elseif k:sub(1,2)=="kp"then elseif k:sub(1,2)=="kp"then
scene.keyDown(k:sub(3)) scene.keyDown(k:sub(3))
elseif k=="."then elseif k=="."then
if not(find(S.val,".",nil,true)or find(S.val,"e"))then if not(find(val,".",nil,true)or find(val,"e"))then
if S.sym and not S.reg then if sym and not reg then
S.reg=S.val reg=val
S.val="0." val="0."
end end
S.val=S.val.."." val=val.."."
end end
elseif k=="e"then elseif k=="e"then
if not find(S.val,"e")then if not find(val,"e")then
S.val=S.val.."e" val=val.."e"
end end
elseif k=="backspace"then elseif k=="backspace"then
if S.sym=="="then if sym=="="then
S.val="" val=""
elseif S.sym then elseif sym then
S.sym=false sym=false
else else
S.val=sub(S.val,1,-2) val=sub(val,1,-2)
end end
if S.val==""then S.val="0"end if val==""then val="0"end
elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then S.sym="+" S.reg=false elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then sym="+" reg=false
elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then S.sym="*" S.reg=false elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then sym="*" reg=false
elseif k=="-"then S.sym="-" S.reg=false elseif k=="-"then sym="-" reg=false
elseif k=="/"then S.sym="/" S.reg=false elseif k=="/"then sym="/" reg=false
elseif k=="return"then elseif k=="return"then
if byte(S.val,-1)==101 then S.val=sub(S.val,1,-2)end if byte(val,-1)==101 then val=sub(val,1,-2)end
if S.sym and S.reg then if sym and reg then
if byte(S.reg,-1)==101 then S.reg=sub(S.reg,1,-2)end if byte(reg,-1)==101 then reg=sub(reg,1,-2)end
S.val= val=
S.sym=="+"and (tonumber(S.reg)or 0)+tonumber(S.val)or sym=="+"and (tonumber(reg)or 0)+tonumber(val)or
S.sym=="-"and (tonumber(S.reg)or 0)-tonumber(S.val)or sym=="-"and (tonumber(reg)or 0)-tonumber(val)or
S.sym=="*"and (tonumber(S.reg)or 0)*tonumber(S.val)or sym=="*"and (tonumber(reg)or 0)*tonumber(val)or
S.sym=="/"and (tonumber(S.reg)or 0)/tonumber(S.val)or sym=="/"and (tonumber(reg)or 0)/tonumber(val)or
-1 -1
end end
S.sym="=" sym="="
S.reg=false reg=false
local v=tonumber(S.val) local v=tonumber(val)
if v==600+26 then S.pass=true if v==600+26 then pass=true
elseif v==190000+6022 then elseif v==190000+6022 then
S.pass,MARKING=true pass,MARKING=true
LOG.print("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100","message") LOG.print("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100","message")
SFX.play("clear") SFX.play("clear")
elseif v==72943816 then elseif v==72943816 then
S.pass=true pass=true
for name,M in next,MODES do for name,M in next,MODES do
if not RANKS[name]then if not RANKS[name]then
RANKS[name]=M.score and 0 or 6 RANKS[name]=M.score and 0 or 6
@@ -107,10 +109,10 @@ function scene.keyDown(k)
LOG.print("dpi: "..SCR.dpi) LOG.print("dpi: "..SCR.dpi)
end end
elseif k=="escape"then elseif k=="escape"then
S.val,S.reg,S.sym="0" val,reg,sym="0"
elseif k=="delete"then elseif k=="delete"then
S.val="0" val="0"
elseif k=="space"and S.pass then elseif k=="space"and pass then
if LOADED then if LOADED then
SCN.back() SCN.back()
else else
@@ -120,14 +122,13 @@ function scene.keyDown(k)
end end
function scene.draw() function scene.draw()
local S=sceneTemp
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.setLineWidth(4) gc.setLineWidth(4)
gc.rectangle("line",100,80,650,150) gc.rectangle("line",100,80,650,150)
setFont(45) setFont(45)
if S.reg then gc.printf(S.reg,0,100,720,"right")end if reg then gc.printf(reg,0,100,720,"right")end
if S.val then gc.printf(S.val,0,150,720,"right")end if val then gc.printf(val,0,150,720,"right")end
if S.sym then setFont(50)gc.print(S.sym,126,150)end if sym then setFont(50)gc.print(sym,126,150)end
end end
scene.widgetList={ scene.widgetList={
@@ -149,7 +150,7 @@ scene.widgetList={
WIDGET.newKey{name="/", x=450,y=600,w=90,color="lBlue", font=50,code=WIDGET.lnk_pressKey("/")}, WIDGET.newKey{name="/", x=450,y=600,w=90,color="lBlue", font=50,code=WIDGET.lnk_pressKey("/")},
WIDGET.newKey{name="<", x=550,y=300,w=90,color="lRed", font=50,code=WIDGET.lnk_pressKey("backspace")}, WIDGET.newKey{name="<", x=550,y=300,w=90,color="lRed", font=50,code=WIDGET.lnk_pressKey("backspace")},
WIDGET.newKey{name="=", x=550,y=400,w=90,color="lYellow",font=50,code=WIDGET.lnk_pressKey("return")}, WIDGET.newKey{name="=", x=550,y=400,w=90,color="lYellow",font=50,code=WIDGET.lnk_pressKey("return")},
WIDGET.newButton{name="play",x=640,y=600,w=180,h=90,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space"),hide=function()return not sceneTemp.pass end}, WIDGET.newButton{name="play",x=640,y=600,w=180,h=90,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space"),hide=function()return not pass end},
} }
return scene return scene

View File

@@ -15,14 +15,16 @@ local CUSTOMENV=CUSTOMENV
local scene={} local scene={}
local initField
function scene.sceneInit() function scene.sceneInit()
destroyPlayers() destroyPlayers()
BG.set(CUSTOMENV.bg) BG.set(CUSTOMENV.bg)
BGM.play(CUSTOMENV.bgm) BGM.play(CUSTOMENV.bgm)
sceneTemp={initField=false} initField=false
for y=1,20 do for y=1,20 do
if notAir(FIELD[1][y])then if notAir(FIELD[1][y])then
sceneTemp.initField=true initField=true
end end
end end
end end
@@ -45,7 +47,7 @@ function scene.keyDown(key)
end end
end end
if key=="return2"or kb.isDown("lalt","lctrl","lshift")then if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
if sceneTemp.initField then if initField then
loadGame("custom_puzzle",true) loadGame("custom_puzzle",true)
end end
else else
@@ -106,7 +108,7 @@ end
function scene.draw() function scene.draw()
--Field content --Field content
if sceneTemp.initField then if initField then
gc.push("transform") gc.push("transform")
gc.translate(95,290) gc.translate(95,290)
gc.scale(.5) gc.scale(.5)
@@ -129,7 +131,7 @@ function scene.draw()
--Field --Field
setFont(40) setFont(40)
if sceneTemp.initField and #FIELD>1 then if initField and #FIELD>1 then
gc.setColor(1,1,int(Timer()*6.26)%2) gc.setColor(1,1,int(Timer()*6.26)%2)
gc.print("+",275,300) gc.print("+",275,300)
gc.print(#FIELD-1,300,300) gc.print(#FIELD-1,300,300)
@@ -178,7 +180,7 @@ scene.widgetList={
WIDGET.newButton{name="copy", x=1070, y=310,w=310,h=70,color="lRed", font=25,code=WIDGET.lnk_pressKey("cC")}, WIDGET.newButton{name="copy", x=1070, y=310,w=310,h=70,color="lRed", font=25,code=WIDGET.lnk_pressKey("cC")},
WIDGET.newButton{name="paste", x=1070, y=390,w=310,h=70,color="lBlue", font=25,code=WIDGET.lnk_pressKey("cV")}, WIDGET.newButton{name="paste", x=1070, y=390,w=310,h=70,color="lBlue", font=25,code=WIDGET.lnk_pressKey("cV")},
WIDGET.newButton{name="clear", x=1070, y=470,w=310,h=70,color="lYellow",font=35,code=WIDGET.lnk_pressKey("return")}, WIDGET.newButton{name="clear", x=1070, y=470,w=310,h=70,color="lYellow",font=35,code=WIDGET.lnk_pressKey("return")},
WIDGET.newButton{name="puzzle",x=1070, y=550,w=310,h=70,color="lMagenta",font=35,code=WIDGET.lnk_pressKey("return2"),hide=function()return not sceneTemp.initField end}, WIDGET.newButton{name="puzzle",x=1070, y=550,w=310,h=70,color="lMagenta",font=35,code=WIDGET.lnk_pressKey("return2"),hide=function()return not initField end},
--More --More
WIDGET.newKey{name="advance", x=730, y=190,w=220,h=90,color="red", font=35,code=WIDGET.lnk_goScene("custom_advance")}, WIDGET.newKey{name="advance", x=730, y=190,w=220,h=90,color="red", font=35,code=WIDGET.lnk_goScene("custom_advance")},

View File

@@ -8,14 +8,18 @@ local sub=string.sub
local FIELD=FIELD local FIELD=FIELD
local scene={} local scene={}
local sure
local pen--Pen type
local px,py--Pen position
local demo--If show x
local page
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ sure=0
sure=0, pen=1
pen=1, px,py=1,1
x=1,y=1, demo=false
demo=false, page=1
page=1,
}
end end
local penKey={ local penKey={
@@ -29,17 +33,15 @@ function scene.mouseDown(x,y)
scene.mouseMove(x,y) scene.mouseMove(x,y)
end end
function scene.mouseMove(x,y) function scene.mouseMove(x,y)
local S=sceneTemp
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=nil end if sx<1 or sx>10 then sx=nil end
if sy<1 or sy>20 then sy=nil end if sy<1 or sy>20 then sy=nil end
S.x,S.y=sx,sy px,py=sx,sy
if sx and sy and ms.isDown(1,2,3)then if sx and sy and ms.isDown(1,2,3)then
FIELD[S.page][sy][sx]=ms.isDown(1)and S.pen or ms.isDown(2)and -1 or 0 FIELD[page][sy][sx]=ms.isDown(1)and pen or ms.isDown(2)and -1 or 0
end end
end end
function scene.wheelMoved(_,y) function scene.wheelMoved(_,y)
local pen=sceneTemp.pen
if y<0 then if y<0 then
pen=pen+1 pen=pen+1
if pen==25 then pen=1 end if pen==25 then pen=1 end
@@ -47,24 +49,21 @@ function scene.wheelMoved(_,y)
pen=pen-1 pen=pen-1
if pen==0 then pen=24 end if pen==0 then pen=24 end
end end
sceneTemp.pen=pen
end end
function scene.touchDown(_,x,y) function scene.touchDown(_,x,y)
scene.mouseMove(x,y) scene.mouseMove(x,y)
end end
function scene.touchMove(_,x,y) function scene.touchMove(_,x,y)
local S=sceneTemp
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=nil end if sx<1 or sx>10 then sx=nil end
if sy<1 or sy>20 then sy=nil end if sy<1 or sy>20 then sy=nil end
S.x,S.y=sx,sy px,py=sx,sy
if sx and sy then if sx and sy then
FIELD[S.page][sy][sx]=S.pen FIELD[page][sy][sx]=pen
end end
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp local sx,sy=px,py
local sx,sy,pen=S.x,S.y,S.pen
if key=="up"or key=="down"or key=="left"or key=="right"then if key=="up"or key=="down"or key=="left"or key=="right"then
if not sx then sx=1 end if not sx then sx=1 end
if not sy then sy=1 end if not sy then sy=1 end
@@ -74,30 +73,30 @@ function scene.keyDown(key)
elseif key=="right"and sx<10 then sx=sx+1 elseif key=="right"and sx<10 then sx=sx+1
end end
if kb.isDown("space")then if kb.isDown("space")then
FIELD[S.page][sy][sx]=pen FIELD[page][sy][sx]=pen
end end
elseif key=="delete"then elseif key=="delete"then
if S.sure>20 then if sure>20 then
for y=1,20 do for x=1,10 do FIELD[S.page][y][x]=0 end end for y=1,20 do for x=1,10 do FIELD[page][y][x]=0 end end
S.sure=0 sure=0
SFX.play("finesseError",.7) SFX.play("finesseError",.7)
else else
S.sure=50 sure=50
end end
elseif key=="space"then elseif key=="space"then
if sx and sy then if sx and sy then
FIELD[S.page][sy][sx]=pen FIELD[page][sy][sx]=pen
end end
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
elseif key=="j"then elseif key=="j"then
S.demo=not S.demo demo=not demo
elseif key=="k"then elseif key=="k"then
ins(FIELD[S.page],1,{21,21,21,21,21,21,21,21,21,21}) ins(FIELD[page],1,{21,21,21,21,21,21,21,21,21,21})
FIELD[S.page][21]=nil FIELD[page][21]=nil
SFX.play("blip") SFX.play("blip")
elseif key=="l"then elseif key=="l"then
local F=FIELD[S.page] local F=FIELD[page]
for i=20,1,-1 do for i=20,1,-1 do
for j=1,10 do for j=1,10 do
if F[i][j]<=0 then goto L end if F[i][j]<=0 then goto L end
@@ -115,31 +114,31 @@ function scene.keyDown(key)
SFX.play("fall",.8) SFX.play("fall",.8)
end end
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
sys.setClipboardText("Techmino Field:"..copyBoard(S.page)) sys.setClipboardText("Techmino Field:"..copyBoard(page))
LOG.print(text.exportSuccess,COLOR.green) LOG.print(text.exportSuccess,COLOR.green)
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
local str=sys.getClipboardText() local str=sys.getClipboardText()
local p=string.find(str,":")--ptr* local p=string.find(str,":")--ptr*
if p then str=sub(str,p+1)end if p then str=sub(str,p+1)end
if pasteBoard(str,S.page)then if pasteBoard(str,page)then
LOG.print(text.importSuccess,COLOR.green) LOG.print(text.importSuccess,COLOR.green)
else else
LOG.print(text.dataCorrupted,COLOR.red) LOG.print(text.dataCorrupted,COLOR.red)
end end
elseif key=="tab"or key=="sTab"then elseif key=="tab"or key=="sTab"then
if key=="sTab"or kb.isDown("lshift","rshift")then if key=="sTab"or kb.isDown("lshift","rshift")then
S.page=max(S.page-1,1) page=max(page-1,1)
else else
S.page=min(S.page+1,#FIELD) page=min(page+1,#FIELD)
end end
elseif key=="n"then elseif key=="n"then
ins(FIELD,S.page+1,newBoard(FIELD[S.page])) ins(FIELD,page+1,newBoard(FIELD[page]))
S.page=S.page+1 page=page+1
SFX.play("blip_1",.8) SFX.play("blip_1",.8)
SYSFX.newShade(3,200,60,300,600,.5,1,.5) SYSFX.newShade(3,200,60,300,600,.5,1,.5)
elseif key=="m"then elseif key=="m"then
rem(FIELD,S.page) rem(FIELD,page)
S.page=max(S.page-1,1) page=max(page-1,1)
if not FIELD[1]then if not FIELD[1]then
ins(FIELD,newBoard()) ins(FIELD,newBoard())
end end
@@ -149,16 +148,15 @@ function scene.keyDown(key)
else else
pen=penKey[key]or pen pen=penKey[key]or pen
end end
S.x,S.y,S.pen=sx,sy,pen px,py,pen=sx,sy,pen
end end
function scene.update() function scene.update()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end if sure>0 then sure=sure-1 end
end end
function scene.draw() function scene.draw()
local S=sceneTemp local sx,sy=px,py
local sx,sy=S.x,S.y
gc.translate(200,60) gc.translate(200,60)
@@ -174,32 +172,45 @@ function scene.draw()
gc.rectangle("line",-2,-2,304,604) gc.rectangle("line",-2,-2,304,604)
gc.setLineWidth(2) gc.setLineWidth(2)
local cross=puzzleMark[-1] local cross=puzzleMark[-1]
local F=FIELD[S.page] local F=FIELD[page]
local texture=SKIN.curText local texture=SKIN.curText
for y=1,20 do for x=1,10 do for y=1,20 do for x=1,10 do
local B=F[y][x] local B=F[y][x]
if B>0 then if B>0 then
gc.draw(texture[B],30*x-30,600-30*y) gc.draw(texture[B],30*x-30,600-30*y)
elseif B==-1 and not S.demo then elseif B==-1 and not demo then
gc.draw(cross,30*x-30,600-30*y) gc.draw(cross,30*x-30,600-30*y)
end end
end end end end
--Draw pen --Draw pen
if sx and sy then if sx and sy then
gc.setLineWidth(2) local x,y=30*sx,600-30*sy
gc.rectangle("line",30*sx-30,600-30*sy,30,30) if kb.isDown("space")or ms.isDown(1)then
gc.setLineWidth(5)
gc.rectangle("line",x-30,y,30,30,4)
elseif ms.isDown(3)then
gc.setLineWidth(3)
gc.line(x-15,y,x-30,y+15)
gc.line(x,y,x-30,y+30)
gc.line(x,y+15,x-15,y+30)
else
gc.setLineWidth(2)
gc.rectangle("line",x-30,y,30,30,3)
gc.setColor(1,1,1,.2)
gc.rectangle("fill",x-30,y,30,30,3)
gc.setColor(1,1,1)
end
end end
gc.translate(-200,-60) gc.translate(-200,-60)
--Draw page --Draw page
setFont(55) setFont(55)
mStr(S.page,100,530) mStr(page,100,530)
mStr(#FIELD,100,600) mStr(#FIELD,100,600)
gc.rectangle("fill",50,600,100,6) gc.rectangle("fill",50,600,100,6)
--Draw pen color --Draw pen color
local pen=S.pen
if pen>0 then if pen>0 then
gc.setLineWidth(13) gc.setLineWidth(13)
gc.setColor(SKIN.libColor[pen]) gc.setColor(SKIN.libColor[pen])
@@ -212,8 +223,8 @@ function scene.draw()
end end
--Confirm reset --Confirm reset
if S.sure>0 then if sure>0 then
gc.setColor(1,1,1,S.sure*.02) gc.setColor(1,1,1,sure*.02)
gc.draw(drawableText.question,1145,330) gc.draw(drawableText.question,1145,330)
end end
@@ -231,7 +242,7 @@ function scene.draw()
end end
end end
local function setPen(i)return function()sceneTemp.pen=i end end local function setPen(i)return function()pen=i end end
scene.widgetList={ scene.widgetList={
WIDGET.newText{name="title", x=1020,y=5,font=70,align="R"}, WIDGET.newText{name="title", x=1020,y=5,font=70,align="R"},
WIDGET.newText{name="subTitle", x=1030,y=50,font=35,align="L",color="grey"}, WIDGET.newText{name="subTitle", x=1030,y=50,font=35,align="L",color="grey"},
@@ -271,12 +282,12 @@ scene.widgetList={
WIDGET.newButton{name="copy", x=730, y=530,w=120,color="lRed", font=35,code=WIDGET.lnk_pressKey("cC")}, WIDGET.newButton{name="copy", x=730, y=530,w=120,color="lRed", font=35,code=WIDGET.lnk_pressKey("cC")},
WIDGET.newButton{name="paste", x=860, y=530,w=120,color="lBlue", font=35,code=WIDGET.lnk_pressKey("cV")}, WIDGET.newButton{name="paste", x=860, y=530,w=120,color="lBlue", font=35,code=WIDGET.lnk_pressKey("cV")},
WIDGET.newButton{name="clear", x=990, y=530,w=120,color="white", font=40,code=WIDGET.lnk_pressKey("delete")}, WIDGET.newButton{name="clear", x=990, y=530,w=120,color="white", font=40,code=WIDGET.lnk_pressKey("delete")},
WIDGET.newSwitch{name="demo", x=755, y=640,disp=WIDGET.lnk_STPval("demo"),code=WIDGET.lnk_STPrev("demo")}, WIDGET.newSwitch{name="demo", x=755, y=640,disp=function()return demo end,code=function()demo=not demo end},
WIDGET.newButton{name="newPage", x=100, y=110,w=160,h=110,color="sky",font=20,code=WIDGET.lnk_pressKey("n")}, WIDGET.newButton{name="newPage", x=100, y=110,w=160,h=110,color="sky",font=20,code=WIDGET.lnk_pressKey("n")},
WIDGET.newButton{name="delPage", x=100, y=230,w=160,h=110,color="lRed",font=20,code=WIDGET.lnk_pressKey("m")}, WIDGET.newButton{name="delPage", x=100, y=230,w=160,h=110,color="lRed",font=20,code=WIDGET.lnk_pressKey("m")},
WIDGET.newButton{name="prevPage", x=100, y=350,w=160,h=110,color="lGreen",font=20,code=WIDGET.lnk_pressKey("sTab"),hide=WIDGET.lnk_STPeq("page",1)}, WIDGET.newButton{name="prevPage", x=100, y=350,w=160,h=110,color="lGreen",font=20,code=WIDGET.lnk_pressKey("sTab"),hide=function()return page==1 end},
WIDGET.newButton{name="nextPage", x=100, y=470,w=160,h=110,color="lGreen",font=20,code=WIDGET.lnk_pressKey("tab"),hide=function()return sceneTemp.page==#FIELD end}, WIDGET.newButton{name="nextPage", x=100, y=470,w=160,h=110,color="lGreen",font=20,code=WIDGET.lnk_pressKey("tab"),hide=function()return page==#FIELD end},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -8,68 +8,69 @@ local sub=string.sub
local scene={} local scene={}
local input--Input buffer
local cur--Cursor position
local sure
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ input=""
input="", cur=#MISSION
cur=#MISSION, sure=0
sure=0,
}
end end
local missionEnum=missionEnum local missionEnum=missionEnum
local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true} local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true}
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
local MISSION=MISSION local MISSION=MISSION
if key=="left"then if key=="left"then
local p=S.cur local p=cur
if p==0 then if p==0 then
S.cur=#MISSION cur=#MISSION
else else
repeat repeat
p=p-1 p=p-1
until MISSION[p]~=MISSION[S.cur] until MISSION[p]~=MISSION[cur]
S.cur=p cur=p
end end
elseif key=="right"then elseif key=="right"then
local p=S.cur local p=cur
if p==#MISSION then if p==#MISSION then
S.cur=0 cur=0
else else
repeat repeat
p=p+1 p=p+1
until MISSION[p+1]~=MISSION[S.cur+1] until MISSION[p+1]~=MISSION[cur+1]
S.cur=p cur=p
end end
elseif key=="ten"then elseif key=="ten"then
for _=1,10 do for _=1,10 do
local p=S.cur local p=cur
if p==#MISSION then break end if p==#MISSION then break end
repeat repeat
p=p+1 p=p+1
until MISSION[p+1]~=MISSION[S.cur+1] until MISSION[p+1]~=MISSION[cur+1]
S.cur=p cur=p
end end
elseif key=="backspace"then elseif key=="backspace"then
if #S.input>0 then if #input>0 then
S.input="" input=""
elseif S.cur>0 then elseif cur>0 then
rem(MISSION,S.cur) rem(MISSION,cur)
S.cur=S.cur-1 cur=cur-1
if S.cur>0 and MISSION[S.cur]==MISSION[S.cur+1]then if cur>0 and MISSION[cur]==MISSION[cur+1]then
scene.keyDown("right") scene.keyDown("right")
end end
end end
elseif key=="delete"then elseif key=="delete"then
if S.sure>20 then if sure>20 then
for _=1,#MISSION do for _=1,#MISSION do
rem(MISSION) rem(MISSION)
end end
S.cur=0 cur=0
S.sure=0 sure=0
SFX.play("finesseError",.7) SFX.play("finesseError",.7)
else else
S.sure=50 sure=50
end end
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
if #MISSION>0 then if #MISSION>0 then
@@ -82,16 +83,17 @@ function scene.keyDown(key)
if p then str=sub(str,p+1)end if p then str=sub(str,p+1)end
if pasteMission(str)then if pasteMission(str)then
LOG.print(text.importSuccess,COLOR.green) LOG.print(text.importSuccess,COLOR.green)
cur=#MISSION
else else
LOG.print(text.dataCorrupted,COLOR.red) LOG.print(text.dataCorrupted,COLOR.red)
end end
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
elseif type(key)=="number"then elseif type(key)=="number"then
local p=S.cur+1 local p=cur+1
while MISSION[p]==key do p=p+1 end while MISSION[p]==key do p=p+1 end
ins(MISSION,p,key) ins(MISSION,p,key)
S.cur=p cur=p
else else
if key=="space"then if key=="space"then
key="_" key="_"
@@ -99,27 +101,23 @@ function scene.keyDown(key)
key=string.upper(key) key=string.upper(key)
end end
local input=S.input
input=input..key input=input..key
if missionEnum[input]then if missionEnum[input]then
S.cur=S.cur+1 cur=cur+1
ins(MISSION,S.cur,missionEnum[input]) ins(MISSION,cur,missionEnum[input])
SFX.play("lock") SFX.play("lock")
input="" input=""
elseif #input>1 or not legalInput[input]then elseif #input>1 or not legalInput[input]then
input="" input=""
end end
S.input=input
end end
end end
function scene.update() function scene.update()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end if sure>0 then sure=sure-1 end
end end
function scene.draw() function scene.draw()
local S=sceneTemp
--Draw frame --Draw frame
gc.setLineWidth(4) gc.setLineWidth(4)
gc.setColor(1,1,1) gc.setColor(1,1,1)
@@ -128,7 +126,7 @@ function scene.draw()
--Draw inputing target --Draw inputing target
setFont(30) setFont(30)
gc.setColor(.9,.9,.9) gc.setColor(.9,.9,.9)
gc.print(S.input,1200,275) gc.print(input,1200,275)
--Draw targets --Draw targets
local libColor=SKIN.libColor local libColor=SKIN.libColor
@@ -149,7 +147,7 @@ function scene.draw()
gc.print(count,x+5,y-13) gc.print(count,x+5,y-13)
x=x+(count<10 and 33 or 45) x=x+(count<10 and 33 or 45)
count=1 count=1
if i==S.cur+1 then if i==cur+1 then
cx,cy=x,y cx,cy=x,y
end end
end end
@@ -170,7 +168,7 @@ function scene.draw()
x=x+56 x=x+56
end end
end end
if i==S.cur then if i==cur then
cx,cy=x,y cx,cy=x,y
end end
i=i+1 i=i+1
@@ -181,8 +179,8 @@ function scene.draw()
gc.line(cx-5,cy-20,cx-5,cy+20) gc.line(cx-5,cy-20,cx-5,cy+20)
--Confirm reset --Confirm reset
if S.sure>0 then if sure>0 then
gc.setColor(1,1,1,S.sure*.02) gc.setColor(1,1,1,sure*.02)
gc.draw(drawableText.question,980,570) gc.draw(drawableText.question,980,570)
end end
end end

View File

@@ -8,8 +8,12 @@ local sub=string.sub
local scene={} local scene={}
local cur--Cursor position
local sure
function scene.sceneInit() function scene.sceneInit()
sceneTemp={cur=#BAG,sure=0} cur=#BAG
sure=0
end end
local minoKey={ local minoKey={
@@ -23,55 +27,53 @@ local minoKey2={
z=8,s=9,t=14,j=19,l=20,i=25 z=8,s=9,t=14,j=19,l=20,i=25
} }
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
local BAG=BAG
if key=="left"then if key=="left"then
local p=S.cur local p=cur
if p==0 then if p==0 then
S.cur=#BAG cur=#BAG
else else
repeat repeat
p=p-1 p=p-1
until BAG[p]~=BAG[S.cur] until BAG[p]~=BAG[cur]
S.cur=p cur=p
end end
elseif key=="right"then elseif key=="right"then
local p=S.cur local p=cur
if p==#BAG then if p==#BAG then
S.cur=0 cur=0
else else
repeat repeat
p=p+1 p=p+1
until BAG[p+1]~=BAG[S.cur+1] until BAG[p+1]~=BAG[cur+1]
S.cur=p cur=p
end end
elseif key=="ten"then elseif key=="ten"then
for _=1,10 do for _=1,10 do
local p=S.cur local p=cur
if p==#BAG then break end if p==#BAG then break end
repeat repeat
p=p+1 p=p+1
until BAG[p+1]~=BAG[S.cur+1] until BAG[p+1]~=BAG[cur+1]
S.cur=p cur=p
end end
elseif key=="backspace"then elseif key=="backspace"then
if S.cur>0 then if cur>0 then
rem(BAG,S.cur) rem(BAG,cur)
S.cur=S.cur-1 cur=cur-1
if S.cur>0 and BAG[S.cur]==BAG[S.cur+1]then if cur>0 and BAG[cur]==BAG[cur+1]then
scene.keyDown("right") scene.keyDown("right")
end end
end end
elseif key=="delete"then elseif key=="delete"then
if S.sure>20 then if sure>20 then
for _=1,#BAG do for _=1,#BAG do
rem(BAG) rem(BAG)
end end
S.cur=0 cur=0
S.sure=0 sure=0
SFX.play("finesseError",.7) SFX.play("finesseError",.7)
else else
S.sure=50 sure=50
end end
elseif key=="tab"then elseif key=="tab"then
local W=WIDGET.active.sequence local W=WIDGET.active.sequence
@@ -91,33 +93,32 @@ function scene.keyDown(key)
if p then str=sub(str,p+1)end if p then str=sub(str,p+1)end
if pasteSequence(str)then if pasteSequence(str)then
LOG.print(text.importSuccess,COLOR.green) LOG.print(text.importSuccess,COLOR.green)
cur=#BAG
else else
LOG.print(text.dataCorrupted,COLOR.red) LOG.print(text.dataCorrupted,COLOR.red)
end end
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
elseif type(key)=="number"then elseif type(key)=="number"then
S.cur=S.cur+1 cur=cur+1
ins(BAG,S.cur,key) ins(BAG,cur,key)
elseif #key==1 then elseif #key==1 then
key=(kb.isDown("lshift","lalt","rshift","ralt")and minoKey2 or minoKey)[key] key=(kb.isDown("lshift","lalt","rshift","ralt")and minoKey2 or minoKey)[key]
if key then if key then
local p=S.cur+1 local p=cur+1
while BAG[p]==key do p=p+1 end while BAG[p]==key do p=p+1 end
ins(BAG,p,key) ins(BAG,p,key)
S.cur=p cur=p
SFX.play("lock") SFX.play("lock")
end end
end end
end end
function scene.update() function scene.update()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end if sure>0 then sure=sure-1 end
end end
function scene.draw() function scene.draw()
local S=sceneTemp
--Draw frame --Draw frame
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.setLineWidth(4) gc.setLineWidth(4)
@@ -143,7 +144,7 @@ function scene.draw()
gc.print(count,x+10,y-13) gc.print(count,x+10,y-13)
x=x+(count<10 and 33 or 45) x=x+(count<10 and 33 or 45)
count=1 count=1
if i==S.cur+1 then if i==cur+1 then
cx,cy=x,y cx,cy=x,y
end end
end end
@@ -158,7 +159,7 @@ function scene.draw()
end end
end end
if i==S.cur then if i==cur then
cx,cy=x,y cx,cy=x,y
end end
i=i+1 i=i+1
@@ -174,8 +175,8 @@ function scene.draw()
gc.line(cx-5,cy-20,cx-5,cy+20) gc.line(cx-5,cy-20,cx-5,cy+20)
--Confirm reset --Confirm reset
if S.sure>0 then if sure>0 then
gc.setColor(1,1,1,S.sure*.02) gc.setColor(1,1,1,sure*.02)
gc.draw(drawableText.question,980,570) gc.draw(drawableText.question,980,570)
end end
end end

View File

@@ -8,40 +8,42 @@ local find,sub=string.find,string.sub
local scene={} local scene={}
local dict--Dict list
local input--Input string
local result--Result Lable
local url
local waiting--Searching animation timer
local selected--Selected option
local scrollPos--Scroll down length
local lastSearch--Last searched string
function scene.sceneInit() function scene.sceneInit()
local location=({"zh","zh","en","en","en","en","zh"})[SETTING.lang]
sceneTemp={
dict=require("parts/language/dict_"..location),
input="",
result={},
url=nil,
waiting=0,
select=1,
scroll=0,
lastSearch=false,
}
local S=sceneTemp
S.url=(S.result[1]and S.result or S.dict)[S.select][5]
BG.set("rainbow") BG.set("rainbow")
local location=({"zh","zh","en","en","en","en","zh"})[SETTING.lang]
dict=require("parts/language/dict_"..location)
input=""
result={}
url=dict[1][5]
waiting=0
selected=1
scrollPos=0
lastSearch=false
end end
local function clearResult() local function clearResult()
local S=sceneTemp
local result=S.result
for _=1,#result do rem(result)end for _=1,#result do rem(result)end
S.select,S.scroll,S.waiting,S.lastSearch=1,0,0,false selected,scrollPos,waiting,lastSearch=1,0,0,false
end end
local function search() local function search()
clearResult() clearResult()
local S=sceneTemp
local dict=S.dict
local result=S.result
local first local first
for i=1,#dict do for i=1,#dict do
local pos=find(dict[i][2],S.input,nil,true) local pos=find(dict[i][2],input,nil,true)
if pos==1 and not first then if pos==1 and not first then
ins(result,1,dict[i]) ins(result,1,dict[i])
first=true first=true
@@ -52,63 +54,61 @@ local function search()
if result[1]then if result[1]then
SFX.play("reach") SFX.play("reach")
end end
S.url=(S.result[1]and S.result or S.dict)[S.select][5] url=(result[1]and result or dict)[selected][5]
S.lastSearch=S.input lastSearch=input
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
if #key==1 then if #key==1 then
if #S.input<15 then if #input<15 then
S.input=S.input..key input=input..key
S.waiting=.8 waiting=.8
end end
elseif key=="up"then elseif key=="up"then
if S.select and S.select>1 then if selected and selected>1 then
S.select=S.select-1 selected=selected-1
if S.select<S.scroll+1 then if selected<scrollPos+1 then
S.scroll=S.scroll-1 scrollPos=scrollPos-1
end end
end end
elseif key=="down"then elseif key=="down"then
if S.select and S.select<#(S.result[1]and S.result or S.dict)then if selected and selected<#(result[1]and result or dict)then
S.select=S.select+1 selected=selected+1
if S.select>S.scroll+15 then if selected>scrollPos+15 then
S.scroll=S.select-15 scrollPos=selected-15
end end
end end
elseif key=="link"then elseif key=="link"then
love.system.openURL(S.url) love.system.openURL(url)
elseif key=="delete"then elseif key=="delete"then
if #S.input>0 then if #input>0 then
clearResult() clearResult()
S.input="" input=""
SFX.play("hold") SFX.play("hold")
end end
elseif key=="backspace"then elseif key=="backspace"then
S.input=sub(S.input,1,-2) input=sub(input,1,-2)
if #S.input==0 then if #input==0 then
clearResult() clearResult()
else else
S.waiting=.8 waiting=.8
end end
elseif key=="escape"then elseif key=="escape"then
if #S.input>0 then if #input>0 then
clearResult() clearResult()
S.input="" input=""
else else
SCN.back() SCN.back()
end end
end end
S.url=(S.result[1]and S.result or S.dict)[S.select][5] url=(result[1]and result or dict)[selected][5]
end end
function scene.update(dt) function scene.update(dt)
local S=sceneTemp if waiting>0 then
if S.waiting>0 then waiting=waiting-dt
S.waiting=S.waiting-dt if waiting<=0 then
if S.waiting<=0 then if #input>0 and input~=lastSearch then
if #S.input>0 and S.input~=S.lastSearch then
search() search()
end end
end end
@@ -124,17 +124,16 @@ local typeColor={
name=COLOR.lPurple, name=COLOR.lPurple,
} }
function scene.draw() function scene.draw()
local S=sceneTemp
gc.setLineWidth(4) gc.setLineWidth(4)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.rectangle("line",20,110,726,60) gc.rectangle("line",20,110,726,60)
setFont(40) setFont(40)
gc.print(S.input,35,110) gc.print(input,35,110)
local list=S.result[1]and S.result or S.dict local list=result[1]and result or dict
gc.setColor(1,1,1) gc.setColor(1,1,1)
local text=list[S.select][4] local text=list[selected][4]
if #text>900 then if #text>900 then
setFont(15) setFont(15)
elseif #text>600 then elseif #text>600 then
@@ -148,12 +147,12 @@ function scene.draw()
setFont(30) setFont(30)
gc.setColor(1,1,1,.4+.2*sin(Timer()*4)) gc.setColor(1,1,1,.4+.2*sin(Timer()*4))
gc.rectangle("fill",20,143+35*(S.select-S.scroll),280,35) gc.rectangle("fill",20,143+35*(selected-scrollPos),280,35)
setFont(30) setFont(30)
for i=1,min(#list,15)do for i=1,min(#list,15)do
local y=142+35*i local y=142+35*i
i=i+S.scroll i=i+scrollPos
local item=list[i] local item=list[i]
gc.setColor(0,0,0) gc.setColor(0,0,0)
gc.print(item[1],29,y-1) gc.print(item[1],29,y-1)
@@ -168,7 +167,7 @@ function scene.draw()
gc.rectangle("line",300,180,958,526) gc.rectangle("line",300,180,958,526)
gc.rectangle("line",20,180,280,526) gc.rectangle("line",20,180,280,526)
if S.waiting>0 then if waiting>0 then
local r=Timer()*2 local r=Timer()*2
local R=int(r)%7+1 local R=int(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1)) gc.setColor(1,1,1,1-abs(r%1*2-1))
@@ -179,7 +178,7 @@ end
scene.widgetList={ scene.widgetList={
WIDGET.newText{name="title", x=20, y=5,font=70,align="L"}, WIDGET.newText{name="title", x=20, y=5,font=70,align="L"},
WIDGET.newKey{name="keyboard", x=960, y=60,w=200,h=80,font=35,code=function()love.keyboard.setTextInput(true,0,0,1,1)end,hide=not MOBILE}, WIDGET.newKey{name="keyboard", x=960, y=60,w=200,h=80,font=35,code=function()love.keyboard.setTextInput(true,0,0,1,1)end,hide=not MOBILE},
WIDGET.newKey{name="link", x=1140, y=650,w=200,h=80,font=35,code=WIDGET.lnk_pressKey("link"),hide=function()return not sceneTemp.url end}, WIDGET.newKey{name="link", x=1140, y=650,w=200,h=80,font=35,code=WIDGET.lnk_pressKey("link"),hide=function()return not url end},
WIDGET.newKey{name="up", x=1190, y=440,w=100,h=100,font=35,code=WIDGET.lnk_pressKey("up"),hide=not MOBILE}, WIDGET.newKey{name="up", x=1190, y=440,w=100,h=100,font=35,code=WIDGET.lnk_pressKey("up"),hide=not MOBILE},
WIDGET.newKey{name="down", x=1190, y=550,w=100,h=100,font=35,code=WIDGET.lnk_pressKey("down"),hide=not MOBILE}, WIDGET.newKey{name="down", x=1190, y=550,w=100,h=100,font=35,code=WIDGET.lnk_pressKey("down"),hide=not MOBILE},
WIDGET.newButton{name="back", x=1165, y=60,w=170,h=80,font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1165, y=60,w=170,h=80,font=40,code=WIDGET.lnk_BACK},

View File

@@ -3,15 +3,16 @@ local max,min=math.max,math.min
local scene={} local scene={}
local texts--Text list
local scrollPos--Scroll down length
function scene.sceneInit() function scene.sceneInit()
BG.set("rainbow") BG.set("rainbow")
sceneTemp={ texts=require"parts/updateLog"
text=require"parts/updateLog",--Text list scrollPos=1
pos=1,--Scroll pos
}
if newVersionLaunch then if newVersionLaunch then
newVersionLaunch=nil newVersionLaunch=nil
sceneTemp.pos=3 scrollPos=3
end end
end end
@@ -20,9 +21,9 @@ function scene.wheelMoved(_,y)
end end
function scene.keyDown(key) function scene.keyDown(key)
if key=="up"then if key=="up"then
sceneTemp.pos=max(sceneTemp.pos-1,1) scrollPos=max(scrollPos-1,1)
elseif key=="down"then elseif key=="down"then
sceneTemp.pos=min(sceneTemp.pos+1,#sceneTemp.text) scrollPos=min(scrollPos+1,#texts)
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
end end
@@ -35,13 +36,12 @@ function scene.draw()
gc.setLineWidth(4) gc.setLineWidth(4)
gc.rectangle("line",30,45,1000,632) gc.rectangle("line",30,45,1000,632)
setFont(20) setFont(20)
local S=sceneTemp gc.print(texts[scrollPos],40,50)
gc.print(S.text[S.pos],40,50)
end end
scene.widgetList={ scene.widgetList={
WIDGET.newKey{name="prev", x=1155, y=170,w=180,font=65,code=WIDGET.lnk_pressKey("up"),hide=WIDGET.lnk_STPeq("pos",1)}, WIDGET.newKey{name="prev", x=1155, y=170,w=180,font=65,code=WIDGET.lnk_pressKey("up"),hide=function()return scrollPos==1 end},
WIDGET.newKey{name="next", x=1155, y=400,w=180,font=65,code=WIDGET.lnk_pressKey("down"),hide=function()return sceneTemp.pos==#sceneTemp.text end}, WIDGET.newKey{name="next", x=1155, y=400,w=180,font=65,code=WIDGET.lnk_pressKey("down"),hide=function()return scrollPos==#texts end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -7,17 +7,14 @@ local rnd=math.random
local scene={} local scene={}
local t1,t2,r
function scene.sceneInit() function scene.sceneInit()
BG.set("space") BG.set("space")
BGM.play("blank") BGM.play("blank")
sceneTemp={ t1,t2=0,0--Timer
t1=0,--Timer 1 r={}--Random animation type
t2=0,--Timer 2 for i=1,8 do r[i]=rnd(5)end
r={},--Random animation type
}
for i=1,8 do
sceneTemp.r[i]=rnd(5)
end
end end
function scene.mouseDown(_,_,k) function scene.mouseDown(_,_,k)
@@ -49,9 +46,8 @@ function scene.keyDown(key)
end end
function scene.update() function scene.update()
local S=sceneTemp t1=t1+1
S.t1=S.t1+1 t2=t2+1
S.t2=S.t2+1
end end
local titleTransform={ local titleTransform={
@@ -74,8 +70,7 @@ local titleTransform={
end, end,
} }
function scene.draw() function scene.draw()
local S=sceneTemp local T=(t1+110)%300
local T=(S.t1+110)%300
if T<30 then if T<30 then
gc.setLineWidth(4+(30-T)^1.626/62) gc.setLineWidth(4+(30-T)^1.626/62)
else else
@@ -85,12 +80,12 @@ function scene.draw()
gc.push("transform") gc.push("transform")
gc.translate(126,226) gc.translate(126,226)
for i=1,8 do for i=1,8 do
local t=S.t1-i*15 local t=t1-i*15
if t>0 then if t>0 then
gc.push("transform") gc.push("transform")
gc.setColor(1,1,1,min(t*.025,1)) gc.setColor(1,1,1,min(t*.025,1))
titleTransform[S.r[i]](t,i) titleTransform[r[i]](t,i)
local dt=(S.t1+62-5*i)%300 local dt=(t1+62-5*i)%300
if dt<20 then if dt<20 then
gc.translate(0,abs(10-dt)-10) gc.translate(0,abs(10-dt)-10)
end end
@@ -99,8 +94,8 @@ function scene.draw()
end end
end end
gc.pop() gc.pop()
if S.t2>=80 then if t2>=80 then
gc.setColor(1,1,1,.6+sin((S.t2-80)*.0626)*.3) gc.setColor(1,1,1,.6+sin((t2-80)*.0626)*.3)
mText(drawableText.anykey,640,615+sin(Timer()*3)*5) mText(drawableText.anykey,640,615+sin(Timer()*3)*5)
end end
end end

View File

@@ -69,27 +69,32 @@ end
local scene={} local scene={}
function scene.sceneInit() local time--Animation timer
sceneTemp={ local phase--Loading stage
time=0,--Animation timer local cur--Loading timer
phase=0,--Loading stage local tar--Current Loading bar length
cur=0,--Loading timer local stageLenth
tar=0,--Current Loading bar length local text
list={ local skip
VOC.getCount(),
BGM.getCount(),
SFX.getCount(),
IMG.getCount(),
17,--Fontsize 20~100
SKIN.getCount(),
#MODES,
1,
1,
},
skip=false,--If skipped
text=gc.newText(getFont(80),"26F Studio"), function scene.sceneInit()
time=0
phase=0
cur=0
tar=0
stageLenth={
VOC.getCount(),
BGM.getCount(),
SFX.getCount(),
IMG.getCount(),
17,--Fontsize 20~100
SKIN.getCount(),
#MODES,
1,
1,
} }
text=gc.newText(getFont(80),"26F Studio")
skip=false--If skipped
end end
function scene.sceneBack() function scene.sceneBack()
love.event.quit() love.event.quit()
@@ -97,49 +102,48 @@ end
function scene.keyDown(k) function scene.keyDown(k)
if k=="a"then if k=="a"then
sceneTemp.skip=true skip=true
elseif k=="s"then elseif k=="s"then
sceneTemp.skip,MARKING=true skip,MARKING=true
elseif k=="space"then elseif k=="space"then
sceneTemp.time=max(sceneTemp.time-5,0) time=max(time-5,0)
elseif k=="escape"then elseif k=="escape"then
SCN.back() SCN.back()
end end
end end
function scene.touchDown() function scene.touchDown()
if #tc.getTouches()==2 then if #tc.getTouches()==2 then
sceneTemp.skip=true skip=true
end end
end end
function scene.update() function scene.update()
local S=sceneTemp if time==400 then return end
if S.time==400 then return end
repeat repeat
if S.phase==0 then if phase==0 then
elseif S.phase==1 then elseif phase==1 then
VOC.loadOne() VOC.loadOne()
elseif S.phase==2 then elseif phase==2 then
BGM.loadOne() BGM.loadOne()
elseif S.phase==3 then elseif phase==3 then
SFX.loadOne() SFX.loadOne()
elseif S.phase==4 then elseif phase==4 then
IMG.loadOne() IMG.loadOne()
elseif S.phase==5 then elseif phase==5 then
getFont(15+5*S.cur) getFont(15+5*cur)
elseif S.phase==6 then elseif phase==6 then
SKIN.loadOne() SKIN.loadOne()
elseif S.phase==7 then elseif phase==7 then
local m=MODES[S.cur]--Mode template local m=MODES[cur]--Mode template
local M=require("parts/modes/"..m.name)--Mode file local M=require("parts/modes/"..m.name)--Mode file
MODES[m.name],MODES[S.cur]=M MODES[m.name],MODES[cur]=M
for k,v in next,m do for k,v in next,m do
M[k]=v M[k]=v
end end
M.records=FILE.load(m.name)or M.score and{} M.records=FILE.load(m.name)or M.score and{}
-- M.icon=gc.newImage("media/image/modeIcon/"..m.icon..".png") -- M.icon=gc.newImage("media/image/modeIcon/"..m.icon..".png")
-- M.icon=gc.newImage("media/image/modeIcon/custom.png") -- M.icon=gc.newImage("media/image/modeIcon/custom.png")
elseif S.phase==8 then elseif phase==8 then
local function C(x,y) local function C(x,y)
local _=gc.newCanvas(x,y) local _=gc.newCanvas(x,y)
gc.setCanvas(_) gc.setCanvas(_)
@@ -165,11 +169,11 @@ function scene.update()
gc.line(5,5,25,25) gc.line(5,5,25,25)
gc.line(5,25,25,5) gc.line(5,25,25,5)
puzzleMark[-1]=C(30,30) puzzleMark[-1]=C(30,30)
gc.setColor(1,1,1,.9) gc.setColor(1,1,1,.8)
gc.draw(_) gc.draw(_)
_:release() _:release()
gc.setCanvas() gc.setCanvas()
elseif S.phase==9 then elseif phase==9 then
SKIN.change(SETTING.skinSet) SKIN.change(SETTING.skinSet)
STAT.run=STAT.run+1 STAT.run=STAT.run+1
LOADED=true LOADED=true
@@ -189,33 +193,31 @@ function scene.update()
) )
end end
end end
if S.tar then if tar then
S.cur=S.cur+1 cur=cur+1
if S.cur>S.tar then if cur>tar then
S.phase=S.phase+1 phase=phase+1
S.cur=1 cur=1
S.tar=S.list[S.phase] tar=stageLenth[phase]
end end
end end
S.time=S.time+1 time=time+1
if S.time==400 then if time==400 then
SCN.swapTo("intro") SCN.swapTo("intro")
return return
end end
until not S.skip until not skip
end end
function scene.draw() function scene.draw()
local S=sceneTemp
gc.push("transform") gc.push("transform")
gc.translate(640,360) gc.translate(640,360)
gc.scale(2) gc.scale(2)
local Y=3250*(sin(-1.5708+min(S.time,260)/260*3.1416)+1)+200 local Y=3250*(sin(-1.5708+min(time,260)/260*3.1416)+1)+200
--Draw 26F Studio logo --Draw 26F Studio logo
if S.time>200 then if time>200 then
gc.push("transform") gc.push("transform")
gc.translate(-220,Y-6840) gc.translate(-220,Y-6840)
@@ -224,21 +226,21 @@ function scene.draw()
local T=Timer() local T=Timer()
gc.setColor(COLOR.dCyan) gc.setColor(COLOR.dCyan)
mDraw(S.text,220,Y*.2-1204) mDraw(text,220,Y*.2-1204)
mDraw(S.text,220,-Y*.2+1476) mDraw(text,220,-Y*.2+1476)
gc.setColor(COLOR.cyan) gc.setColor(COLOR.cyan)
mDraw(S.text,220+4*sin(T*10),136+4*sin(T*6)) mDraw(text,220+4*sin(T*10),136+4*sin(T*6))
mDraw(S.text,220+4*sin(T*12),136+4*sin(T*8)) mDraw(text,220+4*sin(T*12),136+4*sin(T*8))
gc.setColor(COLOR.dCyan) gc.setColor(COLOR.dCyan)
mDraw(S.text,219,137) mDraw(text,219,137)
mDraw(S.text,219,135) mDraw(text,219,135)
mDraw(S.text,221,137) mDraw(text,221,137)
mDraw(S.text,221,135) mDraw(text,221,135)
gc.setColor(.2,.2,.2) gc.setColor(.2,.2,.2)
mDraw(S.text,220,136) mDraw(text,220,136)
gc.pop() gc.pop()
end end

View File

@@ -41,10 +41,10 @@ end
local scene={} local scene={}
local tip
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ tip=text.getTip()
tip=text.getTip(),
}
BG.set("space") BG.set("space")
GAME.modeEnv=NONE GAME.modeEnv=NONE
@@ -70,7 +70,7 @@ function scene.draw()
setFont(30) setFont(30)
gc.print(SYSTEM,610,50) gc.print(SYSTEM,610,50)
gc.print(VERSION_NAME,610,90) gc.print(VERSION_NAME,610,90)
gc.print(sceneTemp.tip,50,660) gc.print(tip,50,660)
local L=text.modes[STAT.lastPlay] local L=text.modes[STAT.lastPlay]
setFont(25) setFont(25)
gc.print(L[1],700,390) gc.print(L[1],700,390)

View File

@@ -9,56 +9,67 @@ local format=string.format
local scene={} local scene={}
local board
local cx,cy
local startTime
local time
local move
local state
local color
local blind
local slide
local pathVis
local revKB
function scene.sceneInit() function scene.sceneInit()
BG.set("rainbow") BG.set("rainbow")
BGM.play("push") BGM.play("push")
sceneTemp={ board={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}
board={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}, cx,cy=4,4
x=4,y=4, startTime=0
startTime=0, time=0
time=0, move=0
move=0, state=2
state=2,
color=0, color=0
blind=false, blind=false
slide=true, slide=true
pathVis=true, pathVis=true
revKB=false, revKB=false
}
end end
local function moveU(S,b,x,y) local function moveU(x,y)
if y<4 then if y<4 then
b[y][x],b[y+1][x]=b[y+1][x],b[y][x] board[y][x],board[y+1][x]=board[y+1][x],board[y][x]
S.y=y+1 cy=cy+1
end end
end end
local function moveD(S,b,x,y) local function moveD(x,y)
if y>1 then if y>1 then
b[y][x],b[y-1][x]=b[y-1][x],b[y][x] board[y][x],board[y-1][x]=board[y-1][x],board[y][x]
S.y=y-1 cy=cy-1
end end
end end
local function moveL(S,b,x,y) local function moveL(x,y)
if x<4 then if x<4 then
b[y][x],b[y][x+1]=b[y][x+1],b[y][x] board[y][x],board[y][x+1]=board[y][x+1],board[y][x]
S.x=x+1 cx=cx+1
end end
end end
local function moveR(S,b,x,y) local function moveR(x,y)
if x>1 then if x>1 then
b[y][x],b[y][x-1]=b[y][x-1],b[y][x] board[y][x],board[y][x-1]=board[y][x-1],board[y][x]
S.x=x-1 cx=cx-1
end end
end end
local function shuffleBoard(S,b) local function shuffleBoard()
for i=1,300 do for i=1,300 do
i=rnd() i=rnd()
if i<.25 then moveU(S,b,S.x,S.y) if i<.25 then moveU(cx,cy)
elseif i<.5 then moveD(S,b,S.x,S.y) elseif i<.5 then moveD(cx,cy)
elseif i<.75 then moveL(S,b,S.x,S.y) elseif i<.75 then moveL(cx,cy)
else moveR(S,b,S.x,S.y) else moveR(cx,cy)
end end
end end
end end
@@ -71,105 +82,103 @@ local function checkBoard(b)
return true return true
end end
local function tapBoard(x,y,key) local function tapBoard(x,y,key)
local S=sceneTemp if state<2 then
if S.state<2 then
if not key then if not key then
if S.pathVis then if pathVis then
SYSFX.newRipple(6,x,y,10) SYSFX.newRipple(6,x,y,10)
end end
x,y=int((x-320)/160)+1,int((y-40)/160)+1 x,y=int((x-320)/160)+1,int((y-40)/160)+1
end end
local b=S.board local b=board
local moves=0 local moves=0
if S.x==x then if cx==x then
if y>S.y and y<5 then if y>cy and y<5 then
for i=S.y,y-1 do for i=cy,y-1 do
moveU(S,b,x,i) moveU(x,i)
moves=moves+1 moves=moves+1
end end
elseif y<S.y and y>0 then elseif y<cy and y>0 then
for i=S.y,y+1,-1 do for i=cy,y+1,-1 do
moveD(S,b,x,i) moveD(x,i)
moves=moves+1 moves=moves+1
end end
end end
elseif S.y==y then elseif cy==y then
if x>S.x and x<5 then if x>cx and x<5 then
for i=S.x,x-1 do for i=cx,x-1 do
moveL(S,b,i,y) moveL(i,y)
moves=moves+1 moves=moves+1
end end
elseif x<S.x and x>0 then elseif x<cx and x>0 then
for i=S.x,x+1,-1 do for i=cx,x+1,-1 do
moveR(S,b,i,y) moveR(i,y)
moves=moves+1 moves=moves+1
end end
end end
end end
if moves>0 then if moves>0 then
S.move=S.move+moves move=move+moves
if S.state==0 then if state==0 then
S.state=1 state=1
S.startTime=Timer() startTime=Timer()
end end
if checkBoard(b)then if checkBoard(b)then
S.state=2 state=2
S.time=Timer()-S.startTime time=Timer()-startTime
if S.time<1 then LOG.print("不是人",COLOR.lBlue) if time<1 then LOG.print("不是人",COLOR.lBlue)
elseif S.time<2 then LOG.print("还是人",COLOR.lBlue) elseif time<2 then LOG.print("还是人",COLOR.lBlue)
elseif S.time<3 then LOG.print("神仙",COLOR.lBlue) elseif time<3 then LOG.print("神仙",COLOR.lBlue)
elseif S.time<5 then LOG.print("太强了",COLOR.lBlue) elseif time<5 then LOG.print("太强了",COLOR.lBlue)
elseif S.time<7.5 then LOG.print("很强",COLOR.lBlue) elseif time<7.5 then LOG.print("很强",COLOR.lBlue)
elseif S.time<10 then LOG.print("可以的",COLOR.lBlue) elseif time<10 then LOG.print("可以的",COLOR.lBlue)
elseif S.time<20 then LOG.print("马上入门了",COLOR.lBlue) elseif time<20 then LOG.print("马上入门了",COLOR.lBlue)
elseif S.time<30 then LOG.print("入门不远了",COLOR.lBlue) elseif time<30 then LOG.print("入门不远了",COLOR.lBlue)
elseif S.time<60 then LOG.print("多加练习",COLOR.lBlue) elseif time<60 then LOG.print("多加练习",COLOR.lBlue)
else LOG.print("第一次玩?加油",COLOR.lBlue) else LOG.print("第一次玩?加油",COLOR.lBlue)
end end
SFX.play("win") SFX.play("win")
return
end end
SFX.play("move") SFX.play("move")
end end
end end
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
local b=S.board
if key=="up"then if key=="up"then
tapBoard(S.x,S.y-(S.revKB and 1 or -1),true) tapBoard(cx,cy-(revKB and 1 or -1),true)
elseif key=="down"then elseif key=="down"then
tapBoard(S.x,S.y+(S.revKB and 1 or -1),true) tapBoard(cx,cy+(revKB and 1 or -1),true)
elseif key=="left"then elseif key=="left"then
tapBoard(S.x-(S.revKB and 1 or -1),S.y,true) tapBoard(cx-(revKB and 1 or -1),cy,true)
elseif key=="right"then elseif key=="right"then
tapBoard(S.x+(S.revKB and 1 or -1),S.y,true) tapBoard(cx+(revKB and 1 or -1),cy,true)
elseif key=="space"then elseif key=="space"then
shuffleBoard(S,b) shuffleBoard()
S.state=0 state=0
S.time=0 time=0
S.move=0 move=0
elseif key=="q"then elseif key=="q"then
if S.state~=1 then if state~=1 then
S.color=(S.color+1)%5 color=(color+1)%5
end end
elseif key=="w"then elseif key=="w"then
if S.state==0 then if state==0 then
S.blind=not S.blind blind=not blind
end end
elseif key=="e"then elseif key=="e"then
if S.state==0 then if state==0 then
S.slide=not S.slide slide=not slide
if not S.slide then if not slide then
S.pathVis=false pathVis=false
end end
end end
elseif key=="r"then elseif key=="r"then
if S.state==0 and S.slide then if state==0 and slide then
S.pathVis=not S.pathVis pathVis=not pathVis
end end
elseif key=="t"then elseif key=="t"then
if S.state==0 then if state==0 then
S.revKB=not S.revKB revKB=not revKB
end end
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
@@ -179,7 +188,7 @@ function scene.mouseDown(x,y)
tapBoard(x,y) tapBoard(x,y)
end end
function scene.mouseMove(x,y) function scene.mouseMove(x,y)
if sceneTemp.slide then if slide then
tapBoard(x,y) tapBoard(x,y)
end end
end end
@@ -187,15 +196,14 @@ function scene.touchDown(_,x,y)
tapBoard(x,y) tapBoard(x,y)
end end
function scene.touchMove(_,x,y) function scene.touchMove(_,x,y)
if sceneTemp.slide then if slide then
tapBoard(x,y) tapBoard(x,y)
end end
end end
function scene.update() function scene.update()
local S=sceneTemp if state==1 then
if S.state==1 then time=Timer()-startTime
S.time=Timer()-S.startTime
end end
end end
@@ -264,37 +272,34 @@ local backColor={
},--Black },--Black
} }
function scene.draw() function scene.draw()
local S=sceneTemp
setFont(40) setFont(40)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.print(format("%.3f",S.time),1026,80) gc.print(format("%.3f",time),1026,80)
gc.print(S.move,1026,150) gc.print(move,1026,150)
if S.state==2 then if state==2 then
--Draw no-setting area --Draw no-setting area
gc.setColor(1,0,0,.3) gc.setColor(1,0,0,.3)
gc.rectangle("fill",15,295,285,340) gc.rectangle("fill",15,295,285,340)
gc.setColor(.9,.9,0)--win gc.setColor(.9,.9,0)--win
elseif S.state==1 then elseif state==1 then
gc.setColor(.9,.9,.9)--game gc.setColor(.9,.9,.9)--game
elseif S.state==0 then elseif state==0 then
gc.setColor(.2,.8,.2)--ready gc.setColor(.2,.8,.2)--ready
end end
gc.setLineWidth(10) gc.setLineWidth(10)
gc.rectangle("line",313,33,654,654,18) gc.rectangle("line",313,33,654,654,18)
gc.setLineWidth(4) gc.setLineWidth(4)
local x,y=S.x,S.y local mono=blind and state==1
local blind=S.blind and S.state==1
setFont(80) setFont(80)
for i=1,4 do for i=1,4 do
for j=1,4 do for j=1,4 do
if x~=j or y~=i then if cx~=j or cy~=i then
local N=S.board[i][j] local N=board[i][j]
local C=blind and 1 or S.color local C=mono and 1 or color
local back=backColor[C] local back=backColor[C]
local front=frontColor[C] local front=frontColor[C]
@@ -302,7 +307,7 @@ function scene.draw()
gc.rectangle("fill",j*160+163,i*160-117,154,154,8) gc.rectangle("fill",j*160+163,i*160-117,154,154,8)
gc.setColor(front[N]) gc.setColor(front[N])
gc.rectangle("line",j*160+163,i*160-117,154,154,8) gc.rectangle("line",j*160+163,i*160-117,154,154,8)
if not blind then if not mono then
gc.setColor(.1,.1,.1) gc.setColor(.1,.1,.1)
mStr(N,j*160+240,i*160-96) mStr(N,j*160+240,i*160-96)
mStr(N,j*160+242,i*160-98) mStr(N,j*160+242,i*160-98)
@@ -314,16 +319,17 @@ function scene.draw()
end end
gc.setColor(0,0,0,.3) gc.setColor(0,0,0,.3)
gc.setLineWidth(10) gc.setLineWidth(10)
gc.rectangle("line",x*160+173,y*160-107,134,134,50) gc.rectangle("line",cx*160+173,cy*160-107,134,134,50)
end end
local function Gaming()return state==1 end
scene.widgetList={ scene.widgetList={
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")}, WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")},
WIDGET.newSlider{name="color", x=110,y=250,w=170,unit=4,show=false,font=30,disp=WIDGET.lnk_STPval("color"), code=function(v)if sceneTemp.state~=1 then sceneTemp.color=v end end,hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSlider{name="color", x=110,y=250,w=170,unit=4,show=false,font=30,disp=function()return color end, code=function(v)if state~=1 then color=v end end,hide=Gaming},
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=WIDGET.lnk_STPval("blind"), code=WIDGET.lnk_pressKey("w"), hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=function()return blind end, code=WIDGET.lnk_pressKey("w"), hide=Gaming},
WIDGET.newSwitch{name="slide", x=240,y=420,w=60, font=40,disp=WIDGET.lnk_STPval("slide"), code=WIDGET.lnk_pressKey("e"), hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSwitch{name="slide", x=240,y=420,w=60, font=40,disp=function()return slide end, code=WIDGET.lnk_pressKey("e"), hide=Gaming},
WIDGET.newSwitch{name="pathVis",x=240,y=510,w=60, font=40,disp=WIDGET.lnk_STPval("pathVis"), code=WIDGET.lnk_pressKey("r"), hide=function()return sceneTemp.state==1 or not sceneTemp.slide end}, WIDGET.newSwitch{name="pathVis",x=240,y=510,w=60, font=40,disp=function()return pathVis end, code=WIDGET.lnk_pressKey("r"), hide=function()return state==1 or not slide end},
WIDGET.newSwitch{name="revKB", x=240,y=600,w=60, font=40,disp=WIDGET.lnk_STPval("revKB"), code=WIDGET.lnk_pressKey("t"), hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSwitch{name="revKB", x=240,y=600,w=60, font=40,disp=function()return revKB end, code=WIDGET.lnk_pressKey("t"), hide=Gaming},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -27,19 +27,26 @@ local levels={
local scene={} local scene={}
local levelName
local targetString
local progress
local frameKeyCount
local mistake
local startTime
local time
local state
function scene.sceneInit() function scene.sceneInit()
BG.set("bg2") BG.set("bg2")
BGM.play("way") BGM.play("way")
sceneTemp={ levelName="A_Z"
level="A_Z", targetString=levels.A_Z
target=levels.A_Z, progress=1
count=1, frameKeyCount=0
frameKeyCount=0, mistake=0
error=0, startTime=0
startTime=0, time=0
time=0, state=0
state=0,
}
love.keyboard.setKeyRepeat(false) love.keyboard.setKeyRepeat(false)
end end
function scene.sceneBack() function scene.sceneBack()
@@ -47,79 +54,75 @@ function scene.sceneBack()
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
if #key==1 then if #key==1 then
if S.state<2 and S.frameKeyCount<3 then if state<2 and frameKeyCount<3 then
if key:upper():byte()==S.target:byte(S.count)then if key:upper():byte()==targetString:byte(progress)then
S.count=S.count+1 progress=progress+1
S.frameKeyCount=S.frameKeyCount+1 frameKeyCount=frameKeyCount+1
TEXT.show(key:upper(),rnd(320,960),rnd(100,240),90,"score",2.6) TEXT.show(key:upper(),rnd(320,960),rnd(100,240),90,"score",2.6)
SFX.play("move") SFX.play("move")
if S.count==2 then if progress==2 then
S.state=1 state=1
S.startTime=Timer() startTime=Timer()
elseif S.count>#S.target then elseif progress>#targetString then
S.time=Timer()-S.startTime time=Timer()-startTime
S.state=2 state=2
SFX.play("reach") SFX.play("reach")
end end
elseif S.count>1 then elseif progress>1 then
S.error=S.error+1 mistake=mistake+1
SFX.play("finesseError") SFX.play("finesseError")
end end
end end
elseif key=="space"then elseif key=="space"then
S.count=1 progress=1
S.error=0 mistake=0
S.time=0 time=0
S.state=0 state=0
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
end end
end end
function scene.update() function scene.update()
local S=sceneTemp if state==1 then
if S.state==1 then frameKeyCount=0
S.frameKeyCount=0 time=Timer()-startTime
S.time=Timer()-S.startTime
end end
end end
function scene.draw() function scene.draw()
local S=sceneTemp
setFont(40) setFont(40)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.print(format("%.3f",S.time),1026,80) gc.print(format("%.3f",time),1026,80)
gc.print(S.error,1026,150) gc.print(mistake,1026,150)
if S.state>0 then if state>0 then
gc.print(format("%.3f/s",(S.count-1)/S.time),1026,220) gc.print(format("%.3f/s",(progress-1)/time),1026,220)
end end
if S.state==2 then if state==2 then
gc.setColor(.9,.9,0)--win gc.setColor(.9,.9,0)--win
elseif S.state==1 then elseif state==1 then
gc.setColor(.9,.9,.9)--game gc.setColor(.9,.9,.9)--game
elseif S.state==0 then elseif state==0 then
gc.setColor(.2,.8,.2)--ready gc.setColor(.2,.8,.2)--ready
end end
setFont(100) 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) mStr(state==1 and #targetString-progress+1 or state==0 and"Ready"or state==2 and"Win",640,200)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.print(S.target:sub(S.count,S.count),120,280,0,2) gc.print(targetString:sub(progress,progress),120,280,0,2)
gc.print(S.target:sub(S.count+1),310,380) gc.print(targetString:sub(progress+1),310,380)
gc.setColor(1,1,1,.7) gc.setColor(1,1,1,.7)
setFont(40) setFont(40)
gc.print(S.target,120,520) gc.print(targetString,120,520)
end end
scene.widgetList={ scene.widgetList={
WIDGET.newSelector{name="level", x=640,y=640,w=200,list={"A_Z","Z_A","Tech1","Tech2","KeyTest1","KeyTest2","Hello","Roll1","Roll2","Roll3","ZZZ","ZXZX","ZMZM","Stair","Stair2","Stair3","BPW"},disp=WIDGET.lnk_STPval("level"),code=function(i)sceneTemp.level=i;sceneTemp.target=levels[i]end,hide=function()return sceneTemp.state>0 end}, WIDGET.newSelector{name="level", x=640,y=640,w=200,list={"A_Z","Z_A","Tech1","Tech2","KeyTest1","KeyTest2","Hello","Roll1","Roll2","Roll3","ZZZ","ZXZX","ZMZM","Stair","Stair2","Stair3","BPW"},disp=function()return levelName end,code=function(i)levelName=i;targetString=levels[i]end,hide=function()return 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="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")},
WIDGET.newButton{name="keyboard", x=160,y=210,w=180,h=100,code=function()love.keyboard.setTextInput(true,0,select(2,SCR.xOy:transformPoint(0,500)),1,1)end,hide=not MOBILE}, WIDGET.newButton{name="keyboard", x=160,y=210,w=180,h=100,code=function()love.keyboard.setTextInput(true,0,select(2,SCR.xOy:transformPoint(0,500)),1,1)end,hide=not MOBILE},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},

View File

@@ -7,75 +7,71 @@ local rnd=math.random
local scene={} local scene={}
local bx,by=640,360--Ball posotion
local vx,vy=0,0--Ball velocity
local ry=0--Rotation Y
local p1,p2--Player data
function scene.sceneInit() function scene.sceneInit()
BG.set("none") BG.set("none")
BGM.play("way") BGM.play("way")
sceneTemp={ state=0
state=0,
x=640,y=360, bx,by=640,360
vx=0,vy=0, vx,vy=0,0
ry=0, ry=0
p1={ p1={
score=0, score=0,
y=360, y=360,
vy=0, vy=0,
y0=false, y0=false,
}, }
p2={ p2={
score=0, score=0,
y=360, y=360,
vy=0, vy=0,
y0=false, y0=false,
},
} }
end end
local function start() local function start()
sceneTemp.state=1 state=1
sceneTemp.vx=rnd()>.5 and 6 or -6 vx=rnd()>.5 and 6 or -6
sceneTemp.vy=rnd()*6-3 vy=rnd()*6-3
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
if key=="space"then if key=="space"then
if S.state==0 then if state==0 then
start() start()
end end
elseif key=="r"then elseif key=="r"then
S.state=0 state=0
S.x,S.y=640,360 bx,by=640,360
S.vx,S.vy=0,0 vx,vy=0,0
S.ry=0 ry=0
S.p1.score,S.p2.score=0,0 p1.score,p2.score=0,0
SFX.play("hold")
elseif key=="w"or key=="s"then elseif key=="w"or key=="s"then
S.p1.y0=false p1.y0=false
elseif key=="up"or key=="down"then elseif key=="up"or key=="down"then
S.p2.y0=false p2.y0=false
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
end end
end end
function scene.touchDown(id,x,y) function scene.touchDown(id,x,y)
scene.touchMove(id,x,y) scene.touchMove(id,x,y)
if sceneTemp.state==0 then if state==0 then start()end
start()
end
end
function scene.touchMove(_,x,y)
sceneTemp[x<640 and"p1"or"p2"].y0=y
end
function scene.mouseMove(x,y)
sceneTemp[x<640 and"p1"or"p2"].y0=y
end end
function scene.touchMove(_,x,y)(x<640 and p1 or p2).y0=y end
function scene.mouseMove(x,y)(x<640 and p1 or p2).y0=y end
--Rect Area X:150~1130 Y:20~700 --Rect Area X:150~1130 Y:20~700
function scene.update() function scene.update()
local S=sceneTemp
--Update pads --Update pads
local P=S.p1 local P=p1
while P do while P do
if P.y0 then if P.y0 then
if P.y>P.y0 then if P.y>P.y0 then
@@ -88,8 +84,8 @@ function scene.update()
P.vy=P.vy*.5 P.vy=P.vy*.5
end end
else else
if kb.isDown(P==S.p1 and"w"or"up")then P.vy=max(P.vy-1,-8)end if kb.isDown(P==p1 and"w"or"up")then P.vy=max(P.vy-1,-8)end
if kb.isDown(P==S.p1 and"s"or"down")then P.vy=min(P.vy+1,8)end if kb.isDown(P==p1 and"s"or"down")then P.vy=min(P.vy+1,8)end
P.y=P.y+P.vy P.y=P.y+P.vy
P.vy=P.vy*.9 P.vy=P.vy*.9
if P.y>650 then if P.y>650 then
@@ -100,12 +96,11 @@ function scene.update()
P.y=70 P.y=70
end end
end end
P=P==S.p1 and S.p2 P=P==p1 and p2
end end
--Update ball --Update ball
local x,y,vx,vy,ry=S.x,S.y,S.vx,S.vy,S.ry bx,by=bx+vx,by+vy
x,y=x+vx,y+vy
if ry~=0 then if ry~=0 then
if ry>0 then if ry>0 then
ry=max(ry-.1,0) ry=max(ry-.1,0)
@@ -115,47 +110,45 @@ function scene.update()
vy=vy+.1 vy=vy+.1
end end
end end
if S.state==1 then--Playing if state==1 then--Playing
if x<160 or x>1120 then if bx<160 or bx>1120 then
P=x<160 and S.p1 or S.p2 P=bx<160 and p1 or p2
local d=y-P.y local d=by-P.y
if abs(d)<60 then if abs(d)<60 then
vx=-vx-(vx>0 and .05 or -.5) vx=-vx-(vx>0 and .05 or -.5)
vy=vy+d*.08+P.vy*.5 vy=vy+d*.08+P.vy*.5
ry=P.vy ry=P.vy
SFX.play("collect") SFX.play("collect")
else else
S.state=2 state=2
end end
end end
if y<30 or y>690 then if by<30 or by>690 then
y=y<30 and 30 or 690 by=by<30 and 30 or 690
vy,ry=-vy,-ry vy,ry=-vy,-ry
SFX.play("collect") SFX.play("collect")
end end
elseif S.state==2 then--Game over elseif state==2 then--Game over
if x<-120 or x>1400 or y<-40 or y>760 then if bx<-120 or bx>1400 or by<-40 or by>760 then
P=x>640 and S.p1 or S.p2 P=bx>640 and p1 or p2
P.score=P.score+1 P.score=P.score+1
TEXT.show("+1",x>1400 and 470 or 810,226,50,"score") TEXT.show("+1",bx>1400 and 470 or 810,226,50,"score")
SFX.play("reach") SFX.play("reach")
S.state=0 state=0
x,y=640,360 bx,by=640,360
vx,vy=0,0 vx,vy=0,0
end end
end end
S.x,S.y,S.vx,S.vy,S.ry=x,y,vx,vy,ry bx,by,vx,vy,ry=bx,by,vx,vy,ry
end end
function scene.draw() function scene.draw()
local S=sceneTemp
--Draw score --Draw score
setFont(100) setFont(100)
gc.setColor(.4,.4,.4) gc.setColor(.4,.4,.4)
mStr(S.p1.score,470,20) mStr(p1.score,470,20)
mStr(S.p2.score,810,20) mStr(p2.score,810,20)
--Draw boundary --Draw boundary
gc.setColor(1,1,1) gc.setColor(1,1,1)
@@ -164,16 +157,16 @@ function scene.draw()
gc.line(130,700,1160,700) gc.line(130,700,1160,700)
--Draw ball & speed line --Draw ball & speed line
gc.setColor(1,1,1-abs(S.ry)*.16) gc.setColor(1,1,1-abs(ry)*.16)
gc.circle("fill",S.x,S.y,10) gc.circle("fill",bx,by,10)
gc.setColor(1,1,1,.1) gc.setColor(1,1,1,.1)
gc.line(S.x+S.vx*22,S.y+S.vy*22,S.x+S.vx*30,S.y+S.vy*30) gc.line(bx+vx*22,by+vy*22,bx+vx*30,by+vy*30)
--Draw pads --Draw pads
gc.setColor(1,.8,.8) gc.setColor(1,.8,.8)
gc.rectangle("fill",130,S.p1.y-50,20,100) gc.rectangle("fill",130,p1.y-50,20,100)
gc.setColor(.8,.8,1) gc.setColor(.8,.8,1)
gc.rectangle("fill",1130,S.p2.y-50,20,100) gc.rectangle("fill",1130,p2.y-50,20,100)
end end
scene.widgetList={ scene.widgetList={

View File

@@ -12,61 +12,67 @@ local rem=table.remove
local scene={} local scene={}
local board
local rank
local blind
local disappear
local tapFX
local startTime
local time
local mistake
local state
local progress
function scene.sceneInit() function scene.sceneInit()
BGM.play("way") BGM.play("way")
sceneTemp={ board={}
board={}, rank=3
rank=3, blind=false
blind=false, disappear=false
disappear=false, tapFX=true
tapFX=true,
startTime=0, startTime=0
time=0, time=0
error=0, mistake=0
state=0, state=0
progress=0, progress=0
}
end end
local function newBoard() local function newBoard()
local S=sceneTemp
local L={} local L={}
for i=1,S.rank^2 do for i=1,rank^2 do
L[i]=i L[i]=i
end end
for i=1,S.rank^2 do for i=1,rank^2 do
S.board[i]=rem(L,rnd(#L)) board[i]=rem(L,rnd(#L))
end end
end end
local function tapBoard(x,y) local function tapBoard(x,y)
local S=sceneTemp local R=rank
local R=S.rank
if x>320 and x<960 and y>40 and y<680 then if x>320 and x<960 and y>40 and y<680 then
if S.state==0 then if state==0 then
newBoard() newBoard()
S.state=1 state=1
S.startTime=Timer() startTime=Timer()
S.progress=0 progress=0
elseif S.state==1 then elseif state==1 then
local X=int((x-320)/640*R) local X=int((x-320)/640*R)
local Y=int((y-40)/640*R) local Y=int((y-40)/640*R)
x=R*Y+X+1 x=R*Y+X+1
if S.board[x]==S.progress+1 then if board[x]==progress+1 then
S.progress=S.progress+1 progress=progress+1
if S.progress<R^2 then if progress<R^2 then
SFX.play("lock") SFX.play("lock")
else else
S.time=Timer()-S.startTime+S.error time=Timer()-startTime+mistake
S.state=2 state=2
SFX.play("reach") SFX.play("reach")
end end
if S.tapFX then if tapFX then
SYSFX.newShade(3,320+640/R*X,40+640/R*Y,640/R,640/R,.6,.8,1) SYSFX.newShade(3,320+640/R*X,40+640/R*Y,640/R,640/R,.6,.8,1)
end end
else else
S.error=S.error+1 mistake=mistake+1
if S.tapFX then if tapFX then
SYSFX.newShade(2,320+640/R*X,40+640/R*Y,640/R,640/R,1,.4,.5) SYSFX.newShade(2,320+640/R*X,40+640/R*Y,640/R,640/R,1,.4,.5)
end end
SFX.play("finesseError") SFX.play("finesseError")
@@ -82,32 +88,31 @@ function scene.touchDown(_,x,y)
tapBoard(x,y) tapBoard(x,y)
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
if key=="z"or key=="x"then if key=="z"or key=="x"then
love.mousepressed(ms.getPosition()) love.mousepressed(ms.getPosition())
elseif key=="space"then elseif key=="space"then
if sceneTemp.state>0 then if state>0 then
S.board={} board={}
S.time=0 time=0
S.error=0 mistake=0
S.state=0 state=0
S.progress=0 progress=0
end end
elseif key=="q"then elseif key=="q"then
if S.state==0 then if state==0 then
S.blind=not S.blind blind=not blind
end end
elseif key=="w"then elseif key=="w"then
if S.state==0 then if state==0 then
S.disappear=not S.disappear disappear=not disappear
end end
elseif key=="e"then elseif key=="e"then
if S.state==0 then if state==0 then
S.tapFX=not S.tapFX tapFX=not tapFX
end end
elseif key=="3"or key=="4"or key=="5"or key=="6"then elseif key=="3"or key=="4"or key=="5"or key=="6"then
if S.state==0 then if state==0 then
S.rank=tonumber(key) rank=tonumber(key)
end end
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
@@ -115,52 +120,48 @@ function scene.keyDown(key)
end end
function scene.update() function scene.update()
local S=sceneTemp if state==1 then
if S.state==1 then time=Timer()-startTime+mistake
S.time=Timer()-S.startTime+S.error
end end
end end
function scene.draw() function scene.draw()
local S=sceneTemp
setFont(40) setFont(40)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.print(format("%.3f",S.time),1026,80) gc.print(format("%.3f",time),1026,80)
gc.print(S.error,1026,150) gc.print(mistake,1026,150)
setFont(70) setFont(70)
mStr(S.state==1 and S.progress or S.state==0 and"Ready"or S.state==2 and"Win",1130,300) mStr(state==1 and progress or state==0 and"Ready"or state==2 and"Win",1130,300)
if S.state==2 then if state==2 then
--Draw no-setting area --Draw no-setting area
gc.setColor(1,0,0,.3) gc.setColor(1,0,0,.3)
gc.rectangle("fill",15,295,285,250) gc.rectangle("fill",15,295,285,250)
gc.setColor(.9,.9,0)--win gc.setColor(.9,.9,0)--win
elseif S.state==1 then elseif state==1 then
gc.setColor(.9,.9,.9)--game gc.setColor(.9,.9,.9)--game
elseif S.state==0 then elseif state==0 then
gc.setColor(.2,.8,.2)--ready gc.setColor(.2,.8,.2)--ready
end end
gc.setLineWidth(10) gc.setLineWidth(10)
gc.rectangle("line",310,30,660,660) gc.rectangle("line",310,30,660,660)
local rank=S.rank
local width=640/rank local width=640/rank
local blind=S.state==0 or S.blind and S.state==1 and S.progress>0 local mono=state==0 or blind and state==1 and progress>0
gc.setLineWidth(4) gc.setLineWidth(4)
local f=180-rank*20 local f=180-rank*20
setFont(f) setFont(f)
for i=1,rank do for i=1,rank do
for j=1,rank do for j=1,rank do
local N=S.board[rank*(i-1)+j] local N=board[rank*(i-1)+j]
if not(S.state==1 and S.disappear and N<=S.progress)then if not(state==1 and disappear and N<=progress)then
gc.setColor(.4,.5,.6) gc.setColor(.4,.5,.6)
gc.rectangle("fill",320+(j-1)*width,(i-1)*width+40,width,width) gc.rectangle("fill",320+(j-1)*width,(i-1)*width+40,width,width)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.rectangle("line",320+(j-1)*width,(i-1)*width+40,width,width) gc.rectangle("line",320+(j-1)*width,(i-1)*width+40,width,width)
if not blind then if not mono then
local x,y=320+(j-.5)*width,40+(i-.5)*width-f*.67 local x,y=320+(j-.5)*width,40+(i-.5)*width-f*.67
gc.setColor(.1,.1,.1) gc.setColor(.1,.1,.1)
mStr(N,x-3,y-1) mStr(N,x-3,y-1)
@@ -174,11 +175,11 @@ function scene.draw()
end end
scene.widgetList={ scene.widgetList={
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space"),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"),hide=function()return state==0 end},
WIDGET.newSlider{name="rank", x=130,y=250,w=150,unit=3,show=false,font=40,disp=function()return sceneTemp.rank-3 end,code=function(v)sceneTemp.rank=v+3 end,hide=function()return sceneTemp.state>0 end}, WIDGET.newSlider{name="rank", x=130,y=250,w=150,unit=3,show=false,font=40,disp=function()return rank-3 end,code=function(v)rank=v+3 end,hide=function()return state>0 end},
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=WIDGET.lnk_STPval("blind"), code=WIDGET.lnk_pressKey("q"),hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=function()return blind end, code=WIDGET.lnk_pressKey("q"),hide=function()return state==1 end},
WIDGET.newSwitch{name="disappear", x=240,y=420,w=60, font=40,disp=WIDGET.lnk_STPval("disappear"),code=WIDGET.lnk_pressKey("w"),hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSwitch{name="disappear", x=240,y=420,w=60, font=40,disp=function()return disappear end,code=WIDGET.lnk_pressKey("w"),hide=function()return state==1 end},
WIDGET.newSwitch{name="tapFX", x=240,y=510,w=60, font=40,disp=WIDGET.lnk_STPval("tapFX"), code=WIDGET.lnk_pressKey("e"),hide=WIDGET.lnk_STPeq("state",1)}, WIDGET.newSwitch{name="tapFX", x=240,y=510,w=60, font=40,disp=function()return tapFX end, code=WIDGET.lnk_pressKey("e"),hide=function()return state==1 end},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -41,18 +41,18 @@ end
local scene={} local scene={}
local selected--Mod selected
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ selected=nil
sel=nil,--selected mod name
}
BG.set("tunnel") BG.set("tunnel")
end end
function scene.mouseMove(x,y) function scene.mouseMove(x,y)
sceneTemp.sel=nil selected=nil
for N,M in next,MODOPT do for N,M in next,MODOPT do
if(x-M.x)^2+(y-M.y)^2<2000 then if(x-M.x)^2+(y-M.y)^2<2000 then
sceneTemp.sel=N selected=N
break break
end end
end end
@@ -84,7 +84,7 @@ function scene.keyDown(key)
for N,M in next,MODOPT do for N,M in next,MODOPT do
if key==M.key then if key==M.key then
toggleMod(M,kb.isDown("lshift","rshift")) toggleMod(M,kb.isDown("lshift","rshift"))
sceneTemp.sel=N selected=N
break break
end end
end end
@@ -144,9 +144,9 @@ function scene.draw()
end end
gc.setColor(1,1,1) gc.setColor(1,1,1)
if sceneTemp.sel then if selected then
setFont(30) setFont(30)
gc.printf(text.modInfo[sceneTemp.sel],70,540,950) gc.printf(text.modInfo[selected],70,540,950)
else else
setFont(25) setFont(25)
gc.printf(text.modInstruction,70,540,950) gc.printf(text.modInstruction,70,540,950)

View File

@@ -5,17 +5,19 @@ local sin=math.sin
local scene={} local scene={}
local selected--Music selected
local bgmList=BGM.getList() local bgmList=BGM.getList()
function scene.sceneInit() function scene.sceneInit()
if BGM.nowPlay then if BGM.nowPlay then
for i=1,BGM.getCount()do for i=1,BGM.getCount()do
if bgmList[i]==BGM.nowPlay then if bgmList[i]==BGM.nowPlay then
sceneTemp=i--Music selected selected=i
return return
end end
end end
else else
sceneTemp=1 selected=1
end end
end end
@@ -23,15 +25,15 @@ function scene.wheelMoved(_,y)
wheelScroll(y) wheelScroll(y)
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp local S=selected
if key=="down"then if key=="down"then
if S<BGM.getCount()then if S<BGM.getCount()then
sceneTemp=S+1 selected=S+1
SFX.play("move",.7) SFX.play("move",.7)
end end
elseif key=="up"then elseif key=="up"then
if S>1 then if S>1 then
sceneTemp=S-1 selected=S-1
SFX.play("move",.7) SFX.play("move",.7)
end end
elseif key=="return"or key=="space"then elseif key=="return"or key=="space"then
@@ -50,13 +52,13 @@ function scene.draw()
gc.setColor(1,1,1) gc.setColor(1,1,1)
setFont(50) setFont(50)
gc.print(bgmList[sceneTemp],320,355) gc.print(bgmList[selected],320,355)
setFont(35) setFont(35)
if sceneTemp>1 then gc.print(bgmList[sceneTemp-1],320,350-30)end if selected>1 then gc.print(bgmList[selected-1],320,350-30)end
if sceneTemp<BGM.getCount()then gc.print(bgmList[sceneTemp+1],320,350+65)end if selected<BGM.getCount()then gc.print(bgmList[selected+1],320,350+65)end
setFont(20) setFont(20)
if sceneTemp>2 then gc.print(bgmList[sceneTemp-2],320,350-50)end if selected>2 then gc.print(bgmList[selected-2],320,350-50)end
if sceneTemp<BGM.getCount()-1 then gc.print(bgmList[sceneTemp+2],320,350+110)end if selected<BGM.getCount()-1 then gc.print(bgmList[selected+2],320,350+110)end
gc.draw(IMG.title,840,220,nil,1.5,nil,206,35) gc.draw(IMG.title,840,220,nil,1.5,nil,206,35)
if BGM.nowPlay then if BGM.nowPlay then
@@ -77,9 +79,9 @@ scene.widgetList={
WIDGET.newText{name="arrow", x=270, y=360,font=45,align="L"}, WIDGET.newText{name="arrow", x=270, y=360,font=45,align="L"},
WIDGET.newText{name="now", x=700, y=500,font=50,align="R",hide=function()return not BGM.nowPlay end}, WIDGET.newText{name="now", x=700, y=500,font=50,align="R",hide=function()return not BGM.nowPlay end},
WIDGET.newSlider{name="bgm", x=760, y=80,w=400, font=35,disp=WIDGET.lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end}, WIDGET.newSlider{name="bgm", x=760, y=80,w=400, font=35,disp=WIDGET.lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
WIDGET.newButton{name="up", x=200, y=250,w=120, font=55,code=WIDGET.lnk_pressKey("up"),hide=function()return sceneTemp==1 end}, WIDGET.newButton{name="up", x=200, y=250,w=120, font=55,code=WIDGET.lnk_pressKey("up"),hide=function()return selected==1 end},
WIDGET.newButton{name="play", x=200, y=390,w=120, font=35,code=WIDGET.lnk_pressKey("space")}, WIDGET.newButton{name="play", x=200, y=390,w=120, font=35,code=WIDGET.lnk_pressKey("space")},
WIDGET.newButton{name="down", x=200, y=530,w=120, font=55,code=WIDGET.lnk_pressKey("down"),hide=function()return sceneTemp==BGM.getCount()end}, WIDGET.newButton{name="down", x=200, y=530,w=120, font=55,code=WIDGET.lnk_pressKey("down"),hide=function()return selected==BGM.getCount()end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -22,40 +22,42 @@ local fnsRankColor={
local scene={} local scene={}
local timer--Animation timer
local form--Form of clear & spins
local radar--Radar chart
local val={1/80,1/80,1/80,1/60,1/100,1/40}--Radar chart normalizer
function scene.sceneInit(org) function scene.sceneInit(org)
if org:find("setting")then if org:find("setting")then
TEXT.show(text.needRestart,640,440,50,"fly",.6) TEXT.show(text.needRestart,640,440,50,"fly",.6)
end end
local P=PLAYERS[1] local P=PLAYERS[1]
local S=P.stat local S=P.stat
sceneTemp={
timer=org=="play"and 0 or 50, timer=org=="play"and 0 or 50
list={
format("%s / %s",toTime(S.frame/60),toTime(S.time)), form={
format("%d/%d/%d",S.key,S.rotate,S.hold), format("%s / %s",toTime(S.frame/60),toTime(S.time)),
format("%d %.2fPPS",S.piece,S.piece/S.time), format("%d/%d/%d",S.key,S.rotate,S.hold),
format("%d(%d) %.2fLPM",S.row,S.dig,S.row/S.time*60), format("%d %.2fPPS",S.piece,S.piece/S.time),
format("%d(%d) %.2fAPM",S.atk,S.digatk,S.atk/S.time*60), format("%d(%d) %.2fLPM",S.row,S.dig,S.row/S.time*60),
format("%d(%d-%d)",S.pend,S.recv,S.recv-S.pend), format("%d(%d) %.2fAPM",S.atk,S.digatk,S.atk/S.time*60),
format("%d/%d/%d/%d",S.clears[1],S.clears[2],S.clears[3],S.clears[4]), format("%d(%d-%d)",S.pend,S.recv,S.recv-S.pend),
format("(%d)/%d/%d/%d",S.spins[1],S.spins[2],S.spins[3],S.spins[4]), format("%d/%d/%d/%d",S.clears[1],S.clears[2],S.clears[3],S.clears[4]),
format("%d/%d ; %d/%d",S.b2b,S.b3b,S.pc,S.hpc), format("(%d)/%d/%d/%d",S.spins[1],S.spins[2],S.spins[3],S.spins[4]),
format("%d/%dx/%.2f%%",S.extraPiece,S.maxFinesseCombo,S.finesseRate*20/S.piece), format("%d/%d ; %d/%d",S.b2b,S.b3b,S.pc,S.hpc),
}, format("%d/%dx/%.2f%%",S.extraPiece,S.maxFinesseCombo,S.finesseRate*20/S.piece),
--From right-down, 60 degree each
radar={
(S.off+S.dig)/S.time*60,--DefPM
(S.atk+S.dig)/S.time*60,--ADPM
S.atk/S.time*60, --AtkPM
S.send/S.time*60, --SendPM
S.piece/S.time*24, --LinePM
S.dig/S.time*60, --DigPM
},
val={1/80,1/80,1/80,1/60,1/100,1/40},
timing=org=="play",
} }
S=sceneTemp --From right-down, 60 degree each
local A,B=S.radar,S.val radar={
(S.off+S.dig)/S.time*60,--DefPM
(S.atk+S.dig)/S.time*60,--ADPM
S.atk/S.time*60, --AtkPM
S.send/S.time*60, --SendPM
S.piece/S.time*24, --LinePM
S.dig/S.time*60, --DigPM
}
local A,B=radar,val
--Normalize Values --Normalize Values
for i=1,6 do for i=1,6 do
@@ -70,9 +72,9 @@ function scene.sceneInit(org)
if B[i]>.5 then f=2 end if B[i]>.5 then f=2 end
if B[i]>1 then f=3 break end if B[i]>1 then f=3 break end
end end
if f==1 then S.color,f={.4,.9,.5},1.25 --Vegetable if f==1 then color,f={.4,.9,.5},1.25 --Vegetable
elseif f==2 then S.color,f={.4,.7,.9},1 --Normal elseif f==2 then color,f={.4,.7,.9},1 --Normal
elseif f==3 then S.color,f={1,.3,.3},.626 --Diao elseif f==3 then color,f={1,.3,.3},.626 --Diao
end end
A={ A={
120*.5*f, 120*3^.5*.5*f, 120*.5*f, 120*3^.5*.5*f,
@@ -82,17 +84,17 @@ function scene.sceneInit(org)
120*.5*f, 120*-3^.5*.5*f, 120*.5*f, 120*-3^.5*.5*f,
120*1*f, 120*0*f, 120*1*f, 120*0*f,
} }
S.scale=f scale=f
S.standard=A standard=A
for i=6,1,-1 do for i=6,1,-1 do
B[2*i-1],B[2*i]=B[i]*A[2*i-1],B[i]*A[2*i] B[2*i-1],B[2*i]=B[i]*A[2*i-1],B[i]*A[2*i]
end end
S.val=B val=B
if P.result=="WIN"and P.stat.piece>4 then if P.result=="WIN"and P.stat.piece>4 then
local acc=P.stat.finesseRate*.2/P.stat.piece local acc=P.stat.finesseRate*.2/P.stat.piece
S.rank= rank=
acc==1. and"Z"or acc==1. and"Z"or
acc>.97 and"S"or acc>.97 and"S"or
acc>.94 and"A"or acc>.94 and"A"or
@@ -101,13 +103,12 @@ function scene.sceneInit(org)
acc>.50 and"D"or acc>.50 and"D"or
acc>.30 and"E"or acc>.30 and"E"or
"F" "F"
S.fnsRankColor=fnsRankColor[S.rank]
if acc==1 then if acc==1 then
S.trophy=text.finesse_ap trophy=text.finesse_ap
S.trophyColor=COLOR.yellow trophyColor=COLOR.yellow
elseif P.stat.maxFinesseCombo==P.stat.piece then elseif P.stat.maxFinesseCombo==P.stat.piece then
S.trophy=text.finesse_fc trophy=text.finesse_fc
S.trophyColor=COLOR.lCyan trophyColor=COLOR.lCyan
end end
end end
if not(GAME.result or GAME.replaying)then if not(GAME.result or GAME.replaying)then
@@ -149,8 +150,8 @@ function scene.update(dt)
if not(GAME.result or GAME.replaying)then if not(GAME.result or GAME.replaying)then
GAME.pauseTime=GAME.pauseTime+dt GAME.pauseTime=GAME.pauseTime+dt
end end
if sceneTemp.timer<50 then if timer<50 then
sceneTemp.timer=sceneTemp.timer+1 timer=timer+1
end end
end end
@@ -159,8 +160,7 @@ 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 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} local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13}
function scene.draw() function scene.draw()
local S=sceneTemp local T=timer*.02
local T=S.timer*.02
if T<1 or GAME.result then SCN.scenes.play.draw()end if T<1 or GAME.result then SCN.scenes.play.draw()end
--Dark BG --Dark BG
@@ -183,7 +183,7 @@ function scene.draw()
--Result Text --Result Text
setFont(35) setFont(35)
mText(GAME.result and drawableText[GAME.result]or drawableText.pause,640,50-10*(5-sceneTemp.timer*.1)^1.5) mText(GAME.result and drawableText[GAME.result]or drawableText.pause,640,50-10*(5-timer*.1)^1.5)
--Mode Info --Mode Info
_=drawableText.modeName _=drawableText.modeName
@@ -192,7 +192,7 @@ function scene.draw()
--Infos --Infos
if GAME.frame>180 then if GAME.frame>180 then
_=S.list _=form
setFont(25) setFont(25)
for i=1,10 do for i=1,10 do
gc.print(text.pauseStat[i],40,270+35*i) gc.print(text.pauseStat[i],40,270+35*i)
@@ -242,15 +242,15 @@ function scene.draw()
end end
--Finesse rank & trophy --Finesse rank & trophy
if S.rank then if rank then
setFont(60) setFont(60)
local c=S.fnsRankColor local c=fnsRankColor[rank]
gc.setColor(c[1],c[2],c[3],T) gc.setColor(c[1],c[2],c[3],T)
gc.print(S.rank,420,635) gc.print(rank,420,635)
if S.trophy then if trophy then
setFont(40) setFont(40)
gc.setColor(S.trophyColor[1],S.trophyColor[2],S.trophyColor[3],T*2-1) gc.setColor(trophyColor[1],trophyColor[2],trophyColor[3],T*2-1)
gc.printf(S.trophy,100-120*(1-T^.5),650,300,"right") gc.printf(trophy,100-120*(1-T^.5),650,300,"right")
end end
end end
@@ -264,15 +264,15 @@ function scene.draw()
--Polygon --Polygon
gc.push("transform") gc.push("transform")
gc.scale((3-2*T)*T) gc.scale((3-2*T)*T)
gc.setColor(1,1,1,T*(.5+.3*sin(Timer()*6.26)))gc.polygon("line",S.standard) gc.setColor(1,1,1,T*(.5+.3*sin(Timer()*6.26)))gc.polygon("line",standard)
_=S.color _=color
gc.setColor(_[1],_[2],_[3],T*.626) gc.setColor(_[1],_[2],_[3],T*.626)
_=S.val _=val
for i=1,9,2 do for i=1,9,2 do
gc.polygon("fill",0,0,_[i],_[i+1],_[i+2],_[i+3]) gc.polygon("fill",0,0,_[i],_[i+1],_[i+2],_[i+3])
end end
gc.polygon("fill",0,0,_[11],_[12],_[1],_[2]) gc.polygon("fill",0,0,_[11],_[12],_[1],_[2])
gc.setColor(1,1,1,T)gc.polygon("line",S.val) gc.setColor(1,1,1,T)gc.polygon("line",val)
gc.pop() gc.pop()
--Axes --Axes
@@ -292,7 +292,7 @@ function scene.draw()
else else
gc.setColor(1,1,1,T*sin(_)) gc.setColor(1,1,1,T*sin(_))
setFont(20) setFont(20)
C,_=S.radar,dataPos C,_=radar,dataPos
end end
for i=1,6 do for i=1,6 do
mStr(C[i],_[2*i-1],_[2*i]) mStr(C[i],_[2*i-1],_[2*i])

View File

@@ -1,7 +1,7 @@
local scene={} local scene={}
function scene.sceneInit() function scene.sceneInit()
sceneTemp={reset=false} sure=false
end end
function scene.keyDown(key) function scene.keyDown(key)
LOG.print("keyPress: ["..key.."]") LOG.print("keyPress: ["..key.."]")
@@ -36,7 +36,7 @@ local function parseCB()
end end
end end
local function HIDE() local function HIDE()
return not sceneTemp.reset return not sure
end end
scene.widgetList={ scene.widgetList={
WIDGET.newButton{name="exportUnlock", x=190,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(RANKS)end}, WIDGET.newButton{name="exportUnlock", x=190,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(RANKS)end},
@@ -81,7 +81,7 @@ scene.widgetList={
end end
end}, end},
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,code=function()sceneTemp.reset=true end,hide=function()return sceneTemp.reset end}, WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,code=function()sure=true end,hide=function()return sure end},
WIDGET.newButton{name="resetUnlock", x=340,y=460,w=280,h=100,color="red", WIDGET.newButton{name="resetUnlock", x=340,y=460,w=280,h=100,color="red",
code=function() code=function()
love.filesystem.remove("unlock.dat") love.filesystem.remove("unlock.dat")

View File

@@ -3,53 +3,50 @@ local int=math.floor
local scene={} local scene={}
local das,arr
local pos,dir,wait
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ das,arr=SETTING.das,SETTING.arr
das=SETTING.das, pos,dir,wait=0,1,30
arr=SETTING.arr,
pos=0,
dir=1,
wait=30,
}
BG.set("bg1") BG.set("bg1")
end end
function scene.update() function scene.update()
local T=sceneTemp if wait>0 then
if T.wait>0 then wait=wait-1
T.wait=T.wait-1 if wait==0 then
if T.wait==0 then pos=pos+dir
T.pos=T.pos+T.dir
else else
return return
end end
end end
if T.das>0 then if das>0 then
T.das=T.das-1 das=das-1
if T.das==0 then if das==0 then
if T.arr==0 then if arr==0 then
T.pos=T.pos+7*T.dir pos=pos+7*dir
T.das=SETTING.das+1 das=SETTING.das+1
T.arr=SETTING.arr arr=SETTING.arr
T.dir=-T.dir dir=-dir
T.wait=26 wait=26
else else
T.pos=T.pos+T.dir pos=pos+dir
end end
end end
else else
T.arr=T.arr-1 arr=arr-1
if T.arr==0 then if arr==0 then
T.pos=T.pos+T.dir pos=pos+dir
T.arr=SETTING.arr arr=SETTING.arr
elseif T.arr==-1 then elseif arr==-1 then
T.pos=T.dir>0 and 8 or 0 pos=dir>0 and 8 or 0
T.arr=SETTING.arr arr=SETTING.arr
end end
if T.pos%8==0 then if pos%8==0 then
T.dir=-T.dir dir=-dir
T.wait=26 wait=26
T.das=SETTING.das das=SETTING.das
end end
end end
end end
@@ -70,7 +67,7 @@ function scene.draw()
--O mino animation --O mino animation
local O=SKIN.curText[SETTING.skin[6]] local O=SKIN.curText[SETTING.skin[6]]
local x=550+40*sceneTemp.pos local x=550+40*pos
gc.draw(O,x,540,nil,40/30) gc.draw(O,x,540,nil,40/30)
gc.draw(O,x,580,nil,40/30) gc.draw(O,x,580,nil,40/30)
gc.draw(O,x+40,540,nil,40/30) gc.draw(O,x+40,540,nil,40/30)

View File

@@ -7,110 +7,109 @@ local int,sin=math.floor,math.sin
local scene={} local scene={}
local page
local kb,js--Selected
local kS,jS--If setting
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ page=1
board=1, kb,js=1,1
kb=1,js=1, kS,jS=false,false
kS=false,jS=false,
}
end end
function scene.sceneBack() function scene.sceneBack()
FILE.save(keyMap,"key") FILE.save(keyMap,"key")
end end
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
if key=="escape"then if key=="escape"then
if S.kS then if kS then
S.kS=false kS=false
SFX.play("finesseError",.5) SFX.play("finesseError",.5)
else else
SCN.back() SCN.back()
end end
elseif S.kS then elseif kS then
if key~="\\"then if key~="\\"then
for y=1,20 do for y=1,20 do
if keyMap[1][y]==key then keyMap[1][y]=""break end if keyMap[1][y]==key then keyMap[1][y]=""break end
if keyMap[2][y]==key then keyMap[2][y]=""break end if keyMap[2][y]==key then keyMap[2][y]=""break end
end end
keyMap[S.board][S.kb]=key keyMap[page][kb]=key
S.kS=false kS=false
SFX.play("reach",.5) SFX.play("reach",.5)
end end
elseif key=="return"or key=="space"then elseif key=="return"or key=="space"then
S.kS=true kS=true
SFX.play("lock",.5) SFX.play("lock",.5)
elseif key=="up"or key=="w"then elseif key=="up"or key=="w"then
if S.kb>1 then if kb>1 then
S.kb=S.kb-1 kb=kb-1
SFX.play("move",.5) SFX.play("move",.5)
end end
elseif key=="down"or key=="s"then elseif key=="down"or key=="s"then
if S.kb<20 then if kb<20 then
S.kb=S.kb+1 kb=kb+1
SFX.play("move",.5) SFX.play("move",.5)
end end
elseif key=="left"or key=="a"or key=="right"or key=="d"then elseif key=="left"or key=="a"or key=="right"or key=="d"then
S.board=3-S.board page=3-page
SFX.play("rotate",.5) SFX.play("rotate",.5)
end end
end end
function scene.gamepadDown(key) function scene.gamepadDown(key)
local S=sceneTemp
if key=="back"then if key=="back"then
if S.jS then if jS then
S.jS=false jS=false
SFX.play("finesseError",.5) SFX.play("finesseError",.5)
else else
SCN.back() SCN.back()
end end
elseif S.jS then elseif jS then
for y=1,20 do for y=1,20 do
if keyMap[3][y]==key then keyMap[3][y]=""break end if keyMap[3][y]==key then keyMap[3][y]=""break end
if keyMap[4][y]==key then keyMap[4][y]=""break end if keyMap[4][y]==key then keyMap[4][y]=""break end
end end
keyMap[2+S.board][S.js]=key keyMap[2+page][js]=key
SFX.play("reach",.5) SFX.play("reach",.5)
S.jS=false jS=false
elseif key=="start"then elseif key=="start"then
S.jS=true jS=true
SFX.play("lock",.5) SFX.play("lock",.5)
elseif key=="dpup"then elseif key=="dpup"then
if S.js>1 then if js>1 then
S.js=S.js-1 js=js-1
SFX.play("move",.5) SFX.play("move",.5)
end end
elseif key=="dpdown"then elseif key=="dpdown"then
if S.js<20 then if js<20 then
S.js=S.js+1 js=js+1
SFX.play("move",.5) SFX.play("move",.5)
end end
elseif key=="dpleft"or key=="dpright"then elseif key=="dpleft"or key=="dpright"then
S.board=3-S.board page=3-page
SFX.play("rotate",.5) SFX.play("rotate",.5)
end end
end end
function scene.draw() function scene.draw()
local S=sceneTemp
local a=.3+sin(Timer()*15)*.1 local a=.3+sin(Timer()*15)*.1
if S.kS then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end if kS then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end
gc.rectangle("fill", gc.rectangle("fill",
S.kb<11 and 240 or 840, kb<11 and 240 or 840,
45*S.kb+20-450*int(S.kb/11), 45*kb+20-450*int(kb/11),
200,45 200,45
) )
if S.jS then gc.setColor(.3,.3,.1,a)else gc.setColor(.7,.7,1,a)end if jS then gc.setColor(.3,.3,.1,a)else gc.setColor(.7,.7,1,a)end
gc.rectangle("fill", gc.rectangle("fill",
S.js<11 and 440 or 1040, js<11 and 440 or 1040,
45*S.js+20-450*int(S.js/11), 45*js+20-450*int(js/11),
200,45 200,45
) )
--Selection rect --Selection rect
gc.setColor(1,1,1) gc.setColor(1,1,1)
setFont(25) setFont(25)
local b1,b2=keyMap[S.board],keyMap[S.board+2] local b1,b2=keyMap[page],keyMap[page+2]
for N=1,20 do for N=1,20 do
if N<11 then if N<11 then
gc.printf(text.acts[N],47,45*N+22,180,"right") gc.printf(text.acts[N],47,45*N+22,180,"right")
@@ -130,7 +129,7 @@ function scene.draw()
gc.line(40,y,1240,y) gc.line(40,y,1240,y)
end end
setFont(35) setFont(35)
gc.print(text.page..S.board,280,570) gc.print(text.page..page,280,570)
end end
scene.widgetList={ scene.widgetList={

View File

@@ -6,12 +6,14 @@ local rnd=math.random
local scene={} local scene={}
local last--Last touch time
local jump--Animation timer(10 to 0)
local cv
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ last=0
last=0,--Last touch time jump=0
jump=0,--Animation timer(10 to 0) cv=SETTING.cv
cv=SETTING.cv,
}
BG.set("space") BG.set("space")
end end
function scene.sceneBack() function scene.sceneBack()
@@ -19,13 +21,12 @@ function scene.sceneBack()
end end
function scene.mouseDown(x,y) function scene.mouseDown(x,y)
local S=sceneTemp if x>780 and x<980 and y>470 and jump==0 then
if x>780 and x<980 and y>470 and S.jump==0 then jump=10
S.jump=10 local t=Timer()-last
local t=Timer()-S.last
if t>1 then if t>1 then
VOC.play((t<1.5 or t>15)and"doubt"or rnd()<.8 and"happy"or"egg") VOC.play((t<1.5 or t>15)and"doubt"or rnd()<.8 and"happy"or"egg")
S.last=Timer() last=Timer()
end end
end end
end end
@@ -34,16 +35,16 @@ function scene.touchDown(_,x,y)
end end
function scene.update() function scene.update()
local t=sceneTemp.jump local t=jump
if t>0 then if t>0 then
sceneTemp.jump=t-1 jump=t-1
end end
end end
function scene.draw() function scene.draw()
gc.setColor(1,1,1) gc.setColor(1,1,1)
local t=Timer() local t=Timer()
local _=sceneTemp.jump local _=jump
local x,y=800,340+10*sin(t*.5)+(_-10)*_*.3 local x,y=800,340+10*sin(t*.5)+(_-10)*_*.3
gc.translate(x,y) gc.translate(x,y)
gc.draw(IMG.miyaCH,0,0) gc.draw(IMG.miyaCH,0,0)
@@ -67,8 +68,8 @@ scene.widgetList={
WIDGET.newSlider{name="bgm", x=180, y=400,w=400, font=35, disp=WIDGET.lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end}, WIDGET.newSlider{name="bgm", x=180, y=400,w=400, font=35, disp=WIDGET.lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
WIDGET.newSlider{name="vib", x=750, y=200,w=400,unit=5, font=25,change=function()VIB(2)end, disp=WIDGET.lnk_SETval("vib"),code=WIDGET.lnk_SETsto("vib")}, WIDGET.newSlider{name="vib", x=750, y=200,w=400,unit=5, font=25,change=function()VIB(2)end, disp=WIDGET.lnk_SETval("vib"),code=WIDGET.lnk_SETsto("vib")},
WIDGET.newSlider{name="voc", x=750, y=300,w=400, font=35,change=function()VOC.play("test")end, disp=WIDGET.lnk_SETval("voc"),code=WIDGET.lnk_SETsto("voc")}, WIDGET.newSlider{name="voc", x=750, y=300,w=400, font=35,change=function()VOC.play("test")end, disp=WIDGET.lnk_SETval("voc"),code=WIDGET.lnk_SETsto("voc")},
WIDGET.newSelector{name="cv", x=1100, y=380,w=200, list={"miya","naki"}, disp=WIDGET.lnk_STPval("cv"),code=WIDGET.lnk_STPsto("cv")}, WIDGET.newSelector{name="cv", x=1100, y=380,w=200, list={"miya","naki"}, disp=function()return cv end,code=function(i)cv=i end},
WIDGET.newButton{name="apply", x=1100, y=460,w=180,h=80, code=function()SETTING.cv=sceneTemp.cv VOC.loadAll()end,hide=function()return SETTING.cv==sceneTemp.cv end}, WIDGET.newButton{name="apply", x=1100, y=460,w=180,h=80, code=function()SETTING.cv=cv VOC.loadAll()end,hide=function()return SETTING.cv==cv end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -6,13 +6,15 @@ local int,sin=math.floor,math.sin
local scene={} local scene={}
local defaultSetSelect
local snapUnit
local select--Button selected
function scene.sceneInit() function scene.sceneInit()
BG.set("rainbow") BG.set("rainbow")
sceneTemp={ defaultSetSelect=1
default=1, snapUnit=1
snap=1, select=nil
sel=nil,
}
end end
function scene.sceneBack() function scene.sceneBack()
FILE.save(VK_org,"virtualkey") FILE.save(VK_org,"virtualkey")
@@ -35,34 +37,34 @@ local function onVK_org(x,y)
end end
function scene.mouseDown(x,y,k) function scene.mouseDown(x,y,k)
if k==2 then SCN.back()end if k==2 then SCN.back()end
sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel select=onVK_org(x,y)or select
end end
function scene.mouseMove(_,_,dx,dy) function scene.mouseMove(_,_,dx,dy)
if sceneTemp.sel and ms.isDown(1)and not WIDGET.sel then if select and ms.isDown(1)and not WIDGET.sel then
local B=VK_org[sceneTemp.sel] local B=VK_org[select]
B.x,B.y=B.x+dx,B.y+dy B.x,B.y=B.x+dx,B.y+dy
end end
end end
function scene.mouseUp() function scene.mouseUp()
if sceneTemp.sel then if select then
local B=VK_org[sceneTemp.sel] local B=VK_org[select]
local k=sceneTemp.snap local k=snapUnit
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end end
end end
function scene.touchDown(_,x,y) function scene.touchDown(_,x,y)
sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel select=onVK_org(x,y)or select
end end
function scene.touchUp() function scene.touchUp()
if sceneTemp.sel then if select then
local B=VK_org[sceneTemp.sel] local B=VK_org[select]
local k=sceneTemp.snap local k=snapUnit
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end end
end end
function scene.touchMove(_,_,_,dx,dy) function scene.touchMove(_,_,_,dx,dy)
if sceneTemp.sel and not WIDGET.sel then if select and not WIDGET.sel then
local B=VK_org[sceneTemp.sel] local B=VK_org[select]
B.x,B.y=B.x+dx,B.y+dy B.x,B.y=B.x+dx,B.y+dy
end end
end end
@@ -72,7 +74,7 @@ local function VirtualkeyPreview()
for i=1,#VK_org do for i=1,#VK_org do
local B=VK_org[i] local B=VK_org[i]
if B.ava then if B.ava then
local c=sceneTemp.sel==i and .6 or 1 local c=select==i and .6 or 1
gc.setColor(c,1,c,SETTING.VKAlpha) gc.setColor(c,1,c,SETTING.VKAlpha)
gc.setLineWidth(B.r*.07) gc.setLineWidth(B.r*.07)
gc.circle("line",B.x,B.y,B.r,10) gc.circle("line",B.x,B.y,B.r,10)
@@ -86,7 +88,7 @@ function scene.draw()
gc.setLineWidth(7)gc.rectangle("line",340,15,600,690) gc.setLineWidth(7)gc.rectangle("line",340,15,600,690)
gc.setLineWidth(3)gc.rectangle("line",490,85,300,600) gc.setLineWidth(3)gc.rectangle("line",490,85,300,600)
VirtualkeyPreview() VirtualkeyPreview()
local d=sceneTemp.snap local d=snapUnit
if d>=10 then if d>=10 then
gc.setLineWidth(3) gc.setLineWidth(3)
gc.setColor(1,1,1,sin(Timer()*4)*.1+.1) gc.setColor(1,1,1,sin(Timer()*4)*.1+.1)
@@ -172,9 +174,9 @@ local virtualkeySet={
},--PC key feedback(top&in a row) },--PC key feedback(top&in a row)
} }
scene.widgetList={ scene.widgetList={
WIDGET.newButton{name="default", x=520,y=90,w=200,h=80,font=35, WIDGET.newButton{name="default",x=520,y=90,w=200,h=80,font=35,
code=function() code=function()
local D=virtualkeySet[sceneTemp.default] local D=virtualkeySet[defaultSetSelect]
for i=1,#VK_org do for i=1,#VK_org do
VK_org[i].ava=false VK_org[i].ava=false
end end
@@ -188,27 +190,27 @@ scene.widgetList={
B.x,B.y,B.r=T[2],T[3],T[4] B.x,B.y,B.r=T[2],T[3],T[4]
end end
end end
sceneTemp.default=sceneTemp.default%5+1 defaultSetSelect=defaultSetSelect%5+1
sceneTemp.sel=nil select=nil
LOG.print("[ "..sceneTemp.default.." ]") LOG.print("[ "..defaultSetSelect.." ]")
end}, end},
WIDGET.newSelector{name="snap", x=760,y=90,w=200,h=80,color="yellow",list={1,10,20,40,60,80},disp=WIDGET.lnk_STPval("snap"),code=WIDGET.lnk_STPsto("snap")}, WIDGET.newSelector{name="snap", x=760,y=90,w=200,h=80,color="yellow",list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
WIDGET.newButton{name="option", x=520,y=190,w=200,h=80,font=40, WIDGET.newButton{name="option", x=520,y=190,w=200,h=80,font=40,
code=function() code=function()
SCN.go("setting_touchSwitch") SCN.go("setting_touchSwitch")
end}, end},
WIDGET.newButton{name="back", x=760,y=190,w=200,h=80,font=35,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=760,y=190,w=200,h=80,font=35,code=WIDGET.lnk_BACK},
WIDGET.newSlider{name="size", x=450,y=270,w=460,unit=19,font=40,show="vkSize", WIDGET.newSlider{name="size", x=450,y=270,w=460,unit=19,font=40,show="vkSize",
disp=function() disp=function()
return VK_org[sceneTemp.sel].r/10-1 return VK_org[select].r/10-1
end, end,
code=function(v) code=function(v)
if sceneTemp.sel then if select then
VK_org[sceneTemp.sel].r=(v+1)*10 VK_org[select].r=(v+1)*10
end end
end, end,
hide=function() hide=function()
return not sceneTemp.sel return not select
end}, end},
} }

View File

@@ -2,40 +2,36 @@ local int=math.floor
local scene={} local scene={}
local mini,b2b,b3b,pc
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ mini,b2b,b3b,pc=false,false,false,false
mini=false,
b2b=false,
b3b=false,
pc=false,
}
end end
local blockName={"z","s","j","l","t","o","i"} local blockName={"z","s","j","l","t","o","i"}
local lineCount={"single","double","triple","techrash"} local lineCount={"single","double","triple","techrash"}
function scene.keyDown(key) function scene.keyDown(key)
local S=sceneTemp
if key=="1"then if key=="1"then
S.mini=not S.mini mini=not mini
elseif key=="2"then elseif key=="2"then
S.b2b=not S.b2b b2b=not b2b
if S.b2b then S.b3b=false end if b2b then b3b=false end
elseif key=="3"then elseif key=="3"then
S.b3b=not S.b3b b3b=not b3b
if S.b3b then S.b2b=false end if b3b then b2b=false end
elseif key=="4"then elseif key=="4"then
S.pc=not S.pc pc=not pc
elseif type(key)=="number"then elseif type(key)=="number"then
local CHN=VOC.getFreeChannel() local CHN=VOC.getFreeChannel()
if S.mini then VOC.play("mini",CHN)end if mini then VOC.play("mini",CHN)end
if S.b2b then VOC.play("b2b",CHN) if b2b then VOC.play("b2b",CHN)
elseif S.b3b then VOC.play("b3b",CHN) elseif b3b then VOC.play("b3b",CHN)
end end
if key>=10 then if key>=10 then
VOC.play(blockName[int(key/10)].."spin",CHN) VOC.play(blockName[int(key/10)].."spin",CHN)
end end
if lineCount[key%10]then VOC.play(lineCount[key%10],CHN)end if lineCount[key%10]then VOC.play(lineCount[key%10],CHN)end
if S.pc then VOC.play("perfect_clear",CHN)end if pc then VOC.play("perfect_clear",CHN)end
elseif key=="escape"then elseif key=="escape"then
SCN.back() SCN.back()
end end
@@ -103,10 +99,10 @@ scene.widgetList={
WIDGET.newKey{name="l2", x=1130, y=335,w=140,h=50,font=20,code=WIDGET.lnk_pressKey(42)}, WIDGET.newKey{name="l2", x=1130, y=335,w=140,h=50,font=20,code=WIDGET.lnk_pressKey(42)},
WIDGET.newKey{name="l3", x=1130, y=400,w=140,h=50,font=20,code=WIDGET.lnk_pressKey(43)}, WIDGET.newKey{name="l3", x=1130, y=400,w=140,h=50,font=20,code=WIDGET.lnk_pressKey(43)},
WIDGET.newSwitch{name="mini", x=515, y=465,font=25,disp=WIDGET.lnk_STPval("mini"),code=WIDGET.lnk_pressKey("1")}, WIDGET.newSwitch{name="mini", x=515, y=465,font=25,disp=function()return mini end,code=WIDGET.lnk_pressKey("1")},
WIDGET.newSwitch{name="b2b", x=515, y=530,font=25,disp=WIDGET.lnk_STPval("b2b"),code=WIDGET.lnk_pressKey("2")}, WIDGET.newSwitch{name="b2b", x=515, y=530,font=25,disp=function()return b2b end,code=WIDGET.lnk_pressKey("2")},
WIDGET.newSwitch{name="b3b", x=515, y=595,font=25,disp=WIDGET.lnk_STPval("b3b"),code=WIDGET.lnk_pressKey("3")}, WIDGET.newSwitch{name="b3b", x=515, y=595,font=25,disp=function()return b3b end,code=WIDGET.lnk_pressKey("3")},
WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=WIDGET.lnk_STPval("pc"),code=WIDGET.lnk_pressKey("4")}, WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=function()return pc end,code=WIDGET.lnk_pressKey("4")},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}, WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
} }

View File

@@ -3,19 +3,19 @@ local kb,tc=love.keyboard,love.touch
local scene={} local scene={}
local time,v
function scene.sceneInit() function scene.sceneInit()
sceneTemp={ time=0
time=0, v=1
v=1,
}
BG.set("space") BG.set("space")
end end
function scene.mouseDown(x,y) function scene.mouseDown(x,y)
if x>230 and x<1050 then if x>230 and x<1050 then
if math.abs(y-800+sceneTemp.time*40)<70 then if math.abs(y-800+time*40)<70 then
loadGame("sprintLock") loadGame("sprintLock")
elseif math.abs(y-2160+sceneTemp.time*40)<70 then elseif math.abs(y-2160+time*40)<70 then
loadGame("sprintFix") loadGame("sprintFix")
end end
end end
@@ -38,28 +38,23 @@ function scene.keyDown(k)
end end
function scene.update(dt) function scene.update(dt)
local S=sceneTemp if(kb.isDown("space","return")or tc.getTouches()[1])and v<6.26 then
if(kb.isDown("space","return")or tc.getTouches()[1])and S.v<6.26 then v=v+.26
S.v=S.v+.26 elseif v>1 then
elseif S.v>1 then v=v-.26
S.v=S.v-.26
end
S.time=S.time+S.v*dt
if S.time>45 then
S.time=45
end end
time=math.min(time+v*dt,45)
end end
function scene.draw() function scene.draw()
local L=text.staff local L=text.staff
local t=sceneTemp.time
setFont(40) setFont(40)
gc.setColor(1,1,1) gc.setColor(1,1,1)
for i=1,#L do for i=1,#L do
mStr(L[i],640,800+70*i-t*40) mStr(L[i],640,800+70*i-time*40)
end end
mDraw(IMG.title_color,640,800-t*40,nil,2) mDraw(IMG.title_color,640,800-time*40,nil,2)
mDraw(IMG.title_color,640,2160-t*40,nil,2) mDraw(IMG.title_color,640,2160-time*40,nil,2)
end end
scene.widgetList={ scene.widgetList={

View File

@@ -8,6 +8,9 @@ local mStr=mStr
local scene={} local scene={}
local form--Form of clear & spins
local item--Detail datas
function scene.sceneInit() function scene.sceneInit()
local S=STAT local S=STAT
local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{} local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{}
@@ -20,36 +23,33 @@ function scene.sceneInit()
X2[j]=X2[j]+c[j] X2[j]=X2[j]+c[j]
end end
end end
sceneTemp={ form={
chart={ A1=S.spin,A2=S.clear,
A1=S.spin,A2=S.clear, X1=X1,X2=X2,
X1=X1,X2=X2, Y1=Y1,Y2=Y2,
Y1=Y1,Y2=Y2, }
}, item={
item={ S.run,
S.run, S.game,
S.game, toTime(S.time),
toTime(S.time), S.key.." "..S.rotate.." "..S.hold,
S.key.." "..S.rotate.." "..S.hold, S.piece.." "..S.row.." "..int(S.atk),
S.piece.." "..S.row.." "..int(S.atk), S.recv.." "..S.off.." "..S.pend,
S.recv.." "..S.off.." "..S.pend, S.dig.." "..int(S.digatk),
S.dig.." "..int(S.digatk), format("%.2f %.2f",S.atk/S.row,S.digatk/S.dig),
format("%.2f %.2f",S.atk/S.row,S.digatk/S.dig), S.b2b.." "..S.b3b,
S.b2b.." "..S.b3b, S.pc.." "..S.hpc,
S.pc.." "..S.hpc, format("%d/%.2f%%",S.extraPiece,S.finesseRate*20/S.piece),
format("%d/%.2f%%",S.extraPiece,S.finesseRate*20/S.piece),
},
} }
for i=1,11 do for i=1,11 do
sceneTemp.item[i]=text.stat[i].."\t"..sceneTemp.item[i] item[i]=text.stat[i].."\t"..item[i]
end end
end end
function scene.draw() function scene.draw()
local chart=sceneTemp.chart
setFont(25) setFont(25)
local _,__=SKIN.libColor,SETTING.skin local _,__=SKIN.libColor,SETTING.skin
local A,B=chart.A1,chart.A2 local A,B=form.A1,form.A2
for x=1,7 do for x=1,7 do
gc.setColor(_[__[x]]) gc.setColor(_[__[x]])
mStr(text.block[x],80*x,40) mStr(text.block[x],80*x,40)
@@ -58,11 +58,11 @@ function scene.draw()
mStr(A[x][y],80*x,40+40*y) mStr(A[x][y],80*x,40+40*y)
mStr(B[x][y],80*x,280+40*y) mStr(B[x][y],80*x,280+40*y)
end end
mStr(chart.Y1[x],80*x,240) mStr(form.Y1[x],80*x,240)
mStr(chart.Y2[x],80*x,480) mStr(form.Y2[x],80*x,480)
end end
A,B=chart.X1,chart.X2 A,B=form.X1,form.X2
for y=1,4 do for y=1,4 do
gc.setColor(.5,.5,.5) gc.setColor(.5,.5,.5)
gc.print(y-1,620,40+40*y) gc.print(y-1,620,40+40*y)
@@ -74,7 +74,7 @@ function scene.draw()
setFont(20) setFont(20)
for i=1,11 do for i=1,11 do
gc.print(sceneTemp.item[i],740,40*i+10) gc.print(item[i],740,40*i+10)
end end
gc.setLineWidth(4) gc.setLineWidth(4)