淘汰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

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

View File

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

View File

@@ -5,80 +5,82 @@ local find,sub,byte=string.find,string.sub,string.byte
local scene={}
local reg--register
local val--value
local sym--symbol
local pass--if password correct
function scene.sceneInit()
BG.set("none")
sceneTemp={
reg=false,
val="0",
sym=false,
pass=false,
}
reg=false
val="0"
sym=false
pass=false
end
scene.mouseDown=NULL
function scene.keyDown(k)
local S=sceneTemp
if byte(k)>=48 and byte(k)<=57 then
if S.sym=="="then
S.val=k
S.sym=false
elseif S.sym and not S.reg then
S.reg=S.val
S.val=k
if sym=="="then
val=k
sym=false
elseif sym and not reg then
reg=val
val=k
else
if #S.val<14 then
if S.val=="0"then S.val=""end
S.val=S.val..k
if #val<14 then
if val=="0"then val=""end
val=val..k
end
end
elseif k:sub(1,2)=="kp"then
scene.keyDown(k:sub(3))
elseif k=="."then
if not(find(S.val,".",nil,true)or find(S.val,"e"))then
if S.sym and not S.reg then
S.reg=S.val
S.val="0."
if not(find(val,".",nil,true)or find(val,"e"))then
if sym and not reg then
reg=val
val="0."
end
S.val=S.val.."."
val=val.."."
end
elseif k=="e"then
if not find(S.val,"e")then
S.val=S.val.."e"
if not find(val,"e")then
val=val.."e"
end
elseif k=="backspace"then
if S.sym=="="then
S.val=""
elseif S.sym then
S.sym=false
if sym=="="then
val=""
elseif sym then
sym=false
else
S.val=sub(S.val,1,-2)
val=sub(val,1,-2)
end
if S.val==""then S.val="0"end
elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then S.sym="+" S.reg=false
elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then S.sym="*" S.reg=false
elseif k=="-"then S.sym="-" S.reg=false
elseif k=="/"then S.sym="/" S.reg=false
if val==""then val="0"end
elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then sym="+" reg=false
elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then sym="*" reg=false
elseif k=="-"then sym="-" reg=false
elseif k=="/"then sym="/" reg=false
elseif k=="return"then
if byte(S.val,-1)==101 then S.val=sub(S.val,1,-2)end
if S.sym and S.reg then
if byte(S.reg,-1)==101 then S.reg=sub(S.reg,1,-2)end
S.val=
S.sym=="+"and (tonumber(S.reg)or 0)+tonumber(S.val)or
S.sym=="-"and (tonumber(S.reg)or 0)-tonumber(S.val)or
S.sym=="*"and (tonumber(S.reg)or 0)*tonumber(S.val)or
S.sym=="/"and (tonumber(S.reg)or 0)/tonumber(S.val)or
if byte(val,-1)==101 then val=sub(val,1,-2)end
if sym and reg then
if byte(reg,-1)==101 then reg=sub(reg,1,-2)end
val=
sym=="+"and (tonumber(reg)or 0)+tonumber(val)or
sym=="-"and (tonumber(reg)or 0)-tonumber(val)or
sym=="*"and (tonumber(reg)or 0)*tonumber(val)or
sym=="/"and (tonumber(reg)or 0)/tonumber(val)or
-1
end
S.sym="="
S.reg=false
local v=tonumber(S.val)
if v==600+26 then S.pass=true
sym="="
reg=false
local v=tonumber(val)
if v==600+26 then pass=true
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")
SFX.play("clear")
elseif v==72943816 then
S.pass=true
pass=true
for name,M in next,MODES do
if not RANKS[name]then
RANKS[name]=M.score and 0 or 6
@@ -107,10 +109,10 @@ function scene.keyDown(k)
LOG.print("dpi: "..SCR.dpi)
end
elseif k=="escape"then
S.val,S.reg,S.sym="0"
val,reg,sym="0"
elseif k=="delete"then
S.val="0"
elseif k=="space"and S.pass then
val="0"
elseif k=="space"and pass then
if LOADED then
SCN.back()
else
@@ -120,14 +122,13 @@ function scene.keyDown(k)
end
function scene.draw()
local S=sceneTemp
gc.setColor(1,1,1)
gc.setLineWidth(4)
gc.rectangle("line",100,80,650,150)
setFont(45)
if S.reg then gc.printf(S.reg,0,100,720,"right")end
if S.val then gc.printf(S.val,0,150,720,"right")end
if S.sym then setFont(50)gc.print(S.sym,126,150)end
if reg then gc.printf(reg,0,100,720,"right")end
if val then gc.printf(val,0,150,720,"right")end
if sym then setFont(50)gc.print(sym,126,150)end
end
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=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.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

View File

@@ -15,14 +15,16 @@ local CUSTOMENV=CUSTOMENV
local scene={}
local initField
function scene.sceneInit()
destroyPlayers()
BG.set(CUSTOMENV.bg)
BGM.play(CUSTOMENV.bgm)
sceneTemp={initField=false}
initField=false
for y=1,20 do
if notAir(FIELD[1][y])then
sceneTemp.initField=true
initField=true
end
end
end
@@ -45,7 +47,7 @@ function scene.keyDown(key)
end
end
if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
if sceneTemp.initField then
if initField then
loadGame("custom_puzzle",true)
end
else
@@ -106,7 +108,7 @@ end
function scene.draw()
--Field content
if sceneTemp.initField then
if initField then
gc.push("transform")
gc.translate(95,290)
gc.scale(.5)
@@ -129,7 +131,7 @@ function scene.draw()
--Field
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.print("+",275,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="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="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
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 scene={}
local sure
local pen--Pen type
local px,py--Pen position
local demo--If show x
local page
function scene.sceneInit()
sceneTemp={
sure=0,
pen=1,
x=1,y=1,
demo=false,
page=1,
}
sure=0
pen=1
px,py=1,1
demo=false
page=1
end
local penKey={
@@ -29,17 +33,15 @@ function scene.mouseDown(x,y)
scene.mouseMove(x,y)
end
function scene.mouseMove(x,y)
local S=sceneTemp
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=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
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
function scene.wheelMoved(_,y)
local pen=sceneTemp.pen
if y<0 then
pen=pen+1
if pen==25 then pen=1 end
@@ -47,24 +49,21 @@ function scene.wheelMoved(_,y)
pen=pen-1
if pen==0 then pen=24 end
end
sceneTemp.pen=pen
end
function scene.touchDown(_,x,y)
scene.mouseMove(x,y)
end
function scene.touchMove(_,x,y)
local S=sceneTemp
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=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
FIELD[S.page][sy][sx]=S.pen
FIELD[page][sy][sx]=pen
end
end
function scene.keyDown(key)
local S=sceneTemp
local sx,sy,pen=S.x,S.y,S.pen
local sx,sy=px,py
if key=="up"or key=="down"or key=="left"or key=="right"then
if not sx then sx=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
end
if kb.isDown("space")then
FIELD[S.page][sy][sx]=pen
FIELD[page][sy][sx]=pen
end
elseif key=="delete"then
if S.sure>20 then
for y=1,20 do for x=1,10 do FIELD[S.page][y][x]=0 end end
S.sure=0
if sure>20 then
for y=1,20 do for x=1,10 do FIELD[page][y][x]=0 end end
sure=0
SFX.play("finesseError",.7)
else
S.sure=50
sure=50
end
elseif key=="space"then
if sx and sy then
FIELD[S.page][sy][sx]=pen
FIELD[page][sy][sx]=pen
end
elseif key=="escape"then
SCN.back()
elseif key=="j"then
S.demo=not S.demo
demo=not demo
elseif key=="k"then
ins(FIELD[S.page],1,{21,21,21,21,21,21,21,21,21,21})
FIELD[S.page][21]=nil
ins(FIELD[page],1,{21,21,21,21,21,21,21,21,21,21})
FIELD[page][21]=nil
SFX.play("blip")
elseif key=="l"then
local F=FIELD[S.page]
local F=FIELD[page]
for i=20,1,-1 do
for j=1,10 do
if F[i][j]<=0 then goto L end
@@ -115,31 +114,31 @@ function scene.keyDown(key)
SFX.play("fall",.8)
end
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)
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
local str=sys.getClipboardText()
local p=string.find(str,":")--ptr*
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)
else
LOG.print(text.dataCorrupted,COLOR.red)
end
elseif key=="tab"or key=="sTab"then
if key=="sTab"or kb.isDown("lshift","rshift")then
S.page=max(S.page-1,1)
page=max(page-1,1)
else
S.page=min(S.page+1,#FIELD)
page=min(page+1,#FIELD)
end
elseif key=="n"then
ins(FIELD,S.page+1,newBoard(FIELD[S.page]))
S.page=S.page+1
ins(FIELD,page+1,newBoard(FIELD[page]))
page=page+1
SFX.play("blip_1",.8)
SYSFX.newShade(3,200,60,300,600,.5,1,.5)
elseif key=="m"then
rem(FIELD,S.page)
S.page=max(S.page-1,1)
rem(FIELD,page)
page=max(page-1,1)
if not FIELD[1]then
ins(FIELD,newBoard())
end
@@ -149,16 +148,15 @@ function scene.keyDown(key)
else
pen=penKey[key]or pen
end
S.x,S.y,S.pen=sx,sy,pen
px,py,pen=sx,sy,pen
end
function scene.update()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
if sure>0 then sure=sure-1 end
end
function scene.draw()
local S=sceneTemp
local sx,sy=S.x,S.y
local sx,sy=px,py
gc.translate(200,60)
@@ -174,32 +172,45 @@ function scene.draw()
gc.rectangle("line",-2,-2,304,604)
gc.setLineWidth(2)
local cross=puzzleMark[-1]
local F=FIELD[S.page]
local F=FIELD[page]
local texture=SKIN.curText
for y=1,20 do for x=1,10 do
local B=F[y][x]
if B>0 then
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)
end
end end
--Draw pen
if sx and sy then
gc.setLineWidth(2)
gc.rectangle("line",30*sx-30,600-30*sy,30,30)
local x,y=30*sx,600-30*sy
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
gc.translate(-200,-60)
--Draw page
setFont(55)
mStr(S.page,100,530)
mStr(page,100,530)
mStr(#FIELD,100,600)
gc.rectangle("fill",50,600,100,6)
--Draw pen color
local pen=S.pen
if pen>0 then
gc.setLineWidth(13)
gc.setColor(SKIN.libColor[pen])
@@ -212,8 +223,8 @@ function scene.draw()
end
--Confirm reset
if S.sure>0 then
gc.setColor(1,1,1,S.sure*.02)
if sure>0 then
gc.setColor(1,1,1,sure*.02)
gc.draw(drawableText.question,1145,330)
end
@@ -231,7 +242,7 @@ function scene.draw()
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={
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"},
@@ -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="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.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="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="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="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 page==#FIELD end},
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 input--Input buffer
local cur--Cursor position
local sure
function scene.sceneInit()
sceneTemp={
input="",
cur=#MISSION,
sure=0,
}
input=""
cur=#MISSION
sure=0
end
local missionEnum=missionEnum
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)
local S=sceneTemp
local MISSION=MISSION
if key=="left"then
local p=S.cur
local p=cur
if p==0 then
S.cur=#MISSION
cur=#MISSION
else
repeat
p=p-1
until MISSION[p]~=MISSION[S.cur]
S.cur=p
until MISSION[p]~=MISSION[cur]
cur=p
end
elseif key=="right"then
local p=S.cur
local p=cur
if p==#MISSION then
S.cur=0
cur=0
else
repeat
p=p+1
until MISSION[p+1]~=MISSION[S.cur+1]
S.cur=p
until MISSION[p+1]~=MISSION[cur+1]
cur=p
end
elseif key=="ten"then
for _=1,10 do
local p=S.cur
local p=cur
if p==#MISSION then break end
repeat
p=p+1
until MISSION[p+1]~=MISSION[S.cur+1]
S.cur=p
until MISSION[p+1]~=MISSION[cur+1]
cur=p
end
elseif key=="backspace"then
if #S.input>0 then
S.input=""
elseif S.cur>0 then
rem(MISSION,S.cur)
S.cur=S.cur-1
if S.cur>0 and MISSION[S.cur]==MISSION[S.cur+1]then
if #input>0 then
input=""
elseif cur>0 then
rem(MISSION,cur)
cur=cur-1
if cur>0 and MISSION[cur]==MISSION[cur+1]then
scene.keyDown("right")
end
end
elseif key=="delete"then
if S.sure>20 then
if sure>20 then
for _=1,#MISSION do
rem(MISSION)
end
S.cur=0
S.sure=0
cur=0
sure=0
SFX.play("finesseError",.7)
else
S.sure=50
sure=50
end
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
if #MISSION>0 then
@@ -82,16 +83,17 @@ function scene.keyDown(key)
if p then str=sub(str,p+1)end
if pasteMission(str)then
LOG.print(text.importSuccess,COLOR.green)
cur=#MISSION
else
LOG.print(text.dataCorrupted,COLOR.red)
end
elseif key=="escape"then
SCN.back()
elseif type(key)=="number"then
local p=S.cur+1
local p=cur+1
while MISSION[p]==key do p=p+1 end
ins(MISSION,p,key)
S.cur=p
cur=p
else
if key=="space"then
key="_"
@@ -99,27 +101,23 @@ function scene.keyDown(key)
key=string.upper(key)
end
local input=S.input
input=input..key
if missionEnum[input]then
S.cur=S.cur+1
ins(MISSION,S.cur,missionEnum[input])
cur=cur+1
ins(MISSION,cur,missionEnum[input])
SFX.play("lock")
input=""
elseif #input>1 or not legalInput[input]then
input=""
end
S.input=input
end
end
function scene.update()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
if sure>0 then sure=sure-1 end
end
function scene.draw()
local S=sceneTemp
--Draw frame
gc.setLineWidth(4)
gc.setColor(1,1,1)
@@ -128,7 +126,7 @@ function scene.draw()
--Draw inputing target
setFont(30)
gc.setColor(.9,.9,.9)
gc.print(S.input,1200,275)
gc.print(input,1200,275)
--Draw targets
local libColor=SKIN.libColor
@@ -149,7 +147,7 @@ function scene.draw()
gc.print(count,x+5,y-13)
x=x+(count<10 and 33 or 45)
count=1
if i==S.cur+1 then
if i==cur+1 then
cx,cy=x,y
end
end
@@ -170,7 +168,7 @@ function scene.draw()
x=x+56
end
end
if i==S.cur then
if i==cur then
cx,cy=x,y
end
i=i+1
@@ -181,8 +179,8 @@ function scene.draw()
gc.line(cx-5,cy-20,cx-5,cy+20)
--Confirm reset
if S.sure>0 then
gc.setColor(1,1,1,S.sure*.02)
if sure>0 then
gc.setColor(1,1,1,sure*.02)
gc.draw(drawableText.question,980,570)
end
end

View File

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

View File

@@ -8,40 +8,42 @@ local find,sub=string.find,string.sub
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()
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")
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
local function clearResult()
local S=sceneTemp
local result=S.result
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
local function search()
clearResult()
local S=sceneTemp
local dict=S.dict
local result=S.result
local first
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
ins(result,1,dict[i])
first=true
@@ -52,63 +54,61 @@ local function search()
if result[1]then
SFX.play("reach")
end
S.url=(S.result[1]and S.result or S.dict)[S.select][5]
S.lastSearch=S.input
url=(result[1]and result or dict)[selected][5]
lastSearch=input
end
function scene.keyDown(key)
local S=sceneTemp
if #key==1 then
if #S.input<15 then
S.input=S.input..key
S.waiting=.8
if #input<15 then
input=input..key
waiting=.8
end
elseif key=="up"then
if S.select and S.select>1 then
S.select=S.select-1
if S.select<S.scroll+1 then
S.scroll=S.scroll-1
if selected and selected>1 then
selected=selected-1
if selected<scrollPos+1 then
scrollPos=scrollPos-1
end
end
elseif key=="down"then
if S.select and S.select<#(S.result[1]and S.result or S.dict)then
S.select=S.select+1
if S.select>S.scroll+15 then
S.scroll=S.select-15
if selected and selected<#(result[1]and result or dict)then
selected=selected+1
if selected>scrollPos+15 then
scrollPos=selected-15
end
end
elseif key=="link"then
love.system.openURL(S.url)
love.system.openURL(url)
elseif key=="delete"then
if #S.input>0 then
if #input>0 then
clearResult()
S.input=""
input=""
SFX.play("hold")
end
elseif key=="backspace"then
S.input=sub(S.input,1,-2)
if #S.input==0 then
input=sub(input,1,-2)
if #input==0 then
clearResult()
else
S.waiting=.8
waiting=.8
end
elseif key=="escape"then
if #S.input>0 then
if #input>0 then
clearResult()
S.input=""
input=""
else
SCN.back()
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
function scene.update(dt)
local S=sceneTemp
if S.waiting>0 then
S.waiting=S.waiting-dt
if S.waiting<=0 then
if #S.input>0 and S.input~=S.lastSearch then
if waiting>0 then
waiting=waiting-dt
if waiting<=0 then
if #input>0 and input~=lastSearch then
search()
end
end
@@ -124,17 +124,16 @@ local typeColor={
name=COLOR.lPurple,
}
function scene.draw()
local S=sceneTemp
gc.setLineWidth(4)
gc.setColor(1,1,1)
gc.rectangle("line",20,110,726,60)
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)
local text=list[S.select][4]
local text=list[selected][4]
if #text>900 then
setFont(15)
elseif #text>600 then
@@ -148,12 +147,12 @@ function scene.draw()
setFont(30)
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)
for i=1,min(#list,15)do
local y=142+35*i
i=i+S.scroll
i=i+scrollPos
local item=list[i]
gc.setColor(0,0,0)
gc.print(item[1],29,y-1)
@@ -168,7 +167,7 @@ function scene.draw()
gc.rectangle("line",300,180,958,526)
gc.rectangle("line",20,180,280,526)
if S.waiting>0 then
if waiting>0 then
local r=Timer()*2
local R=int(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1))
@@ -179,7 +178,7 @@ end
scene.widgetList={
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="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="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},

View File

@@ -3,15 +3,16 @@ local max,min=math.max,math.min
local scene={}
local texts--Text list
local scrollPos--Scroll down length
function scene.sceneInit()
BG.set("rainbow")
sceneTemp={
text=require"parts/updateLog",--Text list
pos=1,--Scroll pos
}
texts=require"parts/updateLog"
scrollPos=1
if newVersionLaunch then
newVersionLaunch=nil
sceneTemp.pos=3
scrollPos=3
end
end
@@ -20,9 +21,9 @@ function scene.wheelMoved(_,y)
end
function scene.keyDown(key)
if key=="up"then
sceneTemp.pos=max(sceneTemp.pos-1,1)
scrollPos=max(scrollPos-1,1)
elseif key=="down"then
sceneTemp.pos=min(sceneTemp.pos+1,#sceneTemp.text)
scrollPos=min(scrollPos+1,#texts)
elseif key=="escape"then
SCN.back()
end
@@ -35,13 +36,12 @@ function scene.draw()
gc.setLineWidth(4)
gc.rectangle("line",30,45,1000,632)
setFont(20)
local S=sceneTemp
gc.print(S.text[S.pos],40,50)
gc.print(texts[scrollPos],40,50)
end
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="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="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 scrollPos==#texts end},
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 t1,t2,r
function scene.sceneInit()
BG.set("space")
BGM.play("blank")
sceneTemp={
t1=0,--Timer 1
t2=0,--Timer 2
r={},--Random animation type
}
for i=1,8 do
sceneTemp.r[i]=rnd(5)
end
t1,t2=0,0--Timer
r={}--Random animation type
for i=1,8 do r[i]=rnd(5)end
end
function scene.mouseDown(_,_,k)
@@ -49,9 +46,8 @@ function scene.keyDown(key)
end
function scene.update()
local S=sceneTemp
S.t1=S.t1+1
S.t2=S.t2+1
t1=t1+1
t2=t2+1
end
local titleTransform={
@@ -74,8 +70,7 @@ local titleTransform={
end,
}
function scene.draw()
local S=sceneTemp
local T=(S.t1+110)%300
local T=(t1+110)%300
if T<30 then
gc.setLineWidth(4+(30-T)^1.626/62)
else
@@ -85,12 +80,12 @@ function scene.draw()
gc.push("transform")
gc.translate(126,226)
for i=1,8 do
local t=S.t1-i*15
local t=t1-i*15
if t>0 then
gc.push("transform")
gc.setColor(1,1,1,min(t*.025,1))
titleTransform[S.r[i]](t,i)
local dt=(S.t1+62-5*i)%300
titleTransform[r[i]](t,i)
local dt=(t1+62-5*i)%300
if dt<20 then
gc.translate(0,abs(10-dt)-10)
end
@@ -99,8 +94,8 @@ function scene.draw()
end
end
gc.pop()
if S.t2>=80 then
gc.setColor(1,1,1,.6+sin((S.t2-80)*.0626)*.3)
if t2>=80 then
gc.setColor(1,1,1,.6+sin((t2-80)*.0626)*.3)
mText(drawableText.anykey,640,615+sin(Timer()*3)*5)
end
end

View File

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

View File

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

View File

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

View File

@@ -27,19 +27,26 @@ local levels={
local scene={}
local levelName
local targetString
local progress
local frameKeyCount
local mistake
local startTime
local time
local state
function scene.sceneInit()
BG.set("bg2")
BGM.play("way")
sceneTemp={
level="A_Z",
target=levels.A_Z,
count=1,
frameKeyCount=0,
error=0,
startTime=0,
time=0,
state=0,
}
levelName="A_Z"
targetString=levels.A_Z
progress=1
frameKeyCount=0
mistake=0
startTime=0
time=0
state=0
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
@@ -47,79 +54,75 @@ function scene.sceneBack()
end
function scene.keyDown(key)
local S=sceneTemp
if #key==1 then
if S.state<2 and S.frameKeyCount<3 then
if key:upper():byte()==S.target:byte(S.count)then
S.count=S.count+1
S.frameKeyCount=S.frameKeyCount+1
if state<2 and frameKeyCount<3 then
if key:upper():byte()==targetString:byte(progress)then
progress=progress+1
frameKeyCount=frameKeyCount+1
TEXT.show(key:upper(),rnd(320,960),rnd(100,240),90,"score",2.6)
SFX.play("move")
if S.count==2 then
S.state=1
S.startTime=Timer()
elseif S.count>#S.target then
S.time=Timer()-S.startTime
S.state=2
if progress==2 then
state=1
startTime=Timer()
elseif progress>#targetString then
time=Timer()-startTime
state=2
SFX.play("reach")
end
elseif S.count>1 then
S.error=S.error+1
elseif progress>1 then
mistake=mistake+1
SFX.play("finesseError")
end
end
elseif key=="space"then
S.count=1
S.error=0
S.time=0
S.state=0
progress=1
mistake=0
time=0
state=0
elseif key=="escape"then
SCN.back()
end
end
function scene.update()
local S=sceneTemp
if S.state==1 then
S.frameKeyCount=0
S.time=Timer()-S.startTime
if state==1 then
frameKeyCount=0
time=Timer()-startTime
end
end
function scene.draw()
local S=sceneTemp
setFont(40)
gc.setColor(1,1,1)
gc.print(format("%.3f",S.time),1026,80)
gc.print(S.error,1026,150)
gc.print(format("%.3f",time),1026,80)
gc.print(mistake,1026,150)
if S.state>0 then
gc.print(format("%.3f/s",(S.count-1)/S.time),1026,220)
if state>0 then
gc.print(format("%.3f/s",(progress-1)/time),1026,220)
end
if S.state==2 then
if state==2 then
gc.setColor(.9,.9,0)--win
elseif S.state==1 then
elseif state==1 then
gc.setColor(.9,.9,.9)--game
elseif S.state==0 then
elseif state==0 then
gc.setColor(.2,.8,.2)--ready
end
setFont(100)
mStr(S.state==1 and #S.target-S.count+1 or S.state==0 and"Ready"or S.state==2 and"Win",640,200)
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.print(S.target:sub(S.count,S.count),120,280,0,2)
gc.print(S.target:sub(S.count+1),310,380)
gc.print(targetString:sub(progress,progress),120,280,0,2)
gc.print(targetString:sub(progress+1),310,380)
gc.setColor(1,1,1,.7)
setFont(40)
gc.print(S.target,120,520)
gc.print(targetString,120,520)
end
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="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},

View File

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

View File

@@ -12,61 +12,67 @@ local rem=table.remove
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()
BGM.play("way")
sceneTemp={
board={},
rank=3,
blind=false,
disappear=false,
tapFX=true,
board={}
rank=3
blind=false
disappear=false
tapFX=true
startTime=0,
time=0,
error=0,
state=0,
progress=0,
}
startTime=0
time=0
mistake=0
state=0
progress=0
end
local function newBoard()
local S=sceneTemp
local L={}
for i=1,S.rank^2 do
for i=1,rank^2 do
L[i]=i
end
for i=1,S.rank^2 do
S.board[i]=rem(L,rnd(#L))
for i=1,rank^2 do
board[i]=rem(L,rnd(#L))
end
end
local function tapBoard(x,y)
local S=sceneTemp
local R=S.rank
local R=rank
if x>320 and x<960 and y>40 and y<680 then
if S.state==0 then
if state==0 then
newBoard()
S.state=1
S.startTime=Timer()
S.progress=0
elseif S.state==1 then
state=1
startTime=Timer()
progress=0
elseif state==1 then
local X=int((x-320)/640*R)
local Y=int((y-40)/640*R)
x=R*Y+X+1
if S.board[x]==S.progress+1 then
S.progress=S.progress+1
if S.progress<R^2 then
if board[x]==progress+1 then
progress=progress+1
if progress<R^2 then
SFX.play("lock")
else
S.time=Timer()-S.startTime+S.error
S.state=2
time=Timer()-startTime+mistake
state=2
SFX.play("reach")
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)
end
else
S.error=S.error+1
if S.tapFX then
mistake=mistake+1
if tapFX then
SYSFX.newShade(2,320+640/R*X,40+640/R*Y,640/R,640/R,1,.4,.5)
end
SFX.play("finesseError")
@@ -82,32 +88,31 @@ function scene.touchDown(_,x,y)
tapBoard(x,y)
end
function scene.keyDown(key)
local S=sceneTemp
if key=="z"or key=="x"then
love.mousepressed(ms.getPosition())
elseif key=="space"then
if sceneTemp.state>0 then
S.board={}
S.time=0
S.error=0
S.state=0
S.progress=0
if state>0 then
board={}
time=0
mistake=0
state=0
progress=0
end
elseif key=="q"then
if S.state==0 then
S.blind=not S.blind
if state==0 then
blind=not blind
end
elseif key=="w"then
if S.state==0 then
S.disappear=not S.disappear
if state==0 then
disappear=not disappear
end
elseif key=="e"then
if S.state==0 then
S.tapFX=not S.tapFX
if state==0 then
tapFX=not tapFX
end
elseif key=="3"or key=="4"or key=="5"or key=="6"then
if S.state==0 then
S.rank=tonumber(key)
if state==0 then
rank=tonumber(key)
end
elseif key=="escape"then
SCN.back()
@@ -115,52 +120,48 @@ function scene.keyDown(key)
end
function scene.update()
local S=sceneTemp
if S.state==1 then
S.time=Timer()-S.startTime+S.error
if state==1 then
time=Timer()-startTime+mistake
end
end
function scene.draw()
local S=sceneTemp
setFont(40)
gc.setColor(1,1,1)
gc.print(format("%.3f",S.time),1026,80)
gc.print(S.error,1026,150)
gc.print(format("%.3f",time),1026,80)
gc.print(mistake,1026,150)
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
gc.setColor(1,0,0,.3)
gc.rectangle("fill",15,295,285,250)
gc.setColor(.9,.9,0)--win
elseif S.state==1 then
elseif state==1 then
gc.setColor(.9,.9,.9)--game
elseif S.state==0 then
elseif state==0 then
gc.setColor(.2,.8,.2)--ready
end
gc.setLineWidth(10)
gc.rectangle("line",310,30,660,660)
local rank=S.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)
local f=180-rank*20
setFont(f)
for i=1,rank do
for j=1,rank do
local N=S.board[rank*(i-1)+j]
if not(S.state==1 and S.disappear and N<=S.progress)then
local N=board[rank*(i-1)+j]
if not(state==1 and disappear and N<=progress)then
gc.setColor(.4,.5,.6)
gc.rectangle("fill",320+(j-1)*width,(i-1)*width+40,width,width)
gc.setColor(1,1,1)
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
gc.setColor(.1,.1,.1)
mStr(N,x-3,y-1)
@@ -174,11 +175,11 @@ function scene.draw()
end
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.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.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="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="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.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 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=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=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=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},
}

View File

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

View File

@@ -5,17 +5,19 @@ local sin=math.sin
local scene={}
local selected--Music selected
local bgmList=BGM.getList()
function scene.sceneInit()
if BGM.nowPlay then
for i=1,BGM.getCount()do
if bgmList[i]==BGM.nowPlay then
sceneTemp=i--Music selected
selected=i
return
end
end
else
sceneTemp=1
selected=1
end
end
@@ -23,15 +25,15 @@ function scene.wheelMoved(_,y)
wheelScroll(y)
end
function scene.keyDown(key)
local S=sceneTemp
local S=selected
if key=="down"then
if S<BGM.getCount()then
sceneTemp=S+1
selected=S+1
SFX.play("move",.7)
end
elseif key=="up"then
if S>1 then
sceneTemp=S-1
selected=S-1
SFX.play("move",.7)
end
elseif key=="return"or key=="space"then
@@ -50,13 +52,13 @@ function scene.draw()
gc.setColor(1,1,1)
setFont(50)
gc.print(bgmList[sceneTemp],320,355)
gc.print(bgmList[selected],320,355)
setFont(35)
if sceneTemp>1 then gc.print(bgmList[sceneTemp-1],320,350-30)end
if sceneTemp<BGM.getCount()then gc.print(bgmList[sceneTemp+1],320,350+65)end
if selected>1 then gc.print(bgmList[selected-1],320,350-30)end
if selected<BGM.getCount()then gc.print(bgmList[selected+1],320,350+65)end
setFont(20)
if sceneTemp>2 then gc.print(bgmList[sceneTemp-2],320,350-50)end
if sceneTemp<BGM.getCount()-1 then gc.print(bgmList[sceneTemp+2],320,350+110)end
if selected>2 then gc.print(bgmList[selected-2],320,350-50)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)
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="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.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="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},
}

View File

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

View File

@@ -1,7 +1,7 @@
local scene={}
function scene.sceneInit()
sceneTemp={reset=false}
sure=false
end
function scene.keyDown(key)
LOG.print("keyPress: ["..key.."]")
@@ -36,7 +36,7 @@ local function parseCB()
end
end
local function HIDE()
return not sceneTemp.reset
return not sure
end
scene.widgetList={
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},
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",
code=function()
love.filesystem.remove("unlock.dat")

View File

@@ -3,53 +3,50 @@ local int=math.floor
local scene={}
local das,arr
local pos,dir,wait
function scene.sceneInit()
sceneTemp={
das=SETTING.das,
arr=SETTING.arr,
pos=0,
dir=1,
wait=30,
}
das,arr=SETTING.das,SETTING.arr
pos,dir,wait=0,1,30
BG.set("bg1")
end
function scene.update()
local T=sceneTemp
if T.wait>0 then
T.wait=T.wait-1
if T.wait==0 then
T.pos=T.pos+T.dir
if wait>0 then
wait=wait-1
if wait==0 then
pos=pos+dir
else
return
end
end
if T.das>0 then
T.das=T.das-1
if T.das==0 then
if T.arr==0 then
T.pos=T.pos+7*T.dir
T.das=SETTING.das+1
T.arr=SETTING.arr
T.dir=-T.dir
T.wait=26
if das>0 then
das=das-1
if das==0 then
if arr==0 then
pos=pos+7*dir
das=SETTING.das+1
arr=SETTING.arr
dir=-dir
wait=26
else
T.pos=T.pos+T.dir
pos=pos+dir
end
end
else
T.arr=T.arr-1
if T.arr==0 then
T.pos=T.pos+T.dir
T.arr=SETTING.arr
elseif T.arr==-1 then
T.pos=T.dir>0 and 8 or 0
T.arr=SETTING.arr
arr=arr-1
if arr==0 then
pos=pos+dir
arr=SETTING.arr
elseif arr==-1 then
pos=dir>0 and 8 or 0
arr=SETTING.arr
end
if T.pos%8==0 then
T.dir=-T.dir
T.wait=26
T.das=SETTING.das
if pos%8==0 then
dir=-dir
wait=26
das=SETTING.das
end
end
end
@@ -70,7 +67,7 @@ function scene.draw()
--O mino animation
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,580,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 page
local kb,js--Selected
local kS,jS--If setting
function scene.sceneInit()
sceneTemp={
board=1,
kb=1,js=1,
kS=false,jS=false,
}
page=1
kb,js=1,1
kS,jS=false,false
end
function scene.sceneBack()
FILE.save(keyMap,"key")
end
function scene.keyDown(key)
local S=sceneTemp
if key=="escape"then
if S.kS then
S.kS=false
if kS then
kS=false
SFX.play("finesseError",.5)
else
SCN.back()
end
elseif S.kS then
elseif kS then
if key~="\\"then
for y=1,20 do
if keyMap[1][y]==key then keyMap[1][y]=""break end
if keyMap[2][y]==key then keyMap[2][y]=""break end
end
keyMap[S.board][S.kb]=key
S.kS=false
keyMap[page][kb]=key
kS=false
SFX.play("reach",.5)
end
elseif key=="return"or key=="space"then
S.kS=true
kS=true
SFX.play("lock",.5)
elseif key=="up"or key=="w"then
if S.kb>1 then
S.kb=S.kb-1
if kb>1 then
kb=kb-1
SFX.play("move",.5)
end
elseif key=="down"or key=="s"then
if S.kb<20 then
S.kb=S.kb+1
if kb<20 then
kb=kb+1
SFX.play("move",.5)
end
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)
end
end
function scene.gamepadDown(key)
local S=sceneTemp
if key=="back"then
if S.jS then
S.jS=false
if jS then
jS=false
SFX.play("finesseError",.5)
else
SCN.back()
end
elseif S.jS then
elseif jS then
for y=1,20 do
if keyMap[3][y]==key then keyMap[3][y]=""break end
if keyMap[4][y]==key then keyMap[4][y]=""break end
end
keyMap[2+S.board][S.js]=key
keyMap[2+page][js]=key
SFX.play("reach",.5)
S.jS=false
jS=false
elseif key=="start"then
S.jS=true
jS=true
SFX.play("lock",.5)
elseif key=="dpup"then
if S.js>1 then
S.js=S.js-1
if js>1 then
js=js-1
SFX.play("move",.5)
end
elseif key=="dpdown"then
if S.js<20 then
S.js=S.js+1
if js<20 then
js=js+1
SFX.play("move",.5)
end
elseif key=="dpleft"or key=="dpright"then
S.board=3-S.board
page=3-page
SFX.play("rotate",.5)
end
end
function scene.draw()
local S=sceneTemp
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",
S.kb<11 and 240 or 840,
45*S.kb+20-450*int(S.kb/11),
kb<11 and 240 or 840,
45*kb+20-450*int(kb/11),
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",
S.js<11 and 440 or 1040,
45*S.js+20-450*int(S.js/11),
js<11 and 440 or 1040,
45*js+20-450*int(js/11),
200,45
)
--Selection rect
gc.setColor(1,1,1)
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
if N<11 then
gc.printf(text.acts[N],47,45*N+22,180,"right")
@@ -130,7 +129,7 @@ function scene.draw()
gc.line(40,y,1240,y)
end
setFont(35)
gc.print(text.page..S.board,280,570)
gc.print(text.page..page,280,570)
end
scene.widgetList={

View File

@@ -6,12 +6,14 @@ local rnd=math.random
local scene={}
local last--Last touch time
local jump--Animation timer(10 to 0)
local cv
function scene.sceneInit()
sceneTemp={
last=0,--Last touch time
jump=0,--Animation timer(10 to 0)
cv=SETTING.cv,
}
last=0
jump=0
cv=SETTING.cv
BG.set("space")
end
function scene.sceneBack()
@@ -19,13 +21,12 @@ function scene.sceneBack()
end
function scene.mouseDown(x,y)
local S=sceneTemp
if x>780 and x<980 and y>470 and S.jump==0 then
S.jump=10
local t=Timer()-S.last
if x>780 and x<980 and y>470 and jump==0 then
jump=10
local t=Timer()-last
if t>1 then
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
@@ -34,16 +35,16 @@ function scene.touchDown(_,x,y)
end
function scene.update()
local t=sceneTemp.jump
local t=jump
if t>0 then
sceneTemp.jump=t-1
jump=t-1
end
end
function scene.draw()
gc.setColor(1,1,1)
local t=Timer()
local _=sceneTemp.jump
local _=jump
local x,y=800,340+10*sin(t*.5)+(_-10)*_*.3
gc.translate(x,y)
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="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.newSelector{name="cv", x=1100, y=380,w=200, list={"miya","naki"}, disp=WIDGET.lnk_STPval("cv"),code=WIDGET.lnk_STPsto("cv")},
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.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=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},
}

View File

@@ -6,13 +6,15 @@ local int,sin=math.floor,math.sin
local scene={}
local defaultSetSelect
local snapUnit
local select--Button selected
function scene.sceneInit()
BG.set("rainbow")
sceneTemp={
default=1,
snap=1,
sel=nil,
}
defaultSetSelect=1
snapUnit=1
select=nil
end
function scene.sceneBack()
FILE.save(VK_org,"virtualkey")
@@ -35,34 +37,34 @@ local function onVK_org(x,y)
end
function scene.mouseDown(x,y,k)
if k==2 then SCN.back()end
sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel
select=onVK_org(x,y)or select
end
function scene.mouseMove(_,_,dx,dy)
if sceneTemp.sel and ms.isDown(1)and not WIDGET.sel then
local B=VK_org[sceneTemp.sel]
if select and ms.isDown(1)and not WIDGET.sel then
local B=VK_org[select]
B.x,B.y=B.x+dx,B.y+dy
end
end
function scene.mouseUp()
if sceneTemp.sel then
local B=VK_org[sceneTemp.sel]
local k=sceneTemp.snap
if select then
local B=VK_org[select]
local k=snapUnit
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end
end
function scene.touchDown(_,x,y)
sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel
select=onVK_org(x,y)or select
end
function scene.touchUp()
if sceneTemp.sel then
local B=VK_org[sceneTemp.sel]
local k=sceneTemp.snap
if select then
local B=VK_org[select]
local k=snapUnit
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end
end
function scene.touchMove(_,_,_,dx,dy)
if sceneTemp.sel and not WIDGET.sel then
local B=VK_org[sceneTemp.sel]
if select and not WIDGET.sel then
local B=VK_org[select]
B.x,B.y=B.x+dx,B.y+dy
end
end
@@ -72,7 +74,7 @@ local function VirtualkeyPreview()
for i=1,#VK_org do
local B=VK_org[i]
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.setLineWidth(B.r*.07)
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(3)gc.rectangle("line",490,85,300,600)
VirtualkeyPreview()
local d=sceneTemp.snap
local d=snapUnit
if d>=10 then
gc.setLineWidth(3)
gc.setColor(1,1,1,sin(Timer()*4)*.1+.1)
@@ -172,9 +174,9 @@ local virtualkeySet={
},--PC key feedback(top&in a row)
}
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()
local D=virtualkeySet[sceneTemp.default]
local D=virtualkeySet[defaultSetSelect]
for i=1,#VK_org do
VK_org[i].ava=false
end
@@ -188,27 +190,27 @@ scene.widgetList={
B.x,B.y,B.r=T[2],T[3],T[4]
end
end
sceneTemp.default=sceneTemp.default%5+1
sceneTemp.sel=nil
LOG.print("[ "..sceneTemp.default.." ]")
defaultSetSelect=defaultSetSelect%5+1
select=nil
LOG.print("[ "..defaultSetSelect.." ]")
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,
code=function()
SCN.go("setting_touchSwitch")
end},
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.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",
disp=function()
return VK_org[sceneTemp.sel].r/10-1
return VK_org[select].r/10-1
end,
code=function(v)
if sceneTemp.sel then
VK_org[sceneTemp.sel].r=(v+1)*10
if select then
VK_org[select].r=(v+1)*10
end
end,
hide=function()
return not sceneTemp.sel
return not select
end},
}

View File

@@ -2,40 +2,36 @@ local int=math.floor
local scene={}
local mini,b2b,b3b,pc
function scene.sceneInit()
sceneTemp={
mini=false,
b2b=false,
b3b=false,
pc=false,
}
mini,b2b,b3b,pc=false,false,false,false
end
local blockName={"z","s","j","l","t","o","i"}
local lineCount={"single","double","triple","techrash"}
function scene.keyDown(key)
local S=sceneTemp
if key=="1"then
S.mini=not S.mini
mini=not mini
elseif key=="2"then
S.b2b=not S.b2b
if S.b2b then S.b3b=false end
b2b=not b2b
if b2b then b3b=false end
elseif key=="3"then
S.b3b=not S.b3b
if S.b3b then S.b2b=false end
b3b=not b3b
if b3b then b2b=false end
elseif key=="4"then
S.pc=not S.pc
pc=not pc
elseif type(key)=="number"then
local CHN=VOC.getFreeChannel()
if S.mini then VOC.play("mini",CHN)end
if S.b2b then VOC.play("b2b",CHN)
elseif S.b3b then VOC.play("b3b",CHN)
if mini then VOC.play("mini",CHN)end
if b2b then VOC.play("b2b",CHN)
elseif b3b then VOC.play("b3b",CHN)
end
if key>=10 then
VOC.play(blockName[int(key/10)].."spin",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
SCN.back()
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="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="b2b", x=515, y=530,font=25,disp=WIDGET.lnk_STPval("b2b"),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="pc", x=515, y=660,font=25,disp=WIDGET.lnk_STPval("pc"),code=WIDGET.lnk_pressKey("4")},
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=function()return b2b end,code=WIDGET.lnk_pressKey("2")},
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=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},
}

View File

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

View File

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