代码规范:把所有的tab换成空格
This commit is contained in:
@@ -5,48 +5,48 @@ local sin=math.sin
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
BG.set()
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Texts
|
||||
setFont(20)
|
||||
gc.setColor(COLOR.Z)
|
||||
for i=1,#text.aboutTexts do
|
||||
gc.printf(text.aboutTexts[i],150,35*i+50,1000,'center')
|
||||
end
|
||||
--Texts
|
||||
setFont(20)
|
||||
gc.setColor(COLOR.Z)
|
||||
for i=1,#text.aboutTexts do
|
||||
gc.printf(text.aboutTexts[i],150,35*i+50,1000,'center')
|
||||
end
|
||||
|
||||
--Group
|
||||
setFont(20)
|
||||
mStr(text.group,640,480)
|
||||
--Group
|
||||
setFont(20)
|
||||
mStr(text.group,640,480)
|
||||
|
||||
--Lib used
|
||||
setFont(15)
|
||||
gc.print(text.used,30,320)
|
||||
--Lib used
|
||||
setFont(15)
|
||||
gc.print(text.used,30,320)
|
||||
|
||||
--Logo
|
||||
local t=TIME()
|
||||
gc.draw(TEXTURE.title,280,610,.1,.4+.03*sin(t*2.6),nil,580,118)
|
||||
gc.setLineWidth(3)
|
||||
--Logo
|
||||
local t=TIME()
|
||||
gc.draw(TEXTURE.title,280,610,.1,.4+.03*sin(t*2.6),nil,580,118)
|
||||
gc.setLineWidth(3)
|
||||
|
||||
--QR Code frame
|
||||
gc.rectangle('line',18,18,263,263)
|
||||
gc.rectangle('line',1012,18,250,250)
|
||||
--QR Code frame
|
||||
gc.rectangle('line',18,18,263,263)
|
||||
gc.rectangle('line',1012,18,250,250)
|
||||
|
||||
--Support text
|
||||
gc.setColor(1,1,1,sin(t*20)*.3+.6)
|
||||
setFont(30)
|
||||
mStr(text.support,150+sin(t*4)*20,283)
|
||||
mStr(text.support,1138-sin(t*4)*20,270)
|
||||
--Support text
|
||||
gc.setColor(1,1,1,sin(t*20)*.3+.6)
|
||||
setFont(30)
|
||||
mStr(text.support,150+sin(t*4)*20,283)
|
||||
mStr(text.support,1138-sin(t*4)*20,270)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newImage{name="pay1", x=20, y=20},
|
||||
WIDGET.newImage{name="pay2", x=1014, y=20},
|
||||
WIDGET.newButton{name="staff", x=1140, y=400,w=220,h=80,font=35,code=goScene'staff'},
|
||||
WIDGET.newButton{name="his", x=1140, y=500,w=220,h=80,font=35,code=goScene'history'},
|
||||
WIDGET.newButton{name="qq", x=1140, y=600,w=220,h=80,font=35,code=function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,hide=MOBILE},
|
||||
WIDGET.newButton{name="back", x=640, y=600,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newImage{name="pay1", x=20, y=20},
|
||||
WIDGET.newImage{name="pay2", x=1014,y=20},
|
||||
WIDGET.newButton{name="staff", x=1140,y=400,w=220,h=80,font=35,code=goScene'staff'},
|
||||
WIDGET.newButton{name="his", x=1140,y=500,w=220,h=80,font=35,code=goScene'history'},
|
||||
WIDGET.newButton{name="qq", x=1140,y=600,w=220,h=80,font=35,code=function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,hide=MOBILE},
|
||||
WIDGET.newButton{name="back", x=640, y=600,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -7,8 +7,8 @@ function scene.sceneInit()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title",x=80,y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newText{name="title",x=80,y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -13,318 +13,318 @@ local color,blind='color1'
|
||||
local slide,pathVis,revKB
|
||||
|
||||
local function ifGaming()return state==1 end
|
||||
local colorSelector=WIDGET.newSelector{name="color",x=150,y=240,w=200,list={'color1','rainbow','color2','gray','black'},color='lY',disp=function()return color end, code=function(v)if state~=1 then color=v end end,hideF=ifGaming}
|
||||
local colorSelector=WIDGET.newSelector{name="color",x=150,y=240,w=200,list={'color1','rainbow','color2','gray','black'},color='lY',disp=function()return color end, code=function(v)if state~=1 then color=v end end,hideF=ifGaming}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('rainbow2')
|
||||
BGM.play('push')
|
||||
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,push=0,0
|
||||
state=2
|
||||
BG.set('rainbow2')
|
||||
BGM.play('push')
|
||||
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,push=0,0
|
||||
state=2
|
||||
|
||||
color='color1'
|
||||
blind=false
|
||||
slide=true
|
||||
pathVis=true
|
||||
revKB=false
|
||||
color='color1'
|
||||
blind=false
|
||||
slide=true
|
||||
pathVis=true
|
||||
revKB=false
|
||||
end
|
||||
|
||||
local function moveU(x,y)
|
||||
if y<4 then
|
||||
board[y][x],board[y+1][x]=board[y+1][x],board[y][x]
|
||||
cy=cy+1
|
||||
end
|
||||
if y<4 then
|
||||
board[y][x],board[y+1][x]=board[y+1][x],board[y][x]
|
||||
cy=cy+1
|
||||
end
|
||||
end
|
||||
local function moveD(x,y)
|
||||
if y>1 then
|
||||
board[y][x],board[y-1][x]=board[y-1][x],board[y][x]
|
||||
cy=cy-1
|
||||
end
|
||||
if y>1 then
|
||||
board[y][x],board[y-1][x]=board[y-1][x],board[y][x]
|
||||
cy=cy-1
|
||||
end
|
||||
end
|
||||
local function moveL(x,y)
|
||||
if x<4 then
|
||||
board[y][x],board[y][x+1]=board[y][x+1],board[y][x]
|
||||
cx=cx+1
|
||||
end
|
||||
if x<4 then
|
||||
board[y][x],board[y][x+1]=board[y][x+1],board[y][x]
|
||||
cx=cx+1
|
||||
end
|
||||
end
|
||||
local function moveR(x,y)
|
||||
if x>1 then
|
||||
board[y][x],board[y][x-1]=board[y][x-1],board[y][x]
|
||||
cx=cx-1
|
||||
end
|
||||
if x>1 then
|
||||
board[y][x],board[y][x-1]=board[y][x-1],board[y][x]
|
||||
cx=cx-1
|
||||
end
|
||||
end
|
||||
local function shuffleBoard()
|
||||
for i=1,300 do
|
||||
i=rnd()
|
||||
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
|
||||
for i=1,300 do
|
||||
i=rnd()
|
||||
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
|
||||
local function checkBoard(b)
|
||||
for i=4,1,-1 do
|
||||
for j=1,4 do
|
||||
if b[i][j]~=4*i+j-4 then return false end
|
||||
end
|
||||
end
|
||||
return true
|
||||
for i=4,1,-1 do
|
||||
for j=1,4 do
|
||||
if b[i][j]~=4*i+j-4 then return false end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
local function tapBoard(x,y,key)
|
||||
if state<2 then
|
||||
if not key then
|
||||
if pathVis then
|
||||
SYSFX.newShade(6,x-5,y-5,11,11,1,1,1)
|
||||
end
|
||||
x,y=int((x-320)/160)+1,int((y-40)/160)+1
|
||||
end
|
||||
local b=board
|
||||
local moves=0
|
||||
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<cy and y>0 then
|
||||
for i=cy,y+1,-1 do
|
||||
moveD(x,i)
|
||||
moves=moves+1
|
||||
end
|
||||
end
|
||||
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<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
|
||||
push=push+1
|
||||
move=move+moves
|
||||
if state==0 then
|
||||
state=1
|
||||
startTime=TIME()
|
||||
end
|
||||
if checkBoard(b)then
|
||||
state=2
|
||||
time=TIME()-startTime
|
||||
if time<1 then MES.new(false,"不是人")
|
||||
elseif time<2 then MES.new(false,"还是人")
|
||||
elseif time<3 then MES.new(false,"神仙")
|
||||
elseif time<5 then MES.new(false,"太强了")
|
||||
elseif time<7.5 then MES.new(false,"很强")
|
||||
elseif time<10 then MES.new(false,"可以的")
|
||||
elseif time<20 then MES.new(false,"马上入门了")
|
||||
elseif time<30 then MES.new(false,"入门不远了")
|
||||
elseif time<60 then MES.new(false,"多加练习")
|
||||
else MES.new(false,"第一次玩?加油")
|
||||
end
|
||||
SFX.play('win')
|
||||
return
|
||||
end
|
||||
SFX.play('move')
|
||||
end
|
||||
end
|
||||
if state<2 then
|
||||
if not key then
|
||||
if pathVis then
|
||||
SYSFX.newShade(6,x-5,y-5,11,11,1,1,1)
|
||||
end
|
||||
x,y=int((x-320)/160)+1,int((y-40)/160)+1
|
||||
end
|
||||
local b=board
|
||||
local moves=0
|
||||
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<cy and y>0 then
|
||||
for i=cy,y+1,-1 do
|
||||
moveD(x,i)
|
||||
moves=moves+1
|
||||
end
|
||||
end
|
||||
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<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
|
||||
push=push+1
|
||||
move=move+moves
|
||||
if state==0 then
|
||||
state=1
|
||||
startTime=TIME()
|
||||
end
|
||||
if checkBoard(b)then
|
||||
state=2
|
||||
time=TIME()-startTime
|
||||
if time<1 then MES.new(false,"不是人")
|
||||
elseif time<2 then MES.new(false,"还是人")
|
||||
elseif time<3 then MES.new(false,"神仙")
|
||||
elseif time<5 then MES.new(false,"太强了")
|
||||
elseif time<7.5 then MES.new(false,"很强")
|
||||
elseif time<10 then MES.new(false,"可以的")
|
||||
elseif time<20 then MES.new(false,"马上入门了")
|
||||
elseif time<30 then MES.new(false,"入门不远了")
|
||||
elseif time<60 then MES.new(false,"多加练习")
|
||||
else MES.new(false,"第一次玩?加油")
|
||||
end
|
||||
SFX.play('win')
|
||||
return
|
||||
end
|
||||
SFX.play('move')
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="up"then
|
||||
tapBoard(cx,cy-(revKB and 1 or -1),true)
|
||||
elseif key=="down"then
|
||||
tapBoard(cx,cy+(revKB and 1 or -1),true)
|
||||
elseif key=="left"then
|
||||
tapBoard(cx-(revKB and 1 or -1),cy,true)
|
||||
elseif key=="right"then
|
||||
tapBoard(cx+(revKB and 1 or -1),cy,true)
|
||||
elseif key=="space"then
|
||||
shuffleBoard()
|
||||
state=0
|
||||
time=0
|
||||
move,push=0,0
|
||||
elseif key=="q"then
|
||||
if state~=1 then
|
||||
colorSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
end
|
||||
elseif key=="w"then
|
||||
if state==0 then
|
||||
blind=not blind
|
||||
end
|
||||
elseif key=="e"then
|
||||
if state==0 then
|
||||
slide=not slide
|
||||
if not slide then
|
||||
pathVis=false
|
||||
end
|
||||
end
|
||||
elseif key=="r"then
|
||||
if state==0 and slide then
|
||||
pathVis=not pathVis
|
||||
end
|
||||
elseif key=="t"then
|
||||
if state==0 then
|
||||
revKB=not revKB
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="up"then
|
||||
tapBoard(cx,cy-(revKB and 1 or -1),true)
|
||||
elseif key=="down"then
|
||||
tapBoard(cx,cy+(revKB and 1 or -1),true)
|
||||
elseif key=="left"then
|
||||
tapBoard(cx-(revKB and 1 or -1),cy,true)
|
||||
elseif key=="right"then
|
||||
tapBoard(cx+(revKB and 1 or -1),cy,true)
|
||||
elseif key=="space"then
|
||||
shuffleBoard()
|
||||
state=0
|
||||
time=0
|
||||
move,push=0,0
|
||||
elseif key=="q"then
|
||||
if state~=1 then
|
||||
colorSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
end
|
||||
elseif key=="w"then
|
||||
if state==0 then
|
||||
blind=not blind
|
||||
end
|
||||
elseif key=="e"then
|
||||
if state==0 then
|
||||
slide=not slide
|
||||
if not slide then
|
||||
pathVis=false
|
||||
end
|
||||
end
|
||||
elseif key=="r"then
|
||||
if state==0 and slide then
|
||||
pathVis=not pathVis
|
||||
end
|
||||
elseif key=="t"then
|
||||
if state==0 then
|
||||
revKB=not revKB
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(x,y)
|
||||
tapBoard(x,y)
|
||||
tapBoard(x,y)
|
||||
end
|
||||
function scene.mouseMove(x,y)
|
||||
if slide then
|
||||
tapBoard(x,y)
|
||||
end
|
||||
if slide then
|
||||
tapBoard(x,y)
|
||||
end
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
tapBoard(x,y)
|
||||
tapBoard(x,y)
|
||||
end
|
||||
function scene.touchMove(x,y)
|
||||
if slide then
|
||||
tapBoard(x,y)
|
||||
end
|
||||
if slide then
|
||||
tapBoard(x,y)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
end
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
end
|
||||
end
|
||||
|
||||
local frontColor={
|
||||
color1={
|
||||
COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR,
|
||||
COLOR.lG,COLOR.lB,COLOR.lB,COLOR.lB,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
},--Colored(rank)
|
||||
rainbow={
|
||||
COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR,
|
||||
COLOR.lO,COLOR.lY,COLOR.lY,COLOR.lY,
|
||||
COLOR.lO,COLOR.lG,COLOR.lB,COLOR.lB,
|
||||
COLOR.lO,COLOR.lG,COLOR.lB,COLOR.lB,
|
||||
},--Rainbow(rank)
|
||||
color2={
|
||||
COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR,
|
||||
COLOR.lB,COLOR.lB,COLOR.lB,COLOR.lB,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
},--Colored(row)
|
||||
gray={
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
},--Gray
|
||||
black={
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
},--Black
|
||||
color1={
|
||||
COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR,
|
||||
COLOR.lG,COLOR.lB,COLOR.lB,COLOR.lB,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
},--Colored(rank)
|
||||
rainbow={
|
||||
COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR,
|
||||
COLOR.lO,COLOR.lY,COLOR.lY,COLOR.lY,
|
||||
COLOR.lO,COLOR.lG,COLOR.lB,COLOR.lB,
|
||||
COLOR.lO,COLOR.lG,COLOR.lB,COLOR.lB,
|
||||
},--Rainbow(rank)
|
||||
color2={
|
||||
COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR,
|
||||
COLOR.lB,COLOR.lB,COLOR.lB,COLOR.lB,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV,
|
||||
},--Colored(row)
|
||||
gray={
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
},--Gray
|
||||
black={
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
COLOR.Z,COLOR.Z,COLOR.Z,COLOR.Z,
|
||||
},--Black
|
||||
}
|
||||
local backColor={
|
||||
color1={
|
||||
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
|
||||
COLOR.dG,COLOR.dB,COLOR.dB,COLOR.dB,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
},--Colored(rank)
|
||||
rainbow={
|
||||
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
|
||||
COLOR.dO,COLOR.dY,COLOR.dY,COLOR.dY,
|
||||
COLOR.dO,COLOR.dG,COLOR.dB,COLOR.dB,
|
||||
COLOR.dO,COLOR.dG,COLOR.dB,COLOR.dB,
|
||||
},--Rainbow(rank)
|
||||
color2={
|
||||
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
|
||||
COLOR.dB,COLOR.dB,COLOR.dB,COLOR.dB,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
},--Colored(row)
|
||||
gray={
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
},--Gray
|
||||
black={
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
},--Black
|
||||
color1={
|
||||
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
|
||||
COLOR.dG,COLOR.dB,COLOR.dB,COLOR.dB,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
},--Colored(rank)
|
||||
rainbow={
|
||||
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
|
||||
COLOR.dO,COLOR.dY,COLOR.dY,COLOR.dY,
|
||||
COLOR.dO,COLOR.dG,COLOR.dB,COLOR.dB,
|
||||
COLOR.dO,COLOR.dG,COLOR.dB,COLOR.dB,
|
||||
},--Rainbow(rank)
|
||||
color2={
|
||||
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
|
||||
COLOR.dB,COLOR.dB,COLOR.dB,COLOR.dB,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP,
|
||||
},--Colored(row)
|
||||
gray={
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
COLOR.dH,COLOR.dH,COLOR.dH,COLOR.dH,
|
||||
},--Gray
|
||||
black={
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
COLOR.D,COLOR.D,COLOR.D,COLOR.D,
|
||||
},--Black
|
||||
}
|
||||
function scene.draw()
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(("%.3f"):format(time),1026,80)
|
||||
gc.setColor(1,.8,.8)
|
||||
gc.print(move,1026,130)
|
||||
gc.setColor(.8,.8,1)
|
||||
gc.print(push,1026,180)
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(("%.3f"):format(time),1026,80)
|
||||
gc.setColor(1,.8,.8)
|
||||
gc.print(move,1026,130)
|
||||
gc.setColor(.8,.8,1)
|
||||
gc.print(push,1026,180)
|
||||
|
||||
if state==2 then
|
||||
--Draw no-setting area
|
||||
gc.setColor(1,0,0,.3)
|
||||
gc.rectangle('fill',15,295,285,340)
|
||||
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 state==1 then
|
||||
gc.setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
gc.setColor(.2,.8,.2)--ready
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
gc.rectangle('line',313,33,654,654,18)
|
||||
gc.setColor(.9,.9,0)--win
|
||||
elseif state==1 then
|
||||
gc.setColor(.9,.9,.9)--game
|
||||
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 mono=blind and state==1
|
||||
setFont(80)
|
||||
for i=1,4 do
|
||||
for j=1,4 do
|
||||
if cx~=j or cy~=i then
|
||||
local N=board[i][j]
|
||||
local C=mono and'gray'or color
|
||||
gc.setLineWidth(4)
|
||||
local mono=blind and state==1
|
||||
setFont(80)
|
||||
for i=1,4 do
|
||||
for j=1,4 do
|
||||
if cx~=j or cy~=i then
|
||||
local N=board[i][j]
|
||||
local C=mono and'gray'or color
|
||||
|
||||
gc.setColor(backColor[C][N])
|
||||
gc.rectangle('fill',j*160+163,i*160-117,154,154,8)
|
||||
gc.setColor(frontColor[C][N])
|
||||
gc.rectangle('line',j*160+163,i*160-117,154,154,8)
|
||||
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)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(N,j*160+243,i*160-95)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.setColor(0,0,0,.3)
|
||||
gc.setLineWidth(10)
|
||||
gc.rectangle('line',cx*160+173,cy*160-107,134,134,50)
|
||||
gc.setColor(backColor[C][N])
|
||||
gc.rectangle('fill',j*160+163,i*160-117,154,154,8)
|
||||
gc.setColor(frontColor[C][N])
|
||||
gc.rectangle('line',j*160+163,i*160-117,154,154,8)
|
||||
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)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(N,j*160+243,i*160-95)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.setColor(0,0,0,.3)
|
||||
gc.setLineWidth(10)
|
||||
gc.rectangle('line',cx*160+173,cy*160-107,134,134,50)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color='lG', font=40,code=pressKey"space"},
|
||||
colorSelector,
|
||||
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=function()return blind end, code=pressKey"w",hideF=ifGaming},
|
||||
WIDGET.newSwitch{name="slide", x=240,y=420,w=60, font=40,disp=function()return slide end, code=pressKey"e",hideF=ifGaming},
|
||||
WIDGET.newSwitch{name="pathVis",x=240,y=510,w=60, font=40,disp=function()return pathVis end, code=pressKey"r",hideF=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=pressKey"t",hideF=ifGaming},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="reset", x=160, y=100,w=180,h=100,color='lG',font=40,code=pressKey"space"},
|
||||
colorSelector,
|
||||
WIDGET.newSwitch{name="blind", x=240, y=330,w=60,font=40,disp=function()return blind end, code=pressKey"w",hideF=ifGaming},
|
||||
WIDGET.newSwitch{name="slide", x=240, y=420,w=60,font=40,disp=function()return slide end, code=pressKey"e",hideF=ifGaming},
|
||||
WIDGET.newSwitch{name="pathVis",x=240, y=510,w=60,font=40,disp=function()return pathVis end,code=pressKey"r",hideF=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=pressKey"t",hideF=ifGaming},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -23,476 +23,476 @@ local prevSpawnTime=0
|
||||
local maxTile
|
||||
|
||||
local skipper={
|
||||
used=false,
|
||||
cd=0,
|
||||
used=false,
|
||||
cd=0,
|
||||
}
|
||||
local repeater={
|
||||
focus=false,
|
||||
seq={"",""},last={"X","X"},
|
||||
focus=false,
|
||||
seq={"",""},last={"X","X"},
|
||||
}
|
||||
local score
|
||||
|
||||
--[[Tiles' value:
|
||||
-1: black tile, cannot move
|
||||
0: X tile, cannot merge
|
||||
1/2/3/...: 2/4/8/... tile
|
||||
-1: black tile, cannot move
|
||||
0: X tile, cannot merge
|
||||
1/2/3/...: 2/4/8/... tile
|
||||
]]
|
||||
local tileColor={
|
||||
[-1]=COLOR.D,
|
||||
[0]={.5,.3,.3},
|
||||
{.93,.89,.85},
|
||||
{.93,.88,.78},
|
||||
{.95,.69,.47},
|
||||
{.96,.58,.39},
|
||||
{.96,.49,.37},
|
||||
{.96,.37,.23},
|
||||
{.93,.81,.45},
|
||||
{.93,.80,.38},
|
||||
{.93,.78,.31},
|
||||
{.93,.77,.25},
|
||||
{.93,.76,.18},
|
||||
{.40,.37,.33},
|
||||
{.22,.19,.17},
|
||||
[-1]=COLOR.D,
|
||||
[0]={.5,.3,.3},
|
||||
{.93,.89,.85},
|
||||
{.93,.88,.78},
|
||||
{.95,.69,.47},
|
||||
{.96,.58,.39},
|
||||
{.96,.49,.37},
|
||||
{.96,.37,.23},
|
||||
{.93,.81,.45},
|
||||
{.93,.80,.38},
|
||||
{.93,.78,.31},
|
||||
{.93,.77,.25},
|
||||
{.93,.76,.18},
|
||||
{.40,.37,.33},
|
||||
{.22,.19,.17},
|
||||
}
|
||||
local tileFont={
|
||||
80,80,80,--2/4/8
|
||||
70,70,70,--16/32/64
|
||||
60,60,60,--128/256/512
|
||||
55,55,55,55,--1024/2048/4096/8192
|
||||
50,50,50,--16384/32768/65536
|
||||
45,45,45,--131072/262144/524288
|
||||
30,--1048576
|
||||
80,80,80,--2/4/8
|
||||
70,70,70,--16/32/64
|
||||
60,60,60,--128/256/512
|
||||
55,55,55,55,--1024/2048/4096/8192
|
||||
50,50,50,--16384/32768/65536
|
||||
45,45,45,--131072/262144/524288
|
||||
30,--1048576
|
||||
}
|
||||
local tileName={[0]="X","2","4","8","16","32","64","128","256","512","1024","2048","4096","8192","16384","32768","65536","131072","262144","524288","2^20"}
|
||||
local function airExist()
|
||||
for i=1,16 do
|
||||
if not board[i]then
|
||||
return true
|
||||
end
|
||||
end
|
||||
for i=1,16 do
|
||||
if not board[i]then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
local function newTile()
|
||||
--Select position & generate number
|
||||
nextPos=(nextPos+6)%16+1
|
||||
while board[nextPos]do
|
||||
nextPos=(nextPos-4)%16+1
|
||||
end
|
||||
board[nextPos]=nextTile
|
||||
prevPos=nextPos
|
||||
prevSpawnTime=0
|
||||
--Select position & generate number
|
||||
nextPos=(nextPos+6)%16+1
|
||||
while board[nextPos]do
|
||||
nextPos=(nextPos-4)%16+1
|
||||
end
|
||||
board[nextPos]=nextTile
|
||||
prevPos=nextPos
|
||||
prevSpawnTime=0
|
||||
|
||||
--Fresh score
|
||||
score=score+2^nextTile
|
||||
TEXT.show("+"..2^nextTile,1130+rnd(-60,60),575+rnd(-30,30),30,'score',1.5)
|
||||
--Fresh score
|
||||
score=score+2^nextTile
|
||||
TEXT.show("+"..2^nextTile,1130+rnd(-60,60),575+rnd(-30,30),30,'score',1.5)
|
||||
|
||||
--Generate next number
|
||||
nextCD=nextCD-1
|
||||
if nextCD>0 then
|
||||
nextTile=1
|
||||
else
|
||||
nextTile=rnd()>.1 and 2 or rnd()>.1 and 3 or 4
|
||||
nextCD=rnd(8,12)
|
||||
end
|
||||
--Generate next number
|
||||
nextCD=nextCD-1
|
||||
if nextCD>0 then
|
||||
nextTile=1
|
||||
else
|
||||
nextTile=rnd()>.1 and 2 or rnd()>.1 and 3 or 4
|
||||
nextCD=rnd(8,12)
|
||||
end
|
||||
|
||||
--Check if board is full
|
||||
if airExist()then return end
|
||||
--Check if board is full
|
||||
if airExist()then return end
|
||||
|
||||
--Check if board is locked in all-directions
|
||||
for i=1,12 do
|
||||
if board[i]==board[i+4]then
|
||||
return
|
||||
end
|
||||
end
|
||||
for i=1,13,4 do
|
||||
if
|
||||
board[i+0]==board[i+1]or
|
||||
board[i+1]==board[i+2]or
|
||||
board[i+2]==board[i+3]
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
--Check if board is locked in all-directions
|
||||
for i=1,12 do
|
||||
if board[i]==board[i+4]then
|
||||
return
|
||||
end
|
||||
end
|
||||
for i=1,13,4 do
|
||||
if
|
||||
board[i+0]==board[i+1]or
|
||||
board[i+1]==board[i+2]or
|
||||
board[i+2]==board[i+3]
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
--Die.
|
||||
state=2
|
||||
SFX.play(maxTile>=10 and'win'or'fail')
|
||||
--Die.
|
||||
state=2
|
||||
SFX.play(maxTile>=10 and'win'or'fail')
|
||||
end
|
||||
local function freshMaxTile()
|
||||
maxTile=maxTile+1
|
||||
if maxTile==12 then skipper.cd=0 end
|
||||
SFX.play('reach')
|
||||
ins(progress,("%s - %.3fs"):format(tileName[maxTile],TIME()-startTime))
|
||||
maxTile=maxTile+1
|
||||
if maxTile==12 then skipper.cd=0 end
|
||||
SFX.play('reach')
|
||||
ins(progress,("%s - %.3fs"):format(tileName[maxTile],TIME()-startTime))
|
||||
end
|
||||
local function squash(L)
|
||||
local p1,p2=1
|
||||
local moved=false
|
||||
while true do
|
||||
p2=p1+1
|
||||
while not L[p2]and p2<5 do
|
||||
p2=p2+1
|
||||
end
|
||||
if p2==5 then
|
||||
if p1==4 then
|
||||
return L[1],L[2],L[3],L[4],moved
|
||||
else
|
||||
p1=p1+1
|
||||
end
|
||||
else
|
||||
if not L[p1]then--air←2
|
||||
L[p1],L[p2]=L[p2],false
|
||||
moved=true
|
||||
elseif L[p1]==L[p2]then--2←2
|
||||
L[p1],L[p2]=L[p1]+1,false
|
||||
if L[p1]>maxTile then
|
||||
freshMaxTile()
|
||||
end
|
||||
L[p2]=false
|
||||
p1=p1+1
|
||||
moved=true
|
||||
elseif p1+1~=p2 then--2←4
|
||||
L[p1+1],L[p2]=L[p2],false
|
||||
p1=p1+1
|
||||
moved=true
|
||||
else--2,4
|
||||
p1=p1+1
|
||||
end
|
||||
end
|
||||
end
|
||||
local p1,p2=1
|
||||
local moved=false
|
||||
while true do
|
||||
p2=p1+1
|
||||
while not L[p2]and p2<5 do
|
||||
p2=p2+1
|
||||
end
|
||||
if p2==5 then
|
||||
if p1==4 then
|
||||
return L[1],L[2],L[3],L[4],moved
|
||||
else
|
||||
p1=p1+1
|
||||
end
|
||||
else
|
||||
if not L[p1]then--air←2
|
||||
L[p1],L[p2]=L[p2],false
|
||||
moved=true
|
||||
elseif L[p1]==L[p2]then--2←2
|
||||
L[p1],L[p2]=L[p1]+1,false
|
||||
if L[p1]>maxTile then
|
||||
freshMaxTile()
|
||||
end
|
||||
L[p2]=false
|
||||
p1=p1+1
|
||||
moved=true
|
||||
elseif p1+1~=p2 then--2←4
|
||||
L[p1+1],L[p2]=L[p2],false
|
||||
p1=p1+1
|
||||
moved=true
|
||||
else--2,4
|
||||
p1=p1+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function reset()
|
||||
for i=1,16 do board[i]=false end
|
||||
progress={}
|
||||
state=0
|
||||
score=0
|
||||
time=0
|
||||
move=0
|
||||
maxTile=6
|
||||
nextTile,nextPos=1,rnd(16)
|
||||
nextCD=32
|
||||
skipper.cd,skipper.used=false,false
|
||||
repeater.seq[1],repeater.seq[2]="",""
|
||||
repeater.last[1],repeater.last[2]="X","X"
|
||||
newTile()
|
||||
for i=1,16 do board[i]=false end
|
||||
progress={}
|
||||
state=0
|
||||
score=0
|
||||
time=0
|
||||
move=0
|
||||
maxTile=6
|
||||
nextTile,nextPos=1,rnd(16)
|
||||
nextCD=32
|
||||
skipper.cd,skipper.used=false,false
|
||||
repeater.seq[1],repeater.seq[2]="",""
|
||||
repeater.last[1],repeater.last[2]="X","X"
|
||||
newTile()
|
||||
end
|
||||
|
||||
local function moveUp()
|
||||
local moved
|
||||
for i=1,4 do
|
||||
local m
|
||||
board[i],board[i+4],board[i+8],board[i+12],m=squash({board[i],board[i+4],board[i+8],board[i+12]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
local moved
|
||||
for i=1,4 do
|
||||
local m
|
||||
board[i],board[i+4],board[i+8],board[i+12],m=squash({board[i],board[i+4],board[i+8],board[i+12]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
end
|
||||
local function moveDown()
|
||||
local moved
|
||||
for i=1,4 do
|
||||
local m
|
||||
board[i+12],board[i+8],board[i+4],board[i],m=squash({board[i+12],board[i+8],board[i+4],board[i]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
local moved
|
||||
for i=1,4 do
|
||||
local m
|
||||
board[i+12],board[i+8],board[i+4],board[i],m=squash({board[i+12],board[i+8],board[i+4],board[i]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
end
|
||||
local function moveLeft()
|
||||
local moved
|
||||
for i=1,13,4 do
|
||||
local m
|
||||
board[i],board[i+1],board[i+2],board[i+3],m=squash({board[i],board[i+1],board[i+2],board[i+3]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
local moved
|
||||
for i=1,13,4 do
|
||||
local m
|
||||
board[i],board[i+1],board[i+2],board[i+3],m=squash({board[i],board[i+1],board[i+2],board[i+3]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
end
|
||||
local function moveRight()
|
||||
local moved
|
||||
for i=1,13,4 do
|
||||
local m
|
||||
board[i+3],board[i+2],board[i+1],board[i],m=squash({board[i+3],board[i+2],board[i+1],board[i]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
local moved
|
||||
for i=1,13,4 do
|
||||
local m
|
||||
board[i+3],board[i+2],board[i+1],board[i],m=squash({board[i+3],board[i+2],board[i+1],board[i]})
|
||||
if m then moved=true end
|
||||
end
|
||||
return moved
|
||||
end
|
||||
local function skip()
|
||||
if state==1 and skipper.cd==0 then
|
||||
if airExist()then
|
||||
skipper.cd=1024
|
||||
skipper.used=true
|
||||
newTile()
|
||||
SFX.play('hold')
|
||||
else
|
||||
SFX.play('finesseError')
|
||||
end
|
||||
end
|
||||
if state==1 and skipper.cd==0 then
|
||||
if airExist()then
|
||||
skipper.cd=1024
|
||||
skipper.used=true
|
||||
newTile()
|
||||
SFX.play('hold')
|
||||
else
|
||||
SFX.play('finesseError')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('cubes')
|
||||
BGM.play('truth')
|
||||
board={}
|
||||
BG.set('cubes')
|
||||
BGM.play('truth')
|
||||
board={}
|
||||
|
||||
blind=false
|
||||
tapControl=false
|
||||
startTime=0
|
||||
reset()
|
||||
blind=false
|
||||
tapControl=false
|
||||
startTime=0
|
||||
reset()
|
||||
end
|
||||
|
||||
function scene.mouseDown(x,y,k)
|
||||
if tapControl then
|
||||
if k==2 then
|
||||
skip()
|
||||
else
|
||||
local dx,dy=x-640,y-360
|
||||
if abs(dx)<320 and abs(dy)<320 and(abs(dx)>60 or abs(dy)>60)then
|
||||
scene.keyDown(abs(dx)-abs(dy)>0 and
|
||||
(dx>0 and"right"or"left")or
|
||||
(dy>0 and"down"or"up")
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
if tapControl then
|
||||
if k==2 then
|
||||
skip()
|
||||
else
|
||||
local dx,dy=x-640,y-360
|
||||
if abs(dx)<320 and abs(dy)<320 and(abs(dx)>60 or abs(dy)>60)then
|
||||
scene.keyDown(abs(dx)-abs(dy)>0 and
|
||||
(dx>0 and"right"or"left")or
|
||||
(dy>0 and"down"or"up")
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
end
|
||||
local moveFunc={
|
||||
up=moveUp,
|
||||
down=moveDown,
|
||||
left=moveLeft,
|
||||
right=moveRight,
|
||||
up=moveUp,
|
||||
down=moveDown,
|
||||
left=moveLeft,
|
||||
right=moveRight,
|
||||
}
|
||||
local arrows={
|
||||
up="↑",down="↓",left="←",right="→",
|
||||
["↑"]="up",["↓"]="down",["←"]="left",["→"]="right",
|
||||
up="↑",down="↓",left="←",right="→",
|
||||
["↑"]="up",["↓"]="down",["←"]="left",["→"]="right",
|
||||
}
|
||||
local function setFocus(n)
|
||||
if state~=2 then
|
||||
repeater.focus=n
|
||||
repeater.seq[n]=""
|
||||
end
|
||||
if state~=2 then
|
||||
repeater.focus=n
|
||||
repeater.seq[n]=""
|
||||
end
|
||||
end
|
||||
local function playRep(n)
|
||||
if state~=2 and #repeater.seq[n]>0 then
|
||||
repeater.focus=false
|
||||
local move0=move
|
||||
for i=1,#repeater.seq[n],3 do
|
||||
autoPressing=true
|
||||
scene.keyDown(arrows[repeater.seq[n]:sub(i,i+2)],true)
|
||||
autoPressing=false
|
||||
end
|
||||
if move~=move0 then
|
||||
if repeater.seq[n]~=repeater.last[n]then
|
||||
repeater.last[n]=repeater.seq[n]
|
||||
move=move0+#repeater.seq[n]/3+1
|
||||
else
|
||||
move=move0+1
|
||||
end
|
||||
end
|
||||
end
|
||||
if state~=2 and #repeater.seq[n]>0 then
|
||||
repeater.focus=false
|
||||
local move0=move
|
||||
for i=1,#repeater.seq[n],3 do
|
||||
autoPressing=true
|
||||
scene.keyDown(arrows[repeater.seq[n]:sub(i,i+2)],true)
|
||||
autoPressing=false
|
||||
end
|
||||
if move~=move0 then
|
||||
if repeater.seq[n]~=repeater.last[n]then
|
||||
repeater.last[n]=repeater.seq[n]
|
||||
move=move0+#repeater.seq[n]/3+1
|
||||
else
|
||||
move=move0+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if repeater.focus then
|
||||
local f=repeater.focus
|
||||
if #repeater.seq[f]<24 then
|
||||
repeater.seq[f]=repeater.seq[f]..arrows[key]
|
||||
end
|
||||
else
|
||||
if moveFunc[key]()then
|
||||
if state==0 then
|
||||
startTime=TIME()
|
||||
state=1
|
||||
end
|
||||
if skipper.cd and skipper.cd>0 then
|
||||
skipper.cd=skipper.cd-1
|
||||
if skipper.cd==0 then
|
||||
SFX.play('spin_0')
|
||||
end
|
||||
end
|
||||
newTile()
|
||||
TEXT.show(arrows[key],640,360,80,'beat',3)
|
||||
move=move+1
|
||||
if not autoPressing then
|
||||
SFX.play('move')
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif key=="space"then skip()
|
||||
elseif key=="r"then reset()
|
||||
elseif key=="q"then if state==0 then blind=not blind end
|
||||
elseif key=="w"then if state==0 then tapControl=not tapControl end
|
||||
elseif key=="1"or key=="2"then(kb.isDown("lshift","lctrl","lalt")and playRep or setFocus)(key=="1"and 1 or 2)
|
||||
elseif key=="c1"then playRep(1)
|
||||
elseif key=="c2"then playRep(2)
|
||||
elseif key=="return"then
|
||||
if repeater.focus then
|
||||
repeater.focus=false
|
||||
end
|
||||
elseif key=="escape"then
|
||||
if repeater.focus then
|
||||
repeater.focus=false
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if repeater.focus then
|
||||
local f=repeater.focus
|
||||
if #repeater.seq[f]<24 then
|
||||
repeater.seq[f]=repeater.seq[f]..arrows[key]
|
||||
end
|
||||
else
|
||||
if moveFunc[key]()then
|
||||
if state==0 then
|
||||
startTime=TIME()
|
||||
state=1
|
||||
end
|
||||
if skipper.cd and skipper.cd>0 then
|
||||
skipper.cd=skipper.cd-1
|
||||
if skipper.cd==0 then
|
||||
SFX.play('spin_0')
|
||||
end
|
||||
end
|
||||
newTile()
|
||||
TEXT.show(arrows[key],640,360,80,'beat',3)
|
||||
move=move+1
|
||||
if not autoPressing then
|
||||
SFX.play('move')
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif key=="space"then skip()
|
||||
elseif key=="r"then reset()
|
||||
elseif key=="q"then if state==0 then blind=not blind end
|
||||
elseif key=="w"then if state==0 then tapControl=not tapControl end
|
||||
elseif key=="1"or key=="2"then(kb.isDown("lshift","lctrl","lalt")and playRep or setFocus)(key=="1"and 1 or 2)
|
||||
elseif key=="c1"then playRep(1)
|
||||
elseif key=="c2"then playRep(2)
|
||||
elseif key=="return"then
|
||||
if repeater.focus then
|
||||
repeater.focus=false
|
||||
end
|
||||
elseif key=="escape"then
|
||||
if repeater.focus then
|
||||
repeater.focus=false
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
end
|
||||
if prevSpawnTime<1 then
|
||||
prevSpawnTime=min(prevSpawnTime+3*dt,1)
|
||||
end
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
end
|
||||
if prevSpawnTime<1 then
|
||||
prevSpawnTime=min(prevSpawnTime+3*dt,1)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(35)
|
||||
setColor(1,1,1)
|
||||
gc.print(("%.3f"):format(time),1000,10)
|
||||
gc.print(move,1000,45)
|
||||
setFont(35)
|
||||
setColor(1,1,1)
|
||||
gc.print(("%.3f"):format(time),1000,10)
|
||||
gc.print(move,1000,45)
|
||||
|
||||
--Progress time list
|
||||
setFont(20)
|
||||
setColor(.6,.6,.6)
|
||||
for i=1,#progress do
|
||||
gc.print(progress[i],1000,65+20*i)
|
||||
end
|
||||
--Progress time list
|
||||
setFont(20)
|
||||
setColor(.6,.6,.6)
|
||||
for i=1,#progress do
|
||||
gc.print(progress[i],1000,65+20*i)
|
||||
end
|
||||
|
||||
--Repeater
|
||||
gc.setLineWidth(6)
|
||||
setFont(25)
|
||||
for i=1,2 do
|
||||
setColor(COLOR[
|
||||
repeater.focus==i and(
|
||||
TIME()%.5>.25 and
|
||||
'R'or
|
||||
'Y'
|
||||
)or(
|
||||
repeater.seq[i]==repeater.last[i]and
|
||||
'H'or
|
||||
'Z'
|
||||
)
|
||||
])
|
||||
rectangle('line',990,305+60*i,220,50)
|
||||
gc.print(repeater.seq[i],1000,313+60*i)
|
||||
end
|
||||
--Repeater
|
||||
gc.setLineWidth(6)
|
||||
setFont(25)
|
||||
for i=1,2 do
|
||||
setColor(COLOR[
|
||||
repeater.focus==i and(
|
||||
TIME()%.5>.25 and
|
||||
'R'or
|
||||
'Y'
|
||||
)or(
|
||||
repeater.seq[i]==repeater.last[i]and
|
||||
'H'or
|
||||
'Z'
|
||||
)
|
||||
])
|
||||
rectangle('line',990,305+60*i,220,50)
|
||||
gc.print(repeater.seq[i],1000,313+60*i)
|
||||
end
|
||||
|
||||
--Score
|
||||
setFont(40)
|
||||
setColor(1,.7,.7)
|
||||
mStr(score,1130,510)
|
||||
--Score
|
||||
setFont(40)
|
||||
setColor(1,.7,.7)
|
||||
mStr(score,1130,510)
|
||||
|
||||
--Messages
|
||||
if state==2 then
|
||||
--Draw no-setting area
|
||||
setColor(1,0,0,.3)
|
||||
rectangle('fill',15,265,285,140)
|
||||
--Messages
|
||||
if state==2 then
|
||||
--Draw no-setting area
|
||||
setColor(1,0,0,.3)
|
||||
rectangle('fill',15,265,285,140)
|
||||
|
||||
setColor(.9,.9,0)--win
|
||||
elseif state==1 then
|
||||
setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
setColor(.2,.8,.2)--ready
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
rectangle('line',310,30,660,660)
|
||||
setColor(.9,.9,0)--win
|
||||
elseif state==1 then
|
||||
setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
setColor(.2,.8,.2)--ready
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
rectangle('line',310,30,660,660)
|
||||
|
||||
--Board
|
||||
for i=1,16 do
|
||||
if board[i]then
|
||||
local x,y=1+(i-1)%4,int((i+3)/4)
|
||||
local N=board[i]
|
||||
if i~=prevPos or prevSpawnTime==1 then
|
||||
if not blind or i==prevPos then
|
||||
setColor(tileColor[N]or COLOR.D)
|
||||
rectangle('fill',x*160+163,y*160-117,154,154,15)
|
||||
if N>=0 then
|
||||
setColor(N<3 and COLOR.D or COLOR.Z)
|
||||
local fontSize=tileFont[N]
|
||||
setFont(fontSize)
|
||||
mStr(tileName[N],320+(x-.5)*160,40+(y-.5)*160-fontSize*.7)
|
||||
end
|
||||
else
|
||||
setColor(COLOR.H)
|
||||
rectangle('fill',x*160+163,y*160-117,154,154,15)
|
||||
end
|
||||
else
|
||||
local c=tileColor[N]
|
||||
setColor(c[1],c[2],c[3],prevSpawnTime)
|
||||
rectangle('fill',x*160+163,y*160-117,154,154,15)
|
||||
c=N<3 and 0 or 1
|
||||
setColor(c,c,c,prevSpawnTime)
|
||||
local fontSize=tileFont[N]
|
||||
setFont(fontSize)
|
||||
mStr(tileName[N],320+(x-.5)*160,40+(y-.5)*160-fontSize*.7)
|
||||
end
|
||||
end
|
||||
end
|
||||
--Board
|
||||
for i=1,16 do
|
||||
if board[i]then
|
||||
local x,y=1+(i-1)%4,int((i+3)/4)
|
||||
local N=board[i]
|
||||
if i~=prevPos or prevSpawnTime==1 then
|
||||
if not blind or i==prevPos then
|
||||
setColor(tileColor[N]or COLOR.D)
|
||||
rectangle('fill',x*160+163,y*160-117,154,154,15)
|
||||
if N>=0 then
|
||||
setColor(N<3 and COLOR.D or COLOR.Z)
|
||||
local fontSize=tileFont[N]
|
||||
setFont(fontSize)
|
||||
mStr(tileName[N],320+(x-.5)*160,40+(y-.5)*160-fontSize*.7)
|
||||
end
|
||||
else
|
||||
setColor(COLOR.H)
|
||||
rectangle('fill',x*160+163,y*160-117,154,154,15)
|
||||
end
|
||||
else
|
||||
local c=tileColor[N]
|
||||
setColor(c[1],c[2],c[3],prevSpawnTime)
|
||||
rectangle('fill',x*160+163,y*160-117,154,154,15)
|
||||
c=N<3 and 0 or 1
|
||||
setColor(c,c,c,prevSpawnTime)
|
||||
local fontSize=tileFont[N]
|
||||
setFont(fontSize)
|
||||
mStr(tileName[N],320+(x-.5)*160,40+(y-.5)*160-fontSize*.7)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Next indicator
|
||||
setColor(1,1,1)
|
||||
if nextCD<=12 then
|
||||
for i=1,nextCD do
|
||||
rectangle('fill',140+i*16-nextCD*8,170,12,12)
|
||||
end
|
||||
end
|
||||
--Next indicator
|
||||
setColor(1,1,1)
|
||||
if nextCD<=12 then
|
||||
for i=1,nextCD do
|
||||
rectangle('fill',140+i*16-nextCD*8,170,12,12)
|
||||
end
|
||||
end
|
||||
|
||||
--Next
|
||||
setFont(40)
|
||||
gc.print("Next",50,195)
|
||||
if nextTile>1 then
|
||||
setColor(1,.5,.4)
|
||||
end
|
||||
setFont(70)
|
||||
mStr(tileName[nextTile],220,175)
|
||||
--Next
|
||||
setFont(40)
|
||||
gc.print("Next",50,195)
|
||||
if nextTile>1 then
|
||||
setColor(1,.5,.4)
|
||||
end
|
||||
setFont(70)
|
||||
mStr(tileName[nextTile],220,175)
|
||||
|
||||
--Skip CoolDown
|
||||
if skipper.cd and skipper.cd>0 then
|
||||
setFont(50)
|
||||
setColor(1,1,.5)
|
||||
mStr(skipper.cd,155,600)
|
||||
end
|
||||
--Skip CoolDown
|
||||
if skipper.cd and skipper.cd>0 then
|
||||
setFont(50)
|
||||
setColor(1,1,.5)
|
||||
mStr(skipper.cd,155,600)
|
||||
end
|
||||
|
||||
--Skip mark
|
||||
if skipper.used then
|
||||
setColor(1,1,.5)
|
||||
gc.circle('fill',280,675,10)
|
||||
end
|
||||
--Skip mark
|
||||
if skipper.used then
|
||||
setColor(1,1,.5)
|
||||
gc.circle('fill',280,675,10)
|
||||
end
|
||||
|
||||
--New tile position
|
||||
local x,y=1+(prevPos-1)%4,int((prevPos+3)/4)
|
||||
gc.setLineWidth(8)
|
||||
setColor(.2,.8,0,prevSpawnTime)
|
||||
local d=25-prevSpawnTime*25
|
||||
rectangle('line',x*160+163-d,y*160-117-d,154+2*d,154+2*d,15)
|
||||
--New tile position
|
||||
local x,y=1+(prevPos-1)%4,int((prevPos+3)/4)
|
||||
gc.setLineWidth(8)
|
||||
setColor(.2,.8,0,prevSpawnTime)
|
||||
local d=25-prevSpawnTime*25
|
||||
rectangle('line',x*160+163-d,y*160-117-d,154+2*d,154+2*d,15)
|
||||
|
||||
--Touch control boarder line
|
||||
if tapControl then
|
||||
gc.setLineWidth(6)
|
||||
setColor(1,1,1,.2)
|
||||
gc.line(310,30,580,300)
|
||||
gc.line(970,30,700,300)
|
||||
gc.line(310,690,580,420)
|
||||
gc.line(970,690,700,420)
|
||||
rectangle('line',580,300,120,120,10)
|
||||
end
|
||||
--Touch control boarder line
|
||||
if tapControl then
|
||||
gc.setLineWidth(6)
|
||||
setColor(1,1,1,.2)
|
||||
gc.line(310,30,580,300)
|
||||
gc.line(970,30,700,300)
|
||||
gc.line(310,690,580,420)
|
||||
gc.line(970,690,700,420)
|
||||
rectangle('line',580,300,120,120,10)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="reset", x=155,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
WIDGET.newSwitch{name="blind", x=240,y=300,w=60,font=40,disp=function()return blind end,code=pressKey"q",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="tapControl", x=240,y=370,w=60,font=40,disp=function()return tapControl end,code=pressKey"w",hideF=function()return state==1 end},
|
||||
WIDGET.newButton{name="reset", x=155,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
WIDGET.newSwitch{name="blind", x=240,y=300,w=60,font=40,disp=function()return blind end,code=pressKey"q",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="tapControl",x=240,y=370,w=60,font=40,disp=function()return tapControl end,code=pressKey"w",hideF=function()return state==1 end},
|
||||
|
||||
WIDGET.newKey{name="up", x=155,y=460,w=100,fText="↑",font=50,color='Y',code=pressKey"up",hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="down", x=155,y=660,w=100,fText="↓",font=50,color='Y',code=pressKey"down",hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="left", x=55,y=560,w=100,fText="←",font=50,color='Y',code=pressKey"left",hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="right", x=255,y=560,w=100,fText="→",font=50,color='Y',code=pressKey"right",hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="skip", x=155,y=400,w=100,font=20, color='Y',code=pressKey"space",hideF=function()return state~=1 or not skipper.cd or skipper.cd>0 end},
|
||||
WIDGET.newKey{name="record1", x=1100,y=390,w=220,h=50,fText="", color='H',code=pressKey"1",hideF=function()return state==2 end},
|
||||
WIDGET.newKey{name="record2", x=1100,y=450,w=220,h=50,fText="", color='H',code=pressKey"2",hideF=function()return state==2 end},
|
||||
WIDGET.newKey{name="replay1", x=1245,y=390,w=50,fText="!", color='G',code=pressKey"c1",hideF=function()return state==2 or #repeater.seq[1]==0 end},
|
||||
WIDGET.newKey{name="replay2", x=1245,y=450,w=50,fText="!", color='G',code=pressKey"c2",hideF=function()return state==2 or #repeater.seq[2]==0 end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="up", x=155,y=460,w=100,fText="↑",font=50, color='Y',code=pressKey"up", hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="down", x=155,y=660,w=100,fText="↓",font=50, color='Y',code=pressKey"down", hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="left", x=55,y=560,w=100,fText="←",font=50, color='Y',code=pressKey"left", hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="right", x=255,y=560,w=100,fText="→",font=50,color='Y',code=pressKey"right", hideF=function()return tapControl end},
|
||||
WIDGET.newKey{name="skip", x=155,y=400,w=100,font=20, color='Y',code=pressKey"space", hideF=function()return state~=1 or not skipper.cd or skipper.cd>0 end},
|
||||
WIDGET.newKey{name="record1", x=1100,y=390,w=220,h=50,fText="", color='H',code=pressKey"1", hideF=function()return state==2 end},
|
||||
WIDGET.newKey{name="record2", x=1100,y=450,w=220,h=50,fText="", color='H',code=pressKey"2", hideF=function()return state==2 end},
|
||||
WIDGET.newKey{name="replay1", x=1245,y=390,w=50,fText="!", color='G',code=pressKey"c1", hideF=function()return state==2 or #repeater.seq[1]==0 end},
|
||||
WIDGET.newKey{name="replay2", x=1245,y=450,w=50,fText="!", color='G',code=pressKey"c2", hideF=function()return state==2 or #repeater.seq[2]==0 end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,23 +3,23 @@ local rnd=math.random
|
||||
local mStr=mStr
|
||||
|
||||
local levels={
|
||||
A_Z="ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
Z_A="ZYXWVUTSRQPONMLKJIHGFEDCBA",
|
||||
Tech1="TECHMINOHAOWAN",
|
||||
Tech2="TECHMINOISFUN",
|
||||
KeyTest1="THEQUICKBROWNFOXJUMPSOVERALAZYDOG",
|
||||
KeyTest2="THEFIVEBOXINGWIZARDSJUMPQUICKLY",
|
||||
Hello="HELLOWORLD",
|
||||
Roll1="QWERTYUIOPASDFGHJKLZXCVBNM",
|
||||
Roll2="QAZWSXEDCRFVTGBYHNUJMIKOLP",
|
||||
Roll3="ZAQWSXCDERFVBGTYHNMJUIKLOP",
|
||||
ZZZ="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
|
||||
ZXZX="ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX",
|
||||
ZMZM="ZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZM",
|
||||
Stair="ZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCV",
|
||||
Stair2="ZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCV",
|
||||
Stair3="XZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCV",
|
||||
BPW="OHOOOOOOOOOAAAAEAAIAUJOOOOOOOOOOOAAEOAAUUAEEEEEEEEEAAAAEAEIEAJOOOOOOOOOOEEEEOAAAAAAA",
|
||||
A_Z="ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
Z_A="ZYXWVUTSRQPONMLKJIHGFEDCBA",
|
||||
Tech1="TECHMINOHAOWAN",
|
||||
Tech2="TECHMINOISFUN",
|
||||
KeyTest1="THEQUICKBROWNFOXJUMPSOVERALAZYDOG",
|
||||
KeyTest2="THEFIVEBOXINGWIZARDSJUMPQUICKLY",
|
||||
Hello="HELLOWORLD",
|
||||
Roll1="QWERTYUIOPASDFGHJKLZXCVBNM",
|
||||
Roll2="QAZWSXEDCRFVTGBYHNUJMIKOLP",
|
||||
Roll3="ZAQWSXCDERFVBGTYHNMJUIKLOP",
|
||||
ZZZ="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
|
||||
ZXZX="ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX",
|
||||
ZMZM="ZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZMZM",
|
||||
Stair="ZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCVZXCV",
|
||||
Stair2="ZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCVCXZXCV",
|
||||
Stair3="XZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCVXZCV",
|
||||
BPW="OHOOOOOOOOOAAAAEAAIAUJOOOOOOOOOOOAAEOAAUUAEEEEEEEEEAAAAEAEIEAJOOOOOOOOOOEEEEOAAAAAAA",
|
||||
}
|
||||
|
||||
local scene={}
|
||||
@@ -31,92 +31,92 @@ local state,progress
|
||||
local frameKeyCount,mistake
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('bg2')
|
||||
BGM.play('way')
|
||||
levelName="A_Z"
|
||||
targetString=levels.A_Z
|
||||
progress=1
|
||||
frameKeyCount=0
|
||||
mistake=0
|
||||
startTime=0
|
||||
time=0
|
||||
state=0
|
||||
BG.set('bg2')
|
||||
BGM.play('way')
|
||||
levelName="A_Z"
|
||||
targetString=levels.A_Z
|
||||
progress=1
|
||||
frameKeyCount=0
|
||||
mistake=0
|
||||
startTime=0
|
||||
time=0
|
||||
state=0
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if #key==1 then
|
||||
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 progress==2 then
|
||||
state=1
|
||||
startTime=TIME()
|
||||
elseif progress>#targetString then
|
||||
time=TIME()-startTime
|
||||
state=2
|
||||
SFX.play('reach')
|
||||
end
|
||||
elseif progress>1 then
|
||||
mistake=mistake+1
|
||||
SFX.play('finesseError')
|
||||
end
|
||||
end
|
||||
elseif key=="space"then
|
||||
progress=1
|
||||
mistake=0
|
||||
time=0
|
||||
state=0
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if #key==1 then
|
||||
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 progress==2 then
|
||||
state=1
|
||||
startTime=TIME()
|
||||
elseif progress>#targetString then
|
||||
time=TIME()-startTime
|
||||
state=2
|
||||
SFX.play('reach')
|
||||
end
|
||||
elseif progress>1 then
|
||||
mistake=mistake+1
|
||||
SFX.play('finesseError')
|
||||
end
|
||||
end
|
||||
elseif key=="space"then
|
||||
progress=1
|
||||
mistake=0
|
||||
time=0
|
||||
state=0
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state==1 then
|
||||
frameKeyCount=0
|
||||
time=TIME()-startTime
|
||||
end
|
||||
if state==1 then
|
||||
frameKeyCount=0
|
||||
time=TIME()-startTime
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(("%.3f"):format(time),1026,80)
|
||||
gc.print(mistake,1026,150)
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(("%.3f"):format(time),1026,80)
|
||||
gc.print(mistake,1026,150)
|
||||
|
||||
if state>0 then
|
||||
gc.print(("%.3f/s"):format((progress-1)/time),1026,220)
|
||||
end
|
||||
if state>0 then
|
||||
gc.print(("%.3f/s"):format((progress-1)/time),1026,220)
|
||||
end
|
||||
|
||||
if state==2 then
|
||||
gc.setColor(.9,.9,0)--win
|
||||
elseif state==1 then
|
||||
gc.setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
gc.setColor(.2,.8,.2)--ready
|
||||
end
|
||||
if state==2 then
|
||||
gc.setColor(.9,.9,0)--win
|
||||
elseif state==1 then
|
||||
gc.setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
gc.setColor(.2,.8,.2)--ready
|
||||
end
|
||||
|
||||
setFont(100)
|
||||
mStr(state==1 and #targetString-progress+1 or state==0 and"Ready"or state==2 and"Win",640,200)
|
||||
setFont(100)
|
||||
mStr(state==1 and #targetString-progress+1 or state==0 and"Ready"or state==2 and"Win",640,200)
|
||||
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(targetString:sub(progress,progress),120,280,0,2)
|
||||
gc.print(targetString:sub(progress+1),310,380)
|
||||
gc.setColor(COLOR.Z)
|
||||
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(targetString,120,520)
|
||||
gc.setColor(1,1,1,.7)
|
||||
setFont(40)
|
||||
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=function()return levelName end,code=function(i)levelName=i;targetString=levels[i]end,hideF=function()return state>0 end},
|
||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color='lG',font=40,code=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,fText=TEXTURE.back,code=backScene},
|
||||
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,hideF=function()return state>0 end},
|
||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color='lG',font=40,code=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,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -2,14 +2,14 @@ local gc=love.graphics
|
||||
local int=math.floor
|
||||
|
||||
local lines={
|
||||
{1,2,3},
|
||||
{4,5,6},
|
||||
{7,8,9},
|
||||
{1,4,7},
|
||||
{2,5,8},
|
||||
{3,6,9},
|
||||
{1,5,9},
|
||||
{3,5,7},
|
||||
{1,2,3},
|
||||
{4,5,6},
|
||||
{7,8,9},
|
||||
{1,4,7},
|
||||
{2,5,8},
|
||||
{3,6,9},
|
||||
{1,5,9},
|
||||
{3,5,7},
|
||||
}
|
||||
|
||||
local board={{},{},{},{},{},{},{},{},{}}
|
||||
@@ -23,222 +23,222 @@ local placeTime
|
||||
local gameover
|
||||
|
||||
local function restart()
|
||||
lastX,lastx=false,false
|
||||
curX,curx=nil
|
||||
round=0
|
||||
target=false
|
||||
placeTime=TIME()
|
||||
gameover=false
|
||||
for X=1,9 do
|
||||
score[X]=false
|
||||
for x=1,9 do
|
||||
board[X][x]=false
|
||||
end
|
||||
end
|
||||
lastX,lastx=false,false
|
||||
curX,curx=nil
|
||||
round=0
|
||||
target=false
|
||||
placeTime=TIME()
|
||||
gameover=false
|
||||
for X=1,9 do
|
||||
score[X]=false
|
||||
for x=1,9 do
|
||||
board[X][x]=false
|
||||
end
|
||||
end
|
||||
end
|
||||
local function checkBoard(b,p)
|
||||
for i=1,8 do
|
||||
for j=1,3 do
|
||||
if b[lines[i][j]]~=p then
|
||||
goto CONTINUE_testNextLine
|
||||
end
|
||||
end
|
||||
do return true end
|
||||
::CONTINUE_testNextLine::
|
||||
end
|
||||
for i=1,8 do
|
||||
for j=1,3 do
|
||||
if b[lines[i][j]]~=p then
|
||||
goto CONTINUE_testNextLine
|
||||
end
|
||||
end
|
||||
do return true end
|
||||
::CONTINUE_testNextLine::
|
||||
end
|
||||
end
|
||||
local function full(L)
|
||||
for i=1,9 do
|
||||
if not L[i]then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
for i=1,9 do
|
||||
if not L[i]then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
local function place(X,x)
|
||||
board[X][x]=round
|
||||
SFX.play('move')
|
||||
lastX,lastx=X,x
|
||||
curX,curx=nil
|
||||
placeTime=TIME()
|
||||
if checkBoard(board[X],round)then
|
||||
score[X]=round
|
||||
if checkBoard(score,round)then
|
||||
gameover=round
|
||||
SFX.play('win')
|
||||
return
|
||||
else
|
||||
if full(score)then
|
||||
gameover=true
|
||||
return
|
||||
end
|
||||
end
|
||||
SFX.play('reach')
|
||||
else
|
||||
if full(board[X])then
|
||||
SFX.play('emit')
|
||||
score[X]=true
|
||||
if full(score)then
|
||||
gameover=true
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if score[x]then
|
||||
target=false
|
||||
else
|
||||
target=x
|
||||
end
|
||||
round=1-round
|
||||
board[X][x]=round
|
||||
SFX.play('move')
|
||||
lastX,lastx=X,x
|
||||
curX,curx=nil
|
||||
placeTime=TIME()
|
||||
if checkBoard(board[X],round)then
|
||||
score[X]=round
|
||||
if checkBoard(score,round)then
|
||||
gameover=round
|
||||
SFX.play('win')
|
||||
return
|
||||
else
|
||||
if full(score)then
|
||||
gameover=true
|
||||
return
|
||||
end
|
||||
end
|
||||
SFX.play('reach')
|
||||
else
|
||||
if full(board[X])then
|
||||
SFX.play('emit')
|
||||
score[X]=true
|
||||
if full(score)then
|
||||
gameover=true
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if score[x]then
|
||||
target=false
|
||||
else
|
||||
target=x
|
||||
end
|
||||
round=1-round
|
||||
end
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
restart()
|
||||
BGM.play('truth')
|
||||
BG.set('rainbow')
|
||||
restart()
|
||||
BGM.play('truth')
|
||||
BG.set('rainbow')
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.push('transform')
|
||||
--origin pos:0,140; scale:4
|
||||
gc.translate(280,0)
|
||||
gc.scale(8)
|
||||
gc.push('transform')
|
||||
--origin pos:0,140; scale:4
|
||||
gc.translate(280,0)
|
||||
gc.scale(8)
|
||||
|
||||
--Draw board
|
||||
gc.setColor(0,0,0,.4)
|
||||
gc.rectangle('fill',0,0,90,90)
|
||||
--Draw board
|
||||
gc.setColor(0,0,0,.4)
|
||||
gc.rectangle('fill',0,0,90,90)
|
||||
|
||||
--Draw target area
|
||||
gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)/5+.2)
|
||||
if target then
|
||||
gc.rectangle('fill',(target-1)%3*30,int((target-1)/3)*30,30,30)
|
||||
elseif not gameover then
|
||||
gc.rectangle('fill',0,0,90,90)
|
||||
end
|
||||
--Draw target area
|
||||
gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)/5+.2)
|
||||
if target then
|
||||
gc.rectangle('fill',(target-1)%3*30,int((target-1)/3)*30,30,30)
|
||||
elseif not gameover then
|
||||
gc.rectangle('fill',0,0,90,90)
|
||||
end
|
||||
|
||||
--Draw cursor
|
||||
if curX then
|
||||
gc.setColor(1,1,1,.3)
|
||||
gc.rectangle('fill',(curX-1)%3*30+(curx-1)%3*10-.5,int((curX-1)/3)*30+int((curx-1)/3)*10-.5,11,11)
|
||||
end
|
||||
--Draw cursor
|
||||
if curX then
|
||||
gc.setColor(1,1,1,.3)
|
||||
gc.rectangle('fill',(curX-1)%3*30+(curx-1)%3*10-.5,int((curX-1)/3)*30+int((curx-1)/3)*10-.5,11,11)
|
||||
end
|
||||
|
||||
gc.setLineWidth(.8)
|
||||
for X=1,9 do
|
||||
if score[X]then
|
||||
if score[X]==0 then
|
||||
gc.setColor(.5,0,0)
|
||||
elseif score[X]==1 then
|
||||
gc.setColor(0,0,.5)
|
||||
else
|
||||
gc.setColor(COLOR.D)
|
||||
end
|
||||
gc.rectangle('fill',(X-1)%3*30,int((X-1)/3)*30,30,30)
|
||||
end
|
||||
for x=1,9 do
|
||||
local c=board[X][x]
|
||||
if c then
|
||||
local _x=(X-1)%3*30+(x-1)%3*10
|
||||
local _y=int((X-1)/3)*30+int((x-1)/3)*10
|
||||
if c==0 then
|
||||
gc.setColor(1,.2,.2)
|
||||
gc.rectangle('line',_x+2.25,_y+2.25,5.5,5.5)
|
||||
else
|
||||
gc.setColor(.3,.3,1)
|
||||
gc.line(_x+2,_y+2,_x+8,_y+8)
|
||||
gc.line(_x+2,_y+8,_x+8,_y+2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.setLineWidth(.8)
|
||||
for X=1,9 do
|
||||
if score[X]then
|
||||
if score[X]==0 then
|
||||
gc.setColor(.5,0,0)
|
||||
elseif score[X]==1 then
|
||||
gc.setColor(0,0,.5)
|
||||
else
|
||||
gc.setColor(COLOR.D)
|
||||
end
|
||||
gc.rectangle('fill',(X-1)%3*30,int((X-1)/3)*30,30,30)
|
||||
end
|
||||
for x=1,9 do
|
||||
local c=board[X][x]
|
||||
if c then
|
||||
local _x=(X-1)%3*30+(x-1)%3*10
|
||||
local _y=int((X-1)/3)*30+int((x-1)/3)*10
|
||||
if c==0 then
|
||||
gc.setColor(1,.2,.2)
|
||||
gc.rectangle('line',_x+2.25,_y+2.25,5.5,5.5)
|
||||
else
|
||||
gc.setColor(.3,.3,1)
|
||||
gc.line(_x+2,_y+2,_x+8,_y+8)
|
||||
gc.line(_x+2,_y+8,_x+8,_y+2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Draw board line
|
||||
gc.setLineWidth(.8)
|
||||
for x=0,9 do
|
||||
gc.setColor(1,1,1,x%3==0 and 1 or .3)
|
||||
gc.line(10*x,0,10*x,90)
|
||||
gc.line(0,10*x,90,10*x)
|
||||
end
|
||||
--Draw board line
|
||||
gc.setLineWidth(.8)
|
||||
for x=0,9 do
|
||||
gc.setColor(1,1,1,x%3==0 and 1 or .3)
|
||||
gc.line(10*x,0,10*x,90)
|
||||
gc.line(0,10*x,90,10*x)
|
||||
end
|
||||
|
||||
--Draw last pos
|
||||
if lastX then
|
||||
gc.setColor(.5,1,.4,.8)
|
||||
local r=.5+.5*math.sin(TIME()*6.26)
|
||||
gc.rectangle('line',(lastX-1)%3*30+(lastx-1)%3*10-r,int((lastX-1)/3)*30+int((lastx-1)/3)*10-r,10+2*r,10+2*r)
|
||||
end
|
||||
gc.pop()
|
||||
--Draw last pos
|
||||
if lastX then
|
||||
gc.setColor(.5,1,.4,.8)
|
||||
local r=.5+.5*math.sin(TIME()*6.26)
|
||||
gc.rectangle('line',(lastX-1)%3*30+(lastx-1)%3*10-r,int((lastX-1)/3)*30+int((lastx-1)/3)*10-r,10+2*r,10+2*r)
|
||||
end
|
||||
gc.pop()
|
||||
|
||||
if gameover then
|
||||
--Draw result
|
||||
setFont(60)
|
||||
if gameover==0 then
|
||||
gc.setColor(1,.6,.6)
|
||||
mStr("RED\nWON",1140,200)
|
||||
elseif gameover==1 then
|
||||
gc.setColor(.6,.6,1)
|
||||
mStr("BLUE\nWON",1140,200)
|
||||
else
|
||||
gc.setColor(.8,.8,.8)
|
||||
mStr("TIE",1140,240)
|
||||
end
|
||||
else
|
||||
--Draw current round mark
|
||||
gc.setColor(.8,.8,.8,.8)
|
||||
gc.rectangle('fill',80,80,160,160)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(6)
|
||||
gc.rectangle('line',80,80,160,160)
|
||||
if gameover then
|
||||
--Draw result
|
||||
setFont(60)
|
||||
if gameover==0 then
|
||||
gc.setColor(1,.6,.6)
|
||||
mStr("RED\nWON",1140,200)
|
||||
elseif gameover==1 then
|
||||
gc.setColor(.6,.6,1)
|
||||
mStr("BLUE\nWON",1140,200)
|
||||
else
|
||||
gc.setColor(.8,.8,.8)
|
||||
mStr("TIE",1140,240)
|
||||
end
|
||||
else
|
||||
--Draw current round mark
|
||||
gc.setColor(.8,.8,.8,.8)
|
||||
gc.rectangle('fill',80,80,160,160)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(6)
|
||||
gc.rectangle('line',80,80,160,160)
|
||||
|
||||
gc.setLineWidth(10)
|
||||
if round==0 then
|
||||
gc.setColor(1,0,0)
|
||||
gc.rectangle('line',160-40,160-40,80,80)
|
||||
else
|
||||
gc.setColor(0,0,1)
|
||||
gc.line(160-45,160-45,160+45,160+45)
|
||||
gc.line(160-45,160+45,160+45,160-45)
|
||||
end
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
if round==0 then
|
||||
gc.setColor(1,0,0)
|
||||
gc.rectangle('line',160-40,160-40,80,80)
|
||||
else
|
||||
gc.setColor(0,0,1)
|
||||
gc.line(160-45,160-45,160+45,160+45)
|
||||
gc.line(160-45,160+45,160+45,160-45)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.touchDown(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
end
|
||||
|
||||
function scene.touchMove(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
end
|
||||
|
||||
function scene.touchUp(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
end
|
||||
|
||||
function scene.mouseMove(x,y)
|
||||
x,y=int((x-280)/80),int(y/80)
|
||||
curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1
|
||||
if
|
||||
x<0 or x>8 or
|
||||
y<0 or y>8 or
|
||||
curX<1 or curX>9 or
|
||||
curx<1 or curx>9 or
|
||||
score[curX]or
|
||||
not(target==curX or not target)or
|
||||
board[curX][curx]or
|
||||
gameover
|
||||
then
|
||||
curX,curx=nil
|
||||
end
|
||||
x,y=int((x-280)/80),int(y/80)
|
||||
curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1
|
||||
if
|
||||
x<0 or x>8 or
|
||||
y<0 or y>8 or
|
||||
curX<1 or curX>9 or
|
||||
curx<1 or curx>9 or
|
||||
score[curX]or
|
||||
not(target==curX or not target)or
|
||||
board[curX][curx]or
|
||||
gameover
|
||||
then
|
||||
curX,curx=nil
|
||||
end
|
||||
end
|
||||
|
||||
function scene.mouseDown(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
if curX then place(curX,curx)end
|
||||
scene.mouseMove(x,y)
|
||||
if curX then place(curX,curx)end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="reset",x=1140,y=540,w=170,h=80,font=40,color='lG',code=restart},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="reset",x=1140,y=540,w=170,h=80,font=40,color='lG',code=restart},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -8,122 +8,122 @@ local val--result value
|
||||
local sym--symbol
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('none')
|
||||
BGM.stop()
|
||||
reg,val,sym=false,"0",false
|
||||
BG.set('none')
|
||||
BGM.stop()
|
||||
reg,val,sym=false,"0",false
|
||||
end
|
||||
function scene.sceneBack()
|
||||
BGM.play()
|
||||
BGM.play()
|
||||
end
|
||||
|
||||
scene.mouseDown=NULL
|
||||
function scene.keyDown(key)
|
||||
if key:byte()>=48 and key:byte()<=57 then
|
||||
if sym=="="then
|
||||
val=key
|
||||
sym=false
|
||||
elseif sym and not reg then
|
||||
reg=val
|
||||
val=key
|
||||
else
|
||||
if #val<14 then
|
||||
if val=="0"then val=""end
|
||||
val=val..key
|
||||
end
|
||||
end
|
||||
elseif key:sub(1,2)=="kp"then
|
||||
scene.keyDown(key:sub(3))
|
||||
elseif key=="."then
|
||||
if sym=="="then
|
||||
sym,reg=false,false
|
||||
val="0."
|
||||
elseif not(val:find(".",nil,true)or val:find("e"))then
|
||||
if sym and not reg then
|
||||
reg=val
|
||||
val="0."
|
||||
else
|
||||
val=val.."."
|
||||
end
|
||||
end
|
||||
elseif key=="e"then
|
||||
if sym=="="then
|
||||
sym,reg=false
|
||||
val="0e"
|
||||
elseif not val:find("e")then
|
||||
val=val.."e"
|
||||
end
|
||||
elseif key=="backspace"then
|
||||
if sym=="="then
|
||||
val=""
|
||||
elseif sym then
|
||||
sym=false
|
||||
else
|
||||
val=val:sub(1,-2)
|
||||
end
|
||||
if val==""then val="0"end
|
||||
elseif key=="+"or key=="="and kb.isDown("lshift","rshift")then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="+"
|
||||
elseif key=="*"or key=="8"and kb.isDown("lshift","rshift")then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="*"
|
||||
elseif key=="-"then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="-"
|
||||
elseif key=="/"then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="/"
|
||||
elseif key=="return"then
|
||||
if val:sub(-1)=="e"then val=val:sub(1,-2)end
|
||||
if sym and reg then
|
||||
if reg:sub(-1)=="e"then reg=reg:sub(1,-2)end
|
||||
val=
|
||||
sym=="+"and tostring((tonumber(reg)or 0)+tonumber(val))or
|
||||
sym=="-"and tostring((tonumber(reg)or 0)-tonumber(val))or
|
||||
sym=="*"and tostring((tonumber(reg)or 0)*tonumber(val))or
|
||||
sym=="/"and tostring((tonumber(reg)or 0)/tonumber(val))or
|
||||
"-1"
|
||||
end
|
||||
sym="="
|
||||
reg=false
|
||||
elseif key=="escape"then
|
||||
if val~="0"then
|
||||
reg,sym=false,false
|
||||
val="0"
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif key=="delete"then
|
||||
val="0"
|
||||
end
|
||||
if key:byte()>=48 and key:byte()<=57 then
|
||||
if sym=="="then
|
||||
val=key
|
||||
sym=false
|
||||
elseif sym and not reg then
|
||||
reg=val
|
||||
val=key
|
||||
else
|
||||
if #val<14 then
|
||||
if val=="0"then val=""end
|
||||
val=val..key
|
||||
end
|
||||
end
|
||||
elseif key:sub(1,2)=="kp"then
|
||||
scene.keyDown(key:sub(3))
|
||||
elseif key=="."then
|
||||
if sym=="="then
|
||||
sym,reg=false,false
|
||||
val="0."
|
||||
elseif not(val:find(".",nil,true)or val:find("e"))then
|
||||
if sym and not reg then
|
||||
reg=val
|
||||
val="0."
|
||||
else
|
||||
val=val.."."
|
||||
end
|
||||
end
|
||||
elseif key=="e"then
|
||||
if sym=="="then
|
||||
sym,reg=false
|
||||
val="0e"
|
||||
elseif not val:find("e")then
|
||||
val=val.."e"
|
||||
end
|
||||
elseif key=="backspace"then
|
||||
if sym=="="then
|
||||
val=""
|
||||
elseif sym then
|
||||
sym=false
|
||||
else
|
||||
val=val:sub(1,-2)
|
||||
end
|
||||
if val==""then val="0"end
|
||||
elseif key=="+"or key=="="and kb.isDown("lshift","rshift")then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="+"
|
||||
elseif key=="*"or key=="8"and kb.isDown("lshift","rshift")then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="*"
|
||||
elseif key=="-"then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="-"
|
||||
elseif key=="/"then
|
||||
if reg and sym then scene.keyDown("return")else reg=false end sym="/"
|
||||
elseif key=="return"then
|
||||
if val:sub(-1)=="e"then val=val:sub(1,-2)end
|
||||
if sym and reg then
|
||||
if reg:sub(-1)=="e"then reg=reg:sub(1,-2)end
|
||||
val=
|
||||
sym=="+"and tostring((tonumber(reg)or 0)+tonumber(val))or
|
||||
sym=="-"and tostring((tonumber(reg)or 0)-tonumber(val))or
|
||||
sym=="*"and tostring((tonumber(reg)or 0)*tonumber(val))or
|
||||
sym=="/"and tostring((tonumber(reg)or 0)/tonumber(val))or
|
||||
"-1"
|
||||
end
|
||||
sym="="
|
||||
reg=false
|
||||
elseif key=="escape"then
|
||||
if val~="0"then
|
||||
reg,sym=false,false
|
||||
val="0"
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif key=="delete"then
|
||||
val="0"
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',100,80,650,150,5)
|
||||
setFont(45)
|
||||
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
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',100,80,650,150,5)
|
||||
setFont(45)
|
||||
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={
|
||||
WIDGET.newKey{name="_1",x=145,y=300,w=90,fText="1",font=50,code=pressKey"1"},
|
||||
WIDGET.newKey{name="_2",x=245,y=300,w=90,fText="2",font=50,code=pressKey"2"},
|
||||
WIDGET.newKey{name="_3",x=345,y=300,w=90,fText="3",font=50,code=pressKey"3"},
|
||||
WIDGET.newKey{name="_4",x=145,y=400,w=90,fText="4",font=50,code=pressKey"4"},
|
||||
WIDGET.newKey{name="_5",x=245,y=400,w=90,fText="5",font=50,code=pressKey"5"},
|
||||
WIDGET.newKey{name="_6",x=345,y=400,w=90,fText="6",font=50,code=pressKey"6"},
|
||||
WIDGET.newKey{name="_7",x=145,y=500,w=90,fText="7",font=50,code=pressKey"7"},
|
||||
WIDGET.newKey{name="_8",x=245,y=500,w=90,fText="8",font=50,code=pressKey"8"},
|
||||
WIDGET.newKey{name="_9",x=345,y=500,w=90,fText="9",font=50,code=pressKey"9"},
|
||||
WIDGET.newKey{name="_0",x=145,y=600,w=90,fText="0",font=50,code=pressKey"0"},
|
||||
WIDGET.newKey{name=".",x=245,y=600,w=90,fText=".",color='lM',font=50,code=pressKey"."},
|
||||
WIDGET.newKey{name="e",x=345,y=600,w=90,fText="e",color='lM',font=50,code=pressKey"e"},
|
||||
WIDGET.newKey{name="+",x=445,y=300,w=90,fText="+",color='lB',font=50,code=pressKey"+"},
|
||||
WIDGET.newKey{name="-",x=445,y=400,w=90,fText="-",color='lB',font=50,code=pressKey"-"},
|
||||
WIDGET.newKey{name="*",x=445,y=500,w=90,fText="*",color='lB',font=50,code=pressKey"*"},
|
||||
WIDGET.newKey{name="/",x=445,y=600,w=90,fText="/",color='lB',font=50,code=pressKey"/"},
|
||||
WIDGET.newKey{name="<",x=545,y=300,w=90,fText="<",color='lR',font=50,code=pressKey"backspace"},
|
||||
WIDGET.newKey{name="=",x=545,y=400,w=90,fText="=",color='lY',font=50,code=pressKey"return"},
|
||||
WIDGET.newKey{name="back",x=1135,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="_1",x=145,y=300,w=90,fText="1",font=50,code=pressKey"1"},
|
||||
WIDGET.newKey{name="_2",x=245,y=300,w=90,fText="2",font=50,code=pressKey"2"},
|
||||
WIDGET.newKey{name="_3",x=345,y=300,w=90,fText="3",font=50,code=pressKey"3"},
|
||||
WIDGET.newKey{name="_4",x=145,y=400,w=90,fText="4",font=50,code=pressKey"4"},
|
||||
WIDGET.newKey{name="_5",x=245,y=400,w=90,fText="5",font=50,code=pressKey"5"},
|
||||
WIDGET.newKey{name="_6",x=345,y=400,w=90,fText="6",font=50,code=pressKey"6"},
|
||||
WIDGET.newKey{name="_7",x=145,y=500,w=90,fText="7",font=50,code=pressKey"7"},
|
||||
WIDGET.newKey{name="_8",x=245,y=500,w=90,fText="8",font=50,code=pressKey"8"},
|
||||
WIDGET.newKey{name="_9",x=345,y=500,w=90,fText="9",font=50,code=pressKey"9"},
|
||||
WIDGET.newKey{name="_0",x=145,y=600,w=90,fText="0",font=50,code=pressKey"0"},
|
||||
WIDGET.newKey{name=".",x=245,y=600,w=90,fText=".",color='lM',font=50,code=pressKey"."},
|
||||
WIDGET.newKey{name="e",x=345,y=600,w=90,fText="e",color='lM',font=50,code=pressKey"e"},
|
||||
WIDGET.newKey{name="+",x=445,y=300,w=90,fText="+",color='lB',font=50,code=pressKey"+"},
|
||||
WIDGET.newKey{name="-",x=445,y=400,w=90,fText="-",color='lB',font=50,code=pressKey"-"},
|
||||
WIDGET.newKey{name="*",x=445,y=500,w=90,fText="*",color='lB',font=50,code=pressKey"*"},
|
||||
WIDGET.newKey{name="/",x=445,y=600,w=90,fText="/",color='lB',font=50,code=pressKey"/"},
|
||||
WIDGET.newKey{name="<",x=545,y=300,w=90,fText="<",color='lR',font=50,code=pressKey"backspace"},
|
||||
WIDGET.newKey{name="=",x=545,y=400,w=90,fText="=",color='lY',font=50,code=pressKey"return"},
|
||||
WIDGET.newKey{name="back",x=1135,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -7,125 +7,125 @@ local x,y,vx,vy,ex,ey
|
||||
|
||||
local scene={}
|
||||
function scene.sceneInit()
|
||||
pow,ang=0,0
|
||||
state=0
|
||||
timer=0
|
||||
score,combo=0,0
|
||||
x,y=160,500
|
||||
ex,ey=626,260
|
||||
BG.set('matrix')
|
||||
BGM.play('hang out')
|
||||
pow,ang=0,0
|
||||
state=0
|
||||
timer=0
|
||||
score,combo=0,0
|
||||
x,y=160,500
|
||||
ex,ey=626,260
|
||||
BG.set('matrix')
|
||||
BGM.play('hang out')
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="space"or key=="return"then
|
||||
if state==0 then
|
||||
state=1
|
||||
elseif state==1 then
|
||||
state=2
|
||||
vx=pow*cos(ang)/2.6
|
||||
vy=pow*sin(ang)/2.6
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="space"or key=="return"then
|
||||
if state==0 then
|
||||
state=1
|
||||
elseif state==1 then
|
||||
state=2
|
||||
vx=pow*cos(ang)/2.6
|
||||
vy=pow*sin(ang)/2.6
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(k)
|
||||
if k==1 then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
if k==1 then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
end
|
||||
function scene.touchDown()
|
||||
scene.keyDown("space")
|
||||
scene.keyDown("space")
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
timer=timer+1
|
||||
if state==0 then
|
||||
pow=abs(100-TIME()*200%200)
|
||||
elseif state==1 then
|
||||
ang=(abs(110-TIME()*120%220)-30)/180*3.141592653589793
|
||||
else
|
||||
x,y=x+vx,y-vy
|
||||
vy=vy-.62
|
||||
local e
|
||||
if (x-ex)^2+(y-ey)^2<900 then
|
||||
score=math.min(score+4+combo*2,626)
|
||||
combo=combo+1
|
||||
ex,ey=rnd(626,1100),rnd(26,700)
|
||||
SFX.play('reach')
|
||||
e=true
|
||||
end
|
||||
if x>1280 or y>720 then
|
||||
if score>0 then
|
||||
score=score-int(score/10)
|
||||
end
|
||||
SFX.play('finesseError')
|
||||
combo=0
|
||||
e=true
|
||||
end
|
||||
if e then
|
||||
x,y=rnd(100,260),rnd(160,700)
|
||||
state=0
|
||||
end
|
||||
end
|
||||
timer=timer+1
|
||||
if state==0 then
|
||||
pow=abs(100-TIME()*200%200)
|
||||
elseif state==1 then
|
||||
ang=(abs(110-TIME()*120%220)-30)/180*3.141592653589793
|
||||
else
|
||||
x,y=x+vx,y-vy
|
||||
vy=vy-.62
|
||||
local e
|
||||
if (x-ex)^2+(y-ey)^2<900 then
|
||||
score=math.min(score+4+combo*2,626)
|
||||
combo=combo+1
|
||||
ex,ey=rnd(626,1100),rnd(26,700)
|
||||
SFX.play('reach')
|
||||
e=true
|
||||
end
|
||||
if x>1280 or y>720 then
|
||||
if score>0 then
|
||||
score=score-int(score/10)
|
||||
end
|
||||
SFX.play('finesseError')
|
||||
combo=0
|
||||
e=true
|
||||
end
|
||||
if e then
|
||||
x,y=rnd(100,260),rnd(160,700)
|
||||
state=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local scoreColor={
|
||||
'Z',--0
|
||||
'A',--20
|
||||
'N',--40
|
||||
'B',--60
|
||||
'P',--80
|
||||
'W',--100
|
||||
'R','F','O','Y','lA',--200
|
||||
'lN','lB','lP','lW','lR',--300
|
||||
'lF','lO','lY','dA','dN',--400
|
||||
'dB','dP','dW','dR','dF',--500
|
||||
'dY','lH','H','dH',--before 600, black after
|
||||
'Z',--0
|
||||
'A',--20
|
||||
'N',--40
|
||||
'B',--60
|
||||
'P',--80
|
||||
'W',--100
|
||||
'R','F','O','Y','lA',--200
|
||||
'lN','lB','lP','lW','lR',--300
|
||||
'lF','lO','lY','dA','dN',--400
|
||||
'dB','dP','dW','dR','dF',--500
|
||||
'dY','lH','H','dH',--before 600, black after
|
||||
}
|
||||
function scene.draw()
|
||||
--Spawn area
|
||||
gc.setColor(1,1,1,.2)
|
||||
gc.rectangle('fill',85,0,190,720)
|
||||
--Spawn area
|
||||
gc.setColor(1,1,1,.2)
|
||||
gc.rectangle('fill',85,0,190,720)
|
||||
|
||||
--Power & Angle
|
||||
gc.setColor(COLOR.Z)
|
||||
if state~=2 then
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('fill',x-80,y+20,pow*1.6,16)
|
||||
gc.rectangle('line',x-80,y+20,160,15)
|
||||
if state==1 then
|
||||
gc.setLineWidth(5)
|
||||
gc.line(x,y,x+(20+2*pow)*cos(ang),y-(20+2*pow)*sin(ang))
|
||||
end
|
||||
end
|
||||
--Power & Angle
|
||||
gc.setColor(COLOR.Z)
|
||||
if state~=2 then
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('fill',x-80,y+20,pow*1.6,16)
|
||||
gc.rectangle('line',x-80,y+20,160,15)
|
||||
if state==1 then
|
||||
gc.setLineWidth(5)
|
||||
gc.line(x,y,x+(20+2*pow)*cos(ang),y-(20+2*pow)*sin(ang))
|
||||
end
|
||||
end
|
||||
|
||||
--Info
|
||||
setFont(40)
|
||||
if combo>1 then
|
||||
gc.setColor(1,1,.6)
|
||||
gc.print("x"..combo,300,80)
|
||||
end
|
||||
gc.setColor(COLOR[scoreColor[int(score/20)+1]or'D'])
|
||||
gc.print(score,300,30)
|
||||
--Info
|
||||
setFont(40)
|
||||
if combo>1 then
|
||||
gc.setColor(1,1,.6)
|
||||
gc.print("x"..combo,300,80)
|
||||
end
|
||||
gc.setColor(COLOR[scoreColor[int(score/20)+1]or'D'])
|
||||
gc.print(score,300,30)
|
||||
|
||||
--Cannon ball
|
||||
gc.circle('fill',x,y,15)
|
||||
--Cannon ball
|
||||
gc.circle('fill',x,y,15)
|
||||
|
||||
--Arrow
|
||||
if y<-15 then
|
||||
gc.print("↑",x-20.5,0)
|
||||
end
|
||||
--Arrow
|
||||
if y<-15 then
|
||||
gc.print("↑",x-20.5,0)
|
||||
end
|
||||
|
||||
--Target
|
||||
gc.setColor(1,1,.4)
|
||||
gc.circle('fill',ex,ey,15)
|
||||
--Target
|
||||
gc.setColor(1,1,.4)
|
||||
gc.circle('fill',ex,ey,15)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,17 +7,17 @@ local max,min=math.max,math.min
|
||||
local setFont=setFont
|
||||
|
||||
local cubeColor={
|
||||
{.88,.75,.00},
|
||||
{.50,.50,.97},
|
||||
{.50,.50,.50},
|
||||
{.50,.97,.00},
|
||||
{.94,.94,.94},
|
||||
{.40,.40,.40},
|
||||
{.31,.88,.97},
|
||||
{.97,.97,.50},
|
||||
{.91,.50,.97},
|
||||
{.97,.63,.31},
|
||||
{0,0,0},
|
||||
{.88,.75,.00},
|
||||
{.50,.50,.97},
|
||||
{.50,.50,.50},
|
||||
{.50,.97,.00},
|
||||
{.94,.94,.94},
|
||||
{.40,.40,.40},
|
||||
{.31,.88,.97},
|
||||
{.97,.97,.50},
|
||||
{.91,.50,.97},
|
||||
{.97,.63,.31},
|
||||
{0,0,0},
|
||||
}
|
||||
|
||||
local cubesX,cubesY
|
||||
@@ -30,282 +30,282 @@ local score
|
||||
local sunH,color,rot
|
||||
|
||||
local function near(o,t)
|
||||
return o>t and max(o-.01,t)or o<t and min(o+.01,t)or o
|
||||
return o>t and max(o-.01,t)or o<t and min(o+.01,t)or o
|
||||
end
|
||||
local function hurt(i)
|
||||
life=life-i
|
||||
if life<0 then
|
||||
life=-100
|
||||
menu,play=1,false
|
||||
speed=speed*.5
|
||||
moveDir=0
|
||||
score=int(score)
|
||||
SFX.play('clear_4')
|
||||
else
|
||||
SFX.play('clear_2')
|
||||
end
|
||||
life=life-i
|
||||
if life<0 then
|
||||
life=-100
|
||||
menu,play=1,false
|
||||
speed=speed*.5
|
||||
moveDir=0
|
||||
score=int(score)
|
||||
SFX.play('clear_4')
|
||||
else
|
||||
SFX.play('clear_2')
|
||||
end
|
||||
end
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
cubesX={}for i=1,40 do cubesX[i]=rnd()*16-8 end
|
||||
cubesY={}for i=1,40 do cubesY[i]=i/40*9 end
|
||||
lastCube=1
|
||||
player,moveDir=0,0
|
||||
life,life1,inv=0,0,false
|
||||
level,speed=1,1
|
||||
menu,ct,play=false,60,false
|
||||
score=0
|
||||
sunH,color,rot=0,{.878,.752,0},0
|
||||
cubesX={}for i=1,40 do cubesX[i]=rnd()*16-8 end
|
||||
cubesY={}for i=1,40 do cubesY[i]=i/40*9 end
|
||||
lastCube=1
|
||||
player,moveDir=0,0
|
||||
life,life1,inv=0,0,false
|
||||
level,speed=1,1
|
||||
menu,ct,play=false,60,false
|
||||
score=0
|
||||
sunH,color,rot=0,{.878,.752,0},0
|
||||
|
||||
gc.setLineJoin('bevel')
|
||||
BGM.play('push')
|
||||
BG.set('none')
|
||||
gc.setLineJoin('bevel')
|
||||
BGM.play('push')
|
||||
BG.set('none')
|
||||
end
|
||||
|
||||
function scene.touchDown(x)
|
||||
if play then
|
||||
if x<640 then
|
||||
moveDir=-1
|
||||
else
|
||||
moveDir=1
|
||||
end
|
||||
end
|
||||
if play then
|
||||
if x<640 then
|
||||
moveDir=-1
|
||||
else
|
||||
moveDir=1
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.touchUp(x)
|
||||
if play then
|
||||
local L=tc.getTouches()
|
||||
if x<640 then
|
||||
for i=1,#L do
|
||||
if tc.getPosition(L[i])>640 then
|
||||
moveDir=1
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
for i=1,#L do
|
||||
if tc.getPosition(L[i])<640 then
|
||||
moveDir=-1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
moveDir=0
|
||||
else
|
||||
scene.keyDown("space")
|
||||
end
|
||||
if play then
|
||||
local L=tc.getTouches()
|
||||
if x<640 then
|
||||
for i=1,#L do
|
||||
if tc.getPosition(L[i])>640 then
|
||||
moveDir=1
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
for i=1,#L do
|
||||
if tc.getPosition(L[i])<640 then
|
||||
moveDir=-1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
moveDir=0
|
||||
else
|
||||
scene.keyDown("space")
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
elseif play then
|
||||
if key=="left"or key=="a"then
|
||||
moveDir=-1
|
||||
elseif key=="right"or key=="d"then
|
||||
moveDir=1
|
||||
end
|
||||
else
|
||||
if key=="space"and ct==60 then
|
||||
menu=-1
|
||||
speed=1
|
||||
level=1
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
elseif play then
|
||||
if key=="left"or key=="a"then
|
||||
moveDir=-1
|
||||
elseif key=="right"or key=="d"then
|
||||
moveDir=1
|
||||
end
|
||||
else
|
||||
if key=="space"and ct==60 then
|
||||
menu=-1
|
||||
speed=1
|
||||
level=1
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyUp(key)
|
||||
if play then
|
||||
if key=="left"or key=="a"then
|
||||
moveDir=kb.isDown("right","d")and 1 or 0
|
||||
elseif key=="right"or key=="d"then
|
||||
moveDir=kb.isDown("left","a")and -1 or 0
|
||||
end
|
||||
end
|
||||
if play then
|
||||
if key=="left"or key=="a"then
|
||||
moveDir=kb.isDown("right","d")and 1 or 0
|
||||
elseif key=="right"or key=="d"then
|
||||
moveDir=kb.isDown("left","a")and -1 or 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
dt=dt*600
|
||||
dt=dt*600
|
||||
|
||||
--Update cubes' position
|
||||
local cy=cubesY
|
||||
local step=speed*dt*.005
|
||||
for i=1,40 do
|
||||
cy[i]=cy[i]+step
|
||||
if cy[i]>10 then
|
||||
if score%1000<820 then
|
||||
cubesX[i]=rnd()*16-8+player
|
||||
else
|
||||
cubesX[i]=player+i%2*6-3
|
||||
end
|
||||
cy[i]=cy[i]-9
|
||||
lastCube=(lastCube-2)%40+1
|
||||
end
|
||||
end
|
||||
--Update cubes' position
|
||||
local cy=cubesY
|
||||
local step=speed*dt*.005
|
||||
for i=1,40 do
|
||||
cy[i]=cy[i]+step
|
||||
if cy[i]>10 then
|
||||
if score%1000<820 then
|
||||
cubesX[i]=rnd()*16-8+player
|
||||
else
|
||||
cubesX[i]=player+i%2*6-3
|
||||
end
|
||||
cy[i]=cy[i]-9
|
||||
lastCube=(lastCube-2)%40+1
|
||||
end
|
||||
end
|
||||
|
||||
--Collision detect
|
||||
if play then
|
||||
for j=1,40 do
|
||||
local i=(j+lastCube-2)%40+1
|
||||
local Y=cubesY[i]
|
||||
if Y<8.8 then
|
||||
local size=100/(10-Y)
|
||||
local x=(cubesX[i]-player)/(10-Y)*200-size*.5
|
||||
local y=5/(10-Y)*150-50
|
||||
if y>420 and y<480 and x<8 and x+size>-8 and inv==0 then
|
||||
cubesX[i]=cubesX[i]-3
|
||||
hurt(650)
|
||||
inv=40
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--Collision detect
|
||||
if play then
|
||||
for j=1,40 do
|
||||
local i=(j+lastCube-2)%40+1
|
||||
local Y=cubesY[i]
|
||||
if Y<8.8 then
|
||||
local size=100/(10-Y)
|
||||
local x=(cubesX[i]-player)/(10-Y)*200-size*.5
|
||||
local y=5/(10-Y)*150-50
|
||||
if y>420 and y<480 and x<8 and x+size>-8 and inv==0 then
|
||||
cubesX[i]=cubesX[i]-3
|
||||
hurt(650)
|
||||
inv=40
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Screen rotation
|
||||
if moveDir~=0 then
|
||||
player=player+moveDir*dt*.003*speed^.8
|
||||
if abs(rot)<.16 or moveDir*rot>0 then
|
||||
rot=rot-moveDir*dt*.0003*speed
|
||||
end
|
||||
elseif rot~=0 then
|
||||
local d=dt*.0002*speed
|
||||
if rot>0 then
|
||||
rot=max(rot-d,0)
|
||||
else
|
||||
rot=min(rot+d,0)
|
||||
end
|
||||
end
|
||||
--Screen rotation
|
||||
if moveDir~=0 then
|
||||
player=player+moveDir*dt*.003*speed^.8
|
||||
if abs(rot)<.16 or moveDir*rot>0 then
|
||||
rot=rot-moveDir*dt*.0003*speed
|
||||
end
|
||||
elseif rot~=0 then
|
||||
local d=dt*.0002*speed
|
||||
if rot>0 then
|
||||
rot=max(rot-d,0)
|
||||
else
|
||||
rot=min(rot+d,0)
|
||||
end
|
||||
end
|
||||
|
||||
life1=life1*.7+life*.3
|
||||
life1=life1*.7+life*.3
|
||||
|
||||
if play then
|
||||
if inv>0 then inv=inv-1 end
|
||||
score=score+dt*.04+life*.0004
|
||||
life=min(life+dt*.04,1000)
|
||||
if score>1000*level then
|
||||
if speed<3 then speed=speed+.2 end
|
||||
level=level+1
|
||||
SFX.play('blip_1')
|
||||
end
|
||||
sunH=sunH+.01
|
||||
elseif menu==1 then
|
||||
ct=ct+1
|
||||
if ct==60 then menu=false end
|
||||
elseif menu==-1 then
|
||||
for i=1,3 do color[i]=near(color[i],cubeColor[1][i])end
|
||||
for i=1,40 do cubesY[i]=cubesY[i]-(70-ct)*.003 end
|
||||
if sunH>0 then sunH=max(sunH*.85-1,0)end
|
||||
ct=ct-1
|
||||
if ct==0 then
|
||||
score=0
|
||||
life=1000
|
||||
play,menu=true,false
|
||||
inv=90
|
||||
end
|
||||
end
|
||||
if play then
|
||||
if inv>0 then inv=inv-1 end
|
||||
score=score+dt*.04+life*.0004
|
||||
life=min(life+dt*.04,1000)
|
||||
if score>1000*level then
|
||||
if speed<3 then speed=speed+.2 end
|
||||
level=level+1
|
||||
SFX.play('blip_1')
|
||||
end
|
||||
sunH=sunH+.01
|
||||
elseif menu==1 then
|
||||
ct=ct+1
|
||||
if ct==60 then menu=false end
|
||||
elseif menu==-1 then
|
||||
for i=1,3 do color[i]=near(color[i],cubeColor[1][i])end
|
||||
for i=1,40 do cubesY[i]=cubesY[i]-(70-ct)*.003 end
|
||||
if sunH>0 then sunH=max(sunH*.85-1,0)end
|
||||
ct=ct-1
|
||||
if ct==0 then
|
||||
score=0
|
||||
life=1000
|
||||
play,menu=true,false
|
||||
inv=90
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Health bar
|
||||
if life1>0 then
|
||||
gc.setColor(1,0,0)
|
||||
gc.rectangle('fill',640-life1*.64,710,life1*1.28,10)
|
||||
end
|
||||
--Health bar
|
||||
if life1>0 then
|
||||
gc.setColor(1,0,0)
|
||||
gc.rectangle('fill',640-life1*.64,710,life1*1.28,10)
|
||||
end
|
||||
|
||||
--Draw player
|
||||
if play and inv%8<4 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('fill',620,670,40,40)
|
||||
end
|
||||
--Draw player
|
||||
if play and inv%8<4 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('fill',620,670,40,40)
|
||||
end
|
||||
|
||||
--Set screen rotation
|
||||
gc.push('transform')
|
||||
gc.translate(640,690)
|
||||
gc.rotate(rot)
|
||||
--Set screen rotation
|
||||
gc.push('transform')
|
||||
gc.translate(640,690)
|
||||
gc.rotate(rot)
|
||||
|
||||
--Draw sun
|
||||
gc.setColor(.7,.5,.3)
|
||||
gc.circle('fill',0,-380-sunH,60)
|
||||
--Draw sun
|
||||
gc.setColor(.7,.5,.3)
|
||||
gc.circle('fill',0,-380-sunH,60)
|
||||
|
||||
--Draw sun-board
|
||||
gc.setColor(.08,.08,.084)
|
||||
gc.rectangle('fill',-60,-440,120,120)
|
||||
--Draw sun-board
|
||||
gc.setColor(.08,.08,.084)
|
||||
gc.rectangle('fill',-60,-440,120,120)
|
||||
|
||||
--Draw direction
|
||||
if play then
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1,.1)
|
||||
gc.polygon('fill',-15,30,0,-440,15,30)
|
||||
end
|
||||
--Draw direction
|
||||
if play then
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1,.1)
|
||||
gc.polygon('fill',-15,30,0,-440,15,30)
|
||||
end
|
||||
|
||||
--Draw Horizon/Direction
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.line(-942,-440,942,-440)
|
||||
--Draw Horizon/Direction
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.line(-942,-440,942,-440)
|
||||
|
||||
--Draw cubes
|
||||
for j=1,40 do
|
||||
local i=(j+lastCube-2)%40+1
|
||||
local Y=cubesY[i]
|
||||
if Y<8.8 then
|
||||
local size=100/(10-Y)
|
||||
local x=(cubesX[i]-player)/(10-Y)*200-size*.5
|
||||
local y=5/(10-Y)*150-50
|
||||
if Y>1 then
|
||||
gc.setColor(color)
|
||||
gc.rectangle('fill',x,y-485,size,size)
|
||||
gc.setLineWidth(size*.05)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',x,y-485,size,size)
|
||||
end
|
||||
end
|
||||
end
|
||||
--Draw cubes
|
||||
for j=1,40 do
|
||||
local i=(j+lastCube-2)%40+1
|
||||
local Y=cubesY[i]
|
||||
if Y<8.8 then
|
||||
local size=100/(10-Y)
|
||||
local x=(cubesX[i]-player)/(10-Y)*200-size*.5
|
||||
local y=5/(10-Y)*150-50
|
||||
if Y>1 then
|
||||
gc.setColor(color)
|
||||
gc.rectangle('fill',x,y-485,size,size)
|
||||
gc.setLineWidth(size*.05)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',x,y-485,size,size)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Draw menu
|
||||
if play then
|
||||
setFont(60)
|
||||
mStr(int(score),-300,-640)
|
||||
mStr(int(score),300,-640)
|
||||
if score%1000>920 then
|
||||
gc.setColor(1,1,1,abs(score%1000-970)*8)
|
||||
setFont(70)
|
||||
if level<11 then
|
||||
mStr("++SPEED++",0,-650)
|
||||
for i=1,3 do
|
||||
color[i]=near(color[i],cubeColor[level+1][i])
|
||||
end
|
||||
else
|
||||
mStr("!!MAXSPEED!!",0,-650)
|
||||
end
|
||||
end
|
||||
else
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('fill',-20,-20+ct,40,40)
|
||||
--Draw menu
|
||||
if play then
|
||||
setFont(60)
|
||||
mStr(int(score),-300,-640)
|
||||
mStr(int(score),300,-640)
|
||||
if score%1000>920 then
|
||||
gc.setColor(1,1,1,abs(score%1000-970)*8)
|
||||
setFont(70)
|
||||
if level<11 then
|
||||
mStr("++SPEED++",0,-650)
|
||||
for i=1,3 do
|
||||
color[i]=near(color[i],cubeColor[level+1][i])
|
||||
end
|
||||
else
|
||||
mStr("!!MAXSPEED!!",0,-650)
|
||||
end
|
||||
end
|
||||
else
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('fill',-20,-20+ct,40,40)
|
||||
|
||||
gc.setColor(1,1,1,(1-ct/60)*.1)
|
||||
gc.polygon('fill',-15,30,0,-440,15,30)
|
||||
gc.setColor(1,1,1,(1-ct/60)*.1)
|
||||
gc.polygon('fill',-15,30,0,-440,15,30)
|
||||
|
||||
gc.setColor(1,1,1,ct/60)
|
||||
gc.setColor(1,1,1,ct/60)
|
||||
|
||||
setFont(90)
|
||||
mStr("CubeField",0,-650)
|
||||
setFont(90)
|
||||
mStr("CubeField",0,-650)
|
||||
|
||||
setFont(20)
|
||||
gc.print("Original game by Max Abernethy",40,-550)
|
||||
gc.print("Original CX-CAS version by Loïc Pujet",40,-525)
|
||||
gc.print("Ported / Rewritten / Balanced by MrZ",40,-500)
|
||||
setFont(20)
|
||||
gc.print("Original game by Max Abernethy",40,-550)
|
||||
gc.print("Original CX-CAS version by Loïc Pujet",40,-525)
|
||||
gc.print("Ported / Rewritten / Balanced by MrZ",40,-500)
|
||||
|
||||
setFont(45)
|
||||
if score>0 then
|
||||
mStr("Score : "..score,0,-350)
|
||||
end
|
||||
setFont(45)
|
||||
if score>0 then
|
||||
mStr("Score : "..score,0,-350)
|
||||
end
|
||||
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",0,-160)
|
||||
end
|
||||
gc.pop()
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",0,-160)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="back",x=1140,y=80,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="back",x=1140,y=80,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -19,221 +19,221 @@ local score,floor,camY
|
||||
local color1,color2={},{}
|
||||
|
||||
local function restart()
|
||||
move={x=0,y=260,l=500}
|
||||
base={x=40,y=690,l=1200}
|
||||
message="Welcome"
|
||||
speed=10
|
||||
score=0
|
||||
floor=0
|
||||
camY=0
|
||||
for i=1,3 do
|
||||
color1[i]=rnd()
|
||||
color2[i]=rnd()
|
||||
end
|
||||
move={x=0,y=260,l=500}
|
||||
base={x=40,y=690,l=1200}
|
||||
message="Welcome"
|
||||
speed=10
|
||||
score=0
|
||||
floor=0
|
||||
camY=0
|
||||
for i=1,3 do
|
||||
color1[i]=rnd()
|
||||
color2[i]=rnd()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
restart()
|
||||
state='menu'
|
||||
BGM.play('hang out')
|
||||
BG.set('space')
|
||||
restart()
|
||||
state='menu'
|
||||
BGM.play('hang out')
|
||||
BG.set('space')
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="space"or key=="return"then
|
||||
if state=='move'then
|
||||
if floor>0 then
|
||||
if move.x<base.x then
|
||||
move.x=move.x+10
|
||||
elseif move.x>base.x then
|
||||
move.x=move.x-10
|
||||
end
|
||||
end
|
||||
SFX.play('swipe')
|
||||
state='drop'
|
||||
elseif state=='dead'then
|
||||
move.x,move.y,move.l=1e99,0,0
|
||||
base.x,base.y,base.l=1e99,0,0
|
||||
state='scroll'
|
||||
elseif state=='menu'then
|
||||
restart()
|
||||
state='move'
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="space"or key=="return"then
|
||||
if state=='move'then
|
||||
if floor>0 then
|
||||
if move.x<base.x then
|
||||
move.x=move.x+10
|
||||
elseif move.x>base.x then
|
||||
move.x=move.x-10
|
||||
end
|
||||
end
|
||||
SFX.play('swipe')
|
||||
state='drop'
|
||||
elseif state=='dead'then
|
||||
move.x,move.y,move.l=1e99,0,0
|
||||
base.x,base.y,base.l=1e99,0,0
|
||||
state='scroll'
|
||||
elseif state=='menu'then
|
||||
restart()
|
||||
state='move'
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(_,_,k)
|
||||
if k==1 then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
if k==1 then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
end
|
||||
function scene.touchDown()
|
||||
scene.keyDown("space")
|
||||
scene.keyDown("space")
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state=='move'then
|
||||
move.x=move.x+speed
|
||||
if speed<0 and move.x<=0 or speed>0 and move.x+move.l>=1280 then
|
||||
SFX.play('lock')
|
||||
speed=-speed
|
||||
end
|
||||
elseif state=='drop'then
|
||||
move.y=move.y+18
|
||||
if move.y>=660 then
|
||||
if move.x>base.x+base.l or move.x+move.l<base.x then
|
||||
message=miss[rnd(1,4)]
|
||||
state='die'
|
||||
else
|
||||
move.y=660
|
||||
SFX.play('clear_1')
|
||||
if floor>0 and move.x==base.x then
|
||||
SFX.play('ren_mega')
|
||||
end
|
||||
state='shorten'
|
||||
end
|
||||
end
|
||||
elseif state=='shorten'then
|
||||
if move.x>base.x+base.l or move.x+move.l<base.x then
|
||||
state='die'
|
||||
elseif move.x<base.x then
|
||||
move.x=move.x+5
|
||||
move.l=move.l-5
|
||||
elseif move.x+move.l>base.x+base.l then
|
||||
move.l=move.l-5
|
||||
else
|
||||
state='climb'
|
||||
end
|
||||
elseif state=='climb'then
|
||||
if base.y<720 then
|
||||
move.y=move.y+3
|
||||
base.y=base.y+3
|
||||
camY=camY+3
|
||||
else
|
||||
if move.x==base.x and move.x+move.l==base.x+base.l and floor~=0 then
|
||||
score=score+2
|
||||
message=perfect[rnd(1,3)]
|
||||
else
|
||||
score=score+1
|
||||
message=great[rnd(1,table.maxn(great))]
|
||||
end
|
||||
for i=1,3 do
|
||||
color2[i]=color1[i]
|
||||
color1[i]=rnd()
|
||||
end
|
||||
base.x=move.x
|
||||
base.y=690
|
||||
base.l=move.l
|
||||
floor=floor+1
|
||||
if rnd()<.5 then
|
||||
move.x=-move.l
|
||||
speed=10
|
||||
else
|
||||
move.x=1280
|
||||
speed=-10
|
||||
end
|
||||
move.y=rnd(max(260-floor*4,60),max(420-floor*5,100))
|
||||
state='move'
|
||||
end
|
||||
elseif state=='die'then
|
||||
move.y=move.y+18
|
||||
if move.y>1000 then
|
||||
highScore=max(score,highScore)
|
||||
highFloor=max(floor,floor)
|
||||
state='dead'
|
||||
end
|
||||
elseif state=='scroll'then
|
||||
camY=camY-floor/4
|
||||
if camY<1000 then camY=camY-1 end
|
||||
if camY<500 then camY=camY-1 end
|
||||
if camY<0 then
|
||||
restart()
|
||||
state='move'
|
||||
end
|
||||
end
|
||||
if state=='move'then
|
||||
move.x=move.x+speed
|
||||
if speed<0 and move.x<=0 or speed>0 and move.x+move.l>=1280 then
|
||||
SFX.play('lock')
|
||||
speed=-speed
|
||||
end
|
||||
elseif state=='drop'then
|
||||
move.y=move.y+18
|
||||
if move.y>=660 then
|
||||
if move.x>base.x+base.l or move.x+move.l<base.x then
|
||||
message=miss[rnd(1,4)]
|
||||
state='die'
|
||||
else
|
||||
move.y=660
|
||||
SFX.play('clear_1')
|
||||
if floor>0 and move.x==base.x then
|
||||
SFX.play('ren_mega')
|
||||
end
|
||||
state='shorten'
|
||||
end
|
||||
end
|
||||
elseif state=='shorten'then
|
||||
if move.x>base.x+base.l or move.x+move.l<base.x then
|
||||
state='die'
|
||||
elseif move.x<base.x then
|
||||
move.x=move.x+5
|
||||
move.l=move.l-5
|
||||
elseif move.x+move.l>base.x+base.l then
|
||||
move.l=move.l-5
|
||||
else
|
||||
state='climb'
|
||||
end
|
||||
elseif state=='climb'then
|
||||
if base.y<720 then
|
||||
move.y=move.y+3
|
||||
base.y=base.y+3
|
||||
camY=camY+3
|
||||
else
|
||||
if move.x==base.x and move.x+move.l==base.x+base.l and floor~=0 then
|
||||
score=score+2
|
||||
message=perfect[rnd(1,3)]
|
||||
else
|
||||
score=score+1
|
||||
message=great[rnd(1,table.maxn(great))]
|
||||
end
|
||||
for i=1,3 do
|
||||
color2[i]=color1[i]
|
||||
color1[i]=rnd()
|
||||
end
|
||||
base.x=move.x
|
||||
base.y=690
|
||||
base.l=move.l
|
||||
floor=floor+1
|
||||
if rnd()<.5 then
|
||||
move.x=-move.l
|
||||
speed=10
|
||||
else
|
||||
move.x=1280
|
||||
speed=-10
|
||||
end
|
||||
move.y=rnd(max(260-floor*4,60),max(420-floor*5,100))
|
||||
state='move'
|
||||
end
|
||||
elseif state=='die'then
|
||||
move.y=move.y+18
|
||||
if move.y>1000 then
|
||||
highScore=max(score,highScore)
|
||||
highFloor=max(floor,floor)
|
||||
state='dead'
|
||||
end
|
||||
elseif state=='scroll'then
|
||||
camY=camY-floor/4
|
||||
if camY<1000 then camY=camY-1 end
|
||||
if camY<500 then camY=camY-1 end
|
||||
if camY<0 then
|
||||
restart()
|
||||
state='move'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local backColor={
|
||||
{.71,1,.71},
|
||||
{.47,.86,1},
|
||||
{.63,.78,1},
|
||||
{.71,.71,.71},
|
||||
{.59,.55,.55},
|
||||
{.43,.43,.43,.9},
|
||||
{.34,.34,.34,.8},
|
||||
{.26,.26,.26,.7},
|
||||
{.71,1,.71},
|
||||
{.47,.86,1},
|
||||
{.63,.78,1},
|
||||
{.71,.71,.71},
|
||||
{.59,.55,.55},
|
||||
{.43,.43,.43,.9},
|
||||
{.34,.34,.34,.8},
|
||||
{.26,.26,.26,.7},
|
||||
}
|
||||
backColor.__index=function(t,lv)
|
||||
local a=backColor[#backColor][4]-.1
|
||||
t[lv]={.26,.26,.26,a}
|
||||
return t[lv]
|
||||
local a=backColor[#backColor][4]-.1
|
||||
t[lv]={.26,.26,.26,a}
|
||||
return t[lv]
|
||||
end
|
||||
setmetatable(backColor,backColor)
|
||||
function scene.draw()
|
||||
--Background
|
||||
local lv,height=int(camY/700),camY%700
|
||||
gc.setColor(backColor[lv+1]or COLOR.D)
|
||||
gc.rectangle('fill',0,720,1280,height-700)
|
||||
gc.setColor(backColor[lv+2]or COLOR.D)
|
||||
gc.rectangle('fill',0,height+20,1280,-height-20)
|
||||
if height-680>0 then
|
||||
gc.setColor(backColor[lv+3]or COLOR.D)
|
||||
gc.rectangle('fill',0,height-680,1280,680-height)
|
||||
end
|
||||
--Background
|
||||
local lv,height=int(camY/700),camY%700
|
||||
gc.setColor(backColor[lv+1]or COLOR.D)
|
||||
gc.rectangle('fill',0,720,1280,height-700)
|
||||
gc.setColor(backColor[lv+2]or COLOR.D)
|
||||
gc.rectangle('fill',0,height+20,1280,-height-20)
|
||||
if height-680>0 then
|
||||
gc.setColor(backColor[lv+3]or COLOR.D)
|
||||
gc.rectangle('fill',0,height-680,1280,680-height)
|
||||
end
|
||||
|
||||
if state=='menu'or state=='dead'then
|
||||
setFont(100)
|
||||
gc.setColor(COLOR.rainbow_light(TIME()*2.6))
|
||||
mStr("DROPPER",640,120)
|
||||
if state=='menu'or state=='dead'then
|
||||
setFont(100)
|
||||
gc.setColor(COLOR.rainbow_light(TIME()*2.6))
|
||||
mStr("DROPPER",640,120)
|
||||
|
||||
gc.setColor(COLOR.rainbow_gray(TIME()*1.626))
|
||||
setFont(55)
|
||||
mStr("Score - "..score,640,290)
|
||||
mStr("High Score - "..highScore,640,370)
|
||||
mStr("High Floor - "..highFloor,640,450)
|
||||
gc.setColor(COLOR.rainbow_gray(TIME()*1.626))
|
||||
setFont(55)
|
||||
mStr("Score - "..score,640,290)
|
||||
mStr("High Score - "..highScore,640,370)
|
||||
mStr("High Floor - "..highFloor,640,450)
|
||||
|
||||
gc.setColor(COLOR.D)
|
||||
setFont(35)
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",640,570)
|
||||
setFont(20)
|
||||
gc.print("Original CX-CAS version by MrZ",740,235)
|
||||
gc.print("Ported / Rewritten / Balanced by MrZ",740,260)
|
||||
end
|
||||
if state~='menu'then
|
||||
--High floor
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
local y=690+camY-30*highFloor
|
||||
gc.line(0,y,1280,y)
|
||||
gc.setColor(COLOR.D)
|
||||
setFont(35)
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",640,570)
|
||||
setFont(20)
|
||||
gc.print("Original CX-CAS version by MrZ",740,235)
|
||||
gc.print("Ported / Rewritten / Balanced by MrZ",740,260)
|
||||
end
|
||||
if state~='menu'then
|
||||
--High floor
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
local y=690+camY-30*highFloor
|
||||
gc.line(0,y,1280,y)
|
||||
|
||||
gc.setLineWidth(6)
|
||||
gc.rectangle('line',move.x-3,move.y-3,move.l+6,36)
|
||||
gc.rectangle('line',base.x-3,base.y-3,base.l+6,36)
|
||||
gc.setLineWidth(6)
|
||||
gc.rectangle('line',move.x-3,move.y-3,move.l+6,36)
|
||||
gc.rectangle('line',base.x-3,base.y-3,base.l+6,36)
|
||||
|
||||
setFont(45)
|
||||
gc.print(floor+1,move.x+move.l+15,move.y-18)
|
||||
gc.print(floor,base.x+base.l+15,base.y-18)
|
||||
setFont(45)
|
||||
gc.print(floor+1,move.x+move.l+15,move.y-18)
|
||||
gc.print(floor,base.x+base.l+15,base.y-18)
|
||||
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(message,640,0)
|
||||
gc.setColor(COLOR.D)
|
||||
mStr(message,643,2)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(message,640,0)
|
||||
gc.setColor(COLOR.D)
|
||||
mStr(message,643,2)
|
||||
|
||||
setFont(70)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(score,60,40)
|
||||
gc.setColor(COLOR.D)
|
||||
gc.print(score,64,43)
|
||||
setFont(70)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(score,60,40)
|
||||
gc.setColor(COLOR.D)
|
||||
gc.print(score,64,43)
|
||||
|
||||
gc.setColor(color1)gc.rectangle('fill',move.x,move.y,move.l,30)
|
||||
gc.setColor(color2)gc.rectangle('fill',base.x,base.y,base.l,30)
|
||||
end
|
||||
gc.setColor(color1)gc.rectangle('fill',move.x,move.y,move.l,30)
|
||||
gc.setColor(color2)gc.rectangle('fill',base.x,base.y,base.l,30)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="back",x=1140,y=60,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},
|
||||
WIDGET.newButton{name="back",x=1140,y=60,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -4,13 +4,13 @@ local int,rnd=math.floor,math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local targets={
|
||||
[40]=true,
|
||||
[100]=true,
|
||||
[200]=true,
|
||||
[400]=true,
|
||||
[620]=true,
|
||||
[1000]=true,
|
||||
[2600]=true,
|
||||
[40]=true,
|
||||
[100]=true,
|
||||
[200]=true,
|
||||
[400]=true,
|
||||
[620]=true,
|
||||
[1000]=true,
|
||||
[2600]=true,
|
||||
}
|
||||
|
||||
local state,progress
|
||||
@@ -23,33 +23,33 @@ local bgm="secret7th"
|
||||
local tileColor="black"
|
||||
local mode="Normal"
|
||||
local modeSelector=WIDGET.newSelector{name="mode",x=155,y=220,w=280,
|
||||
list={
|
||||
"Normal",
|
||||
"Split",
|
||||
"Short",
|
||||
"Stairs",
|
||||
"Double",
|
||||
"Singlestream",
|
||||
"Light_Jumpstream",
|
||||
"Dense_Jumpstream",
|
||||
"Light_Handstream",
|
||||
"Dense_Handstream",
|
||||
"Light_Quadstream",
|
||||
"Quadstream",
|
||||
},disp=function()return mode end,code=function(m)mode=m end
|
||||
list={
|
||||
"Normal",
|
||||
"Split",
|
||||
"Short",
|
||||
"Stairs",
|
||||
"Double",
|
||||
"Singlestream",
|
||||
"Light_Jumpstream",
|
||||
"Dense_Jumpstream",
|
||||
"Light_Handstream",
|
||||
"Dense_Handstream",
|
||||
"Light_Quadstream",
|
||||
"Quadstream",
|
||||
},disp=function()return mode end,code=function(m)mode=m end
|
||||
}
|
||||
local bgmSelector=WIDGET.newSelector{name="bgm",x=155,y=290,w=280,list=BGM.getList(),disp=function()return bgm end,code=function(i)bgm=i BGM.play(i)end}
|
||||
local colorSelector=WIDGET.newSelector{name="color",x=155,y=360,w=280,
|
||||
list={"black","dGray","gray","lGray","dRed","red","lRed","dFire","fire","lFire","dOrange","orange","lOrange","dYellow","yellow","lYellow","dLime","lime","lLime","dJade","jade","lJade","dGreen","green","lGreen","dAqua","aqua","lAqua","dCyan","cyan","lCyan","dNavy","navy","lNavy","dSea","sea","lSea","dBlue","blue","lBlue","dViolet","violet","lViolet","dPurple","purple","lPurple","dMagenta","magenta","lMagenta","dWine","wine","lWine"},
|
||||
disp=function()return tileColor end,code=function(m)tileColor=m end
|
||||
list={"black","dGray","gray","lGray","dRed","red","lRed","dFire","fire","lFire","dOrange","orange","lOrange","dYellow","yellow","lYellow","dLime","lime","lLime","dJade","jade","lJade","dGreen","green","lGreen","dAqua","aqua","lAqua","dCyan","cyan","lCyan","dNavy","navy","lNavy","dSea","sea","lSea","dBlue","blue","lBlue","dViolet","violet","lViolet","dPurple","purple","lPurple","dMagenta","magenta","lMagenta","dWine","wine","lWine"},
|
||||
disp=function()return tileColor end,code=function(m)tileColor=m end
|
||||
}
|
||||
local arcadeSwitch=WIDGET.newSwitch{name="arcade", x=230,y=430,font=40,disp=function()return arcade end,code=pressKey"e"}
|
||||
local arcadeSwitch=WIDGET.newSwitch{name="arcade", x=230,y=430,font=40,disp=function()return arcade end,code=pressKey"e"}
|
||||
local function freshSelectors()
|
||||
local f=state~=0
|
||||
modeSelector.hide=f
|
||||
bgmSelector.hide=f
|
||||
colorSelector.hide=f
|
||||
arcadeSwitch.hide=f
|
||||
local f=state~=0
|
||||
modeSelector.hide=f
|
||||
bgmSelector.hide=f
|
||||
colorSelector.hide=f
|
||||
arcadeSwitch.hide=f
|
||||
end
|
||||
|
||||
local score
|
||||
@@ -57,323 +57,323 @@ local pos,height
|
||||
local diePos
|
||||
|
||||
local function get1(prev)
|
||||
if prev<10 or prev>999 then
|
||||
local r=rnd(3)
|
||||
return r>=prev and r+1 or r
|
||||
else
|
||||
while true do
|
||||
local r=rnd(4)
|
||||
if not string.find(prev,r)then return r end
|
||||
end
|
||||
end
|
||||
if prev<10 or prev>999 then
|
||||
local r=rnd(3)
|
||||
return r>=prev and r+1 or r
|
||||
else
|
||||
while true do
|
||||
local r=rnd(4)
|
||||
if not string.find(prev,r)then return r end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function get2(prev)
|
||||
while true do
|
||||
local i=rnd(4)
|
||||
local r=rnd(3)
|
||||
if r>=i then r=r+1 end
|
||||
if not(string.find(prev,r)or string.find(prev,i))then
|
||||
return 10*i+r
|
||||
end
|
||||
end
|
||||
while true do
|
||||
local i=rnd(4)
|
||||
local r=rnd(3)
|
||||
if r>=i then r=r+1 end
|
||||
if not(string.find(prev,r)or string.find(prev,i))then
|
||||
return 10*i+r
|
||||
end
|
||||
end
|
||||
end
|
||||
local function get3(prev)
|
||||
if prev==0 then prev=rnd(4)end
|
||||
if prev==1 then return 234
|
||||
elseif prev==2 then return 134
|
||||
elseif prev==3 then return 124
|
||||
elseif prev==4 then return 123
|
||||
else error("wrong get3 usage: "..(prev or -1))
|
||||
end
|
||||
if prev==0 then prev=rnd(4)end
|
||||
if prev==1 then return 234
|
||||
elseif prev==2 then return 134
|
||||
elseif prev==3 then return 124
|
||||
elseif prev==4 then return 123
|
||||
else error("wrong get3 usage: "..(prev or -1))
|
||||
end
|
||||
end
|
||||
|
||||
local generator={
|
||||
Normal=function()
|
||||
ins(pos,rnd(4))
|
||||
end,
|
||||
Split=function()
|
||||
if #pos==0 then ins(pos,rnd(4))end
|
||||
ins(pos,pos[#pos]<=2 and rnd(3,4)or rnd(2))
|
||||
end,
|
||||
Short=function()
|
||||
if #pos<2 then ins(pos,rnd(4))ins(pos,rnd(4))end
|
||||
local r
|
||||
if pos[#pos]==pos[#pos-1]then
|
||||
r=rnd(3)
|
||||
if r>=pos[#pos]then r=r+1 end
|
||||
ins(pos,r)
|
||||
else
|
||||
ins(pos,rnd(4))
|
||||
end
|
||||
end,
|
||||
Stairs=function()
|
||||
local r=get1(pos[#pos]or 0)
|
||||
local dir=r==1 and 1 or r==4 and -1 or rnd()<.5 and 1 or -1
|
||||
local count=rnd(3,5)
|
||||
while count>0 do
|
||||
ins(pos,r)
|
||||
r=r+dir
|
||||
if r==0 then
|
||||
r,dir=2,1
|
||||
elseif r==5 then
|
||||
r,dir=3,-1
|
||||
end
|
||||
count=count-1
|
||||
end
|
||||
end,
|
||||
Double=function()
|
||||
local i=rnd(4)
|
||||
local r=rnd(3)
|
||||
if r>=i then r=r+1 end
|
||||
r=10*i+r
|
||||
ins(pos,r)
|
||||
end,
|
||||
Singlestream=function()
|
||||
ins(pos,get1(pos[#pos]or 0))
|
||||
end,
|
||||
Light_Jumpstream=function()--2111
|
||||
ins(pos,get2(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Dense_Jumpstream=function()--2121
|
||||
ins(pos,get2(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Light_Handstream=function()--3111
|
||||
ins(pos,get3(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Dense_Handstream=function()--3121
|
||||
ins(pos,get3(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Light_Quadstream=function()--4111
|
||||
ins(pos,1234)
|
||||
ins(pos,get1(pos[#pos-1]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Quadstream=function()--4121
|
||||
ins(pos,1234)
|
||||
ins(pos,get1(pos[#pos-1]or 0))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Normal=function()
|
||||
ins(pos,rnd(4))
|
||||
end,
|
||||
Split=function()
|
||||
if #pos==0 then ins(pos,rnd(4))end
|
||||
ins(pos,pos[#pos]<=2 and rnd(3,4)or rnd(2))
|
||||
end,
|
||||
Short=function()
|
||||
if #pos<2 then ins(pos,rnd(4))ins(pos,rnd(4))end
|
||||
local r
|
||||
if pos[#pos]==pos[#pos-1]then
|
||||
r=rnd(3)
|
||||
if r>=pos[#pos]then r=r+1 end
|
||||
ins(pos,r)
|
||||
else
|
||||
ins(pos,rnd(4))
|
||||
end
|
||||
end,
|
||||
Stairs=function()
|
||||
local r=get1(pos[#pos]or 0)
|
||||
local dir=r==1 and 1 or r==4 and -1 or rnd()<.5 and 1 or -1
|
||||
local count=rnd(3,5)
|
||||
while count>0 do
|
||||
ins(pos,r)
|
||||
r=r+dir
|
||||
if r==0 then
|
||||
r,dir=2,1
|
||||
elseif r==5 then
|
||||
r,dir=3,-1
|
||||
end
|
||||
count=count-1
|
||||
end
|
||||
end,
|
||||
Double=function()
|
||||
local i=rnd(4)
|
||||
local r=rnd(3)
|
||||
if r>=i then r=r+1 end
|
||||
r=10*i+r
|
||||
ins(pos,r)
|
||||
end,
|
||||
Singlestream=function()
|
||||
ins(pos,get1(pos[#pos]or 0))
|
||||
end,
|
||||
Light_Jumpstream=function()--2111
|
||||
ins(pos,get2(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Dense_Jumpstream=function()--2121
|
||||
ins(pos,get2(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Light_Handstream=function()--3111
|
||||
ins(pos,get3(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Dense_Handstream=function()--3121
|
||||
ins(pos,get3(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Light_Quadstream=function()--4111
|
||||
ins(pos,1234)
|
||||
ins(pos,get1(pos[#pos-1]or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Quadstream=function()--4121
|
||||
ins(pos,1234)
|
||||
ins(pos,get1(pos[#pos-1]or 0))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
}
|
||||
|
||||
local function reset()
|
||||
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
||||
speed,maxSpeed=0,0
|
||||
progress={}
|
||||
state=0
|
||||
freshSelectors()
|
||||
time=0
|
||||
score=0
|
||||
rollSpeed=6.26
|
||||
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
||||
speed,maxSpeed=0,0
|
||||
progress={}
|
||||
state=0
|
||||
freshSelectors()
|
||||
time=0
|
||||
score=0
|
||||
rollSpeed=6.26
|
||||
|
||||
pos={}
|
||||
while #pos<7 do generator[mode]()end
|
||||
height=0
|
||||
diePos=false
|
||||
pos={}
|
||||
while #pos<7 do generator[mode]()end
|
||||
height=0
|
||||
diePos=false
|
||||
end
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
reset()
|
||||
BG.set('gray')
|
||||
BGM.play(bgm)
|
||||
reset()
|
||||
BG.set('gray')
|
||||
BGM.play(bgm)
|
||||
end
|
||||
|
||||
local function touch(n)
|
||||
if state==0 then
|
||||
state=1
|
||||
freshSelectors()
|
||||
startTime=TIME()
|
||||
end
|
||||
local t=tostring(pos[1])
|
||||
local p=string.find(t,n)
|
||||
if p then
|
||||
t=t:sub(1,p-1)..t:sub(p+1)
|
||||
if #t>0 then
|
||||
pos[1]=tonumber(t)
|
||||
SFX.play('move')
|
||||
else
|
||||
rem(pos,1)
|
||||
while #pos<7 do generator[mode]()end
|
||||
ins(keyTime,1,TIME())
|
||||
keyTime[21]=nil
|
||||
score=score+1
|
||||
if not arcade and targets[score]then
|
||||
ins(progress,("%s - %.3fs"):format(score,TIME()-startTime))
|
||||
if score==2600 then
|
||||
for i=1,#pos do
|
||||
pos[i]=626
|
||||
end
|
||||
time=TIME()-startTime
|
||||
state=2
|
||||
SFX.play('win')
|
||||
else
|
||||
SFX.play('reach',.5)
|
||||
end
|
||||
end
|
||||
height=height+120
|
||||
SFX.play('move')
|
||||
end
|
||||
else
|
||||
time=TIME()-startTime
|
||||
state=2
|
||||
diePos=n
|
||||
SFX.play('clear_2')
|
||||
end
|
||||
if state==0 then
|
||||
state=1
|
||||
freshSelectors()
|
||||
startTime=TIME()
|
||||
end
|
||||
local t=tostring(pos[1])
|
||||
local p=string.find(t,n)
|
||||
if p then
|
||||
t=t:sub(1,p-1)..t:sub(p+1)
|
||||
if #t>0 then
|
||||
pos[1]=tonumber(t)
|
||||
SFX.play('move')
|
||||
else
|
||||
rem(pos,1)
|
||||
while #pos<7 do generator[mode]()end
|
||||
ins(keyTime,1,TIME())
|
||||
keyTime[21]=nil
|
||||
score=score+1
|
||||
if not arcade and targets[score]then
|
||||
ins(progress,("%s - %.3fs"):format(score,TIME()-startTime))
|
||||
if score==2600 then
|
||||
for i=1,#pos do
|
||||
pos[i]=626
|
||||
end
|
||||
time=TIME()-startTime
|
||||
state=2
|
||||
SFX.play('win')
|
||||
else
|
||||
SFX.play('reach',.5)
|
||||
end
|
||||
end
|
||||
height=height+120
|
||||
SFX.play('move')
|
||||
end
|
||||
else
|
||||
time=TIME()-startTime
|
||||
state=2
|
||||
diePos=n
|
||||
SFX.play('clear_2')
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="r"or key=="space"then reset()
|
||||
elseif key=="escape"then SCN.back()
|
||||
elseif state~=2 then
|
||||
if key=="d"or key=="c"then touch(1)
|
||||
elseif key=="f"or key=="v"then touch(2)
|
||||
elseif key=="j"or key=="n"then touch(3)
|
||||
elseif key=="k"or key=="m"then touch(4)
|
||||
elseif state==0 then
|
||||
if key=="tab"then
|
||||
local mode1=mode
|
||||
modeSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
if mode1~=mode then reset()end
|
||||
elseif key=="q"then
|
||||
bgmSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
elseif key=="w"then
|
||||
colorSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
elseif key=="e"then
|
||||
arcade=not arcade
|
||||
end
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="r"or key=="space"then reset()
|
||||
elseif key=="escape"then SCN.back()
|
||||
elseif state~=2 then
|
||||
if key=="d"or key=="c"then touch(1)
|
||||
elseif key=="f"or key=="v"then touch(2)
|
||||
elseif key=="j"or key=="n"then touch(3)
|
||||
elseif key=="k"or key=="m"then touch(4)
|
||||
elseif state==0 then
|
||||
if key=="tab"then
|
||||
local mode1=mode
|
||||
modeSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
if mode1~=mode then reset()end
|
||||
elseif key=="q"then
|
||||
bgmSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
elseif key=="w"then
|
||||
colorSelector:scroll(love.keyboard.isDown("lshift","rshift")and -1 or 1)
|
||||
elseif key=="e"then
|
||||
arcade=not arcade
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(x)
|
||||
scene.touchDown(x)
|
||||
scene.touchDown(x)
|
||||
end
|
||||
function scene.touchDown(x)
|
||||
if state==2 then return end
|
||||
x=int((x-300)/170+1)
|
||||
if x>=1 and x<=4 then
|
||||
touch(x)
|
||||
end
|
||||
if state==2 then return end
|
||||
x=int((x-300)/170+1)
|
||||
if x>=1 and x<=4 then
|
||||
touch(x)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state==1 then
|
||||
local t=TIME()
|
||||
time=t-startTime
|
||||
local v=0
|
||||
for i=2,20 do v=v+i*(i-1)*.3/(t-keyTime[i])end
|
||||
speed=speed*.99+v*.01
|
||||
if speed>maxSpeed then maxSpeed=speed end
|
||||
if state==1 then
|
||||
local t=TIME()
|
||||
time=t-startTime
|
||||
local v=0
|
||||
for i=2,20 do v=v+i*(i-1)*.3/(t-keyTime[i])end
|
||||
speed=speed*.99+v*.01
|
||||
if speed>maxSpeed then maxSpeed=speed end
|
||||
|
||||
if arcade then
|
||||
height=height-rollSpeed
|
||||
rollSpeed=rollSpeed+.00355
|
||||
if height<-120 then
|
||||
state=2
|
||||
SFX.play('clear_2')
|
||||
end
|
||||
else
|
||||
height=height*.6
|
||||
end
|
||||
end
|
||||
if arcade then
|
||||
height=height-rollSpeed
|
||||
rollSpeed=rollSpeed+.00355
|
||||
if height<-120 then
|
||||
state=2
|
||||
SFX.play('clear_2')
|
||||
end
|
||||
else
|
||||
height=height*.6
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function boardStencil()gc.rectangle('fill',300,0,680,720)end
|
||||
function scene.draw()
|
||||
setFont(50)
|
||||
if arcade then
|
||||
--Draw rolling speed
|
||||
mStr(("%.2f/s"):format(rollSpeed/2),155,490)
|
||||
else
|
||||
--Draw speed
|
||||
setFont(45)
|
||||
gc.setColor(1,.6,.6)
|
||||
mStr(("%.2f"):format(maxSpeed/60),155,460)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(("%.2f"):format(speed/60),155,520)
|
||||
setFont(50)
|
||||
if arcade then
|
||||
--Draw rolling speed
|
||||
mStr(("%.2f/s"):format(rollSpeed/2),155,490)
|
||||
else
|
||||
--Draw speed
|
||||
setFont(45)
|
||||
gc.setColor(1,.6,.6)
|
||||
mStr(("%.2f"):format(maxSpeed/60),155,460)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(("%.2f"):format(speed/60),155,520)
|
||||
|
||||
--Progress time list
|
||||
setFont(30)
|
||||
gc.setColor(.6,.6,.6)
|
||||
for i=1,#progress do
|
||||
gc.print(progress[i],1030,120+25*i)
|
||||
end
|
||||
--Progress time list
|
||||
setFont(30)
|
||||
gc.setColor(.6,.6,.6)
|
||||
for i=1,#progress do
|
||||
gc.print(progress[i],1030,120+25*i)
|
||||
end
|
||||
|
||||
--Draw time
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(45)
|
||||
gc.print(("%.3f"):format(time),1030,70)
|
||||
end
|
||||
--Draw time
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(45)
|
||||
gc.print(("%.3f"):format(time),1030,70)
|
||||
end
|
||||
|
||||
--Draw mode
|
||||
if state~=0 then
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(30)mStr(mode,155,212)
|
||||
end
|
||||
--Draw mode
|
||||
if state~=0 then
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(30)mStr(mode,155,212)
|
||||
end
|
||||
|
||||
--Draw tiles
|
||||
gc.stencil(boardStencil)
|
||||
gc.setStencilTest('equal',1)
|
||||
gc.rectangle('fill',300,0,680,720)
|
||||
gc.setColor(COLOR[tileColor])
|
||||
gc.push('transform')
|
||||
gc.translate(0,720-height+8)
|
||||
for i=1,7 do
|
||||
local t=pos[i]
|
||||
while t>0 do
|
||||
gc.rectangle('fill',130+170*(t%10)+8,-i*120,170-16,120-16)
|
||||
t=(t-t%10)/10
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
gc.setStencilTest()
|
||||
--Draw track line
|
||||
gc.setColor(COLOR.D)
|
||||
gc.setLineWidth(2)
|
||||
for x=1,5 do
|
||||
x=130+170*x
|
||||
gc.line(x,0,x,720)
|
||||
end
|
||||
for y=0,6 do
|
||||
y=720-120*y-height%120
|
||||
gc.line(300,y,980,y)
|
||||
end
|
||||
--Draw tiles
|
||||
gc.stencil(boardStencil)
|
||||
gc.setStencilTest('equal',1)
|
||||
gc.rectangle('fill',300,0,680,720)
|
||||
gc.setColor(COLOR[tileColor])
|
||||
gc.push('transform')
|
||||
gc.translate(0,720-height+8)
|
||||
for i=1,7 do
|
||||
local t=pos[i]
|
||||
while t>0 do
|
||||
gc.rectangle('fill',130+170*(t%10)+8,-i*120,170-16,120-16)
|
||||
t=(t-t%10)/10
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
gc.setStencilTest()
|
||||
--Draw track line
|
||||
gc.setColor(COLOR.D)
|
||||
gc.setLineWidth(2)
|
||||
for x=1,5 do
|
||||
x=130+170*x
|
||||
gc.line(x,0,x,720)
|
||||
end
|
||||
for y=0,6 do
|
||||
y=720-120*y-height%120
|
||||
gc.line(300,y,980,y)
|
||||
end
|
||||
|
||||
--Draw red tile
|
||||
if diePos then
|
||||
gc.setColor(1,.2,.2)
|
||||
gc.rectangle('fill',130+170*diePos+8,600-height+8,170-16,120-16)
|
||||
end
|
||||
--Draw red tile
|
||||
if diePos then
|
||||
gc.setColor(1,.2,.2)
|
||||
gc.rectangle('fill',130+170*diePos+8,600-height+8,170-16,120-16)
|
||||
end
|
||||
|
||||
--Draw score
|
||||
setFont(100)
|
||||
gc.push('transform')
|
||||
gc.translate(640,26)
|
||||
gc.scale(1.6)
|
||||
gc.setColor(.5,.5,.5,.6)
|
||||
mStr(score,0,0)
|
||||
gc.pop()
|
||||
--Draw score
|
||||
setFont(100)
|
||||
gc.push('transform')
|
||||
gc.translate(640,26)
|
||||
gc.scale(1.6)
|
||||
gc.setColor(.5,.5,.5,.6)
|
||||
mStr(score,0,0)
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="reset", x=155,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
modeSelector,bgmSelector,colorSelector,
|
||||
arcadeSwitch,
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="reset",x=155,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
modeSelector,bgmSelector,colorSelector,
|
||||
arcadeSwitch,
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -10,158 +10,158 @@ local side,count
|
||||
local needReset
|
||||
|
||||
local function new()
|
||||
if needReset then
|
||||
side=math.max(side-2,6)
|
||||
needReset=false
|
||||
else
|
||||
side=side+1
|
||||
end
|
||||
count=0
|
||||
for c=1,side do
|
||||
hit[c]=0
|
||||
dist[c]=rnd(80,270)+637.5
|
||||
end
|
||||
if needReset then
|
||||
side=math.max(side-2,6)
|
||||
needReset=false
|
||||
else
|
||||
side=side+1
|
||||
end
|
||||
count=0
|
||||
for c=1,side do
|
||||
hit[c]=0
|
||||
dist[c]=rnd(80,270)+637.5
|
||||
end
|
||||
end
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
state=0
|
||||
ang,pos=0,-tau/4
|
||||
timer=50
|
||||
hit,dist={},{}
|
||||
side=rnd(3,6)*2
|
||||
needReset=true
|
||||
for c=1,side,2 do
|
||||
hit[c],hit[c+1]=rnd(2),rnd(2)
|
||||
dist[c],dist[c+1]=226,126
|
||||
end
|
||||
BG.set('none')
|
||||
BGM.play('dream')
|
||||
state=0
|
||||
ang,pos=0,-tau/4
|
||||
timer=50
|
||||
hit,dist={},{}
|
||||
side=rnd(3,6)*2
|
||||
needReset=true
|
||||
for c=1,side,2 do
|
||||
hit[c],hit[c+1]=rnd(2),rnd(2)
|
||||
dist[c],dist[c+1]=226,126
|
||||
end
|
||||
BG.set('none')
|
||||
BGM.play('dream')
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
elseif key=="space"then
|
||||
if state==0 then--main
|
||||
if timer==0 then
|
||||
state=1
|
||||
end
|
||||
elseif state==3 then--play
|
||||
local c=(math.floor((pos-ang)*side/tau)-1)%side+1
|
||||
if hit[c]==0 then
|
||||
hit[c]=1
|
||||
count=count+1
|
||||
SFX.play(side<26 and'ren_'..rnd(5)or'ren_'..rnd(6,11))
|
||||
if count>=12 then
|
||||
SFX.play('ren_mega',(count-11)/15)
|
||||
end
|
||||
if count==side then
|
||||
state=1
|
||||
SFX.play('spin_0')
|
||||
else
|
||||
SFX.play('lock')
|
||||
end
|
||||
else
|
||||
hit[c]=2
|
||||
SFX.play('emit')
|
||||
needReset=true
|
||||
state=1
|
||||
end
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
elseif key=="space"then
|
||||
if state==0 then--main
|
||||
if timer==0 then
|
||||
state=1
|
||||
end
|
||||
elseif state==3 then--play
|
||||
local c=(math.floor((pos-ang)*side/tau)-1)%side+1
|
||||
if hit[c]==0 then
|
||||
hit[c]=1
|
||||
count=count+1
|
||||
SFX.play(side<26 and'ren_'..rnd(5)or'ren_'..rnd(6,11))
|
||||
if count>=12 then
|
||||
SFX.play('ren_mega',(count-11)/15)
|
||||
end
|
||||
if count==side then
|
||||
state=1
|
||||
SFX.play('spin_0')
|
||||
else
|
||||
SFX.play('lock')
|
||||
end
|
||||
else
|
||||
hit[c]=2
|
||||
SFX.play('emit')
|
||||
needReset=true
|
||||
state=1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(_,_,k)
|
||||
if k==1 then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
if k==1 then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
end
|
||||
function scene.touchDown()
|
||||
scene.keyDown("space")
|
||||
scene.keyDown("space")
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state==0 then--main
|
||||
ang=ang-.02
|
||||
if ang>0 then ang=ang-tau end
|
||||
if pos<ang then pos=pos+tau end
|
||||
if timer>0 then timer=timer-1 end
|
||||
elseif state==1 or state==2 then--zoom
|
||||
ang=ang+.02+timer/260
|
||||
pos=pos-.016
|
||||
if ang>0 then ang=ang-tau end
|
||||
if pos<ang then pos=pos+tau end
|
||||
if state==1 then
|
||||
for c=1,side do
|
||||
dist[c]=dist[c]+timer/2
|
||||
end
|
||||
timer=timer+1
|
||||
if timer==50 then
|
||||
state=2
|
||||
new()
|
||||
end
|
||||
else
|
||||
for c=1,side do
|
||||
dist[c]=dist[c]-timer/2
|
||||
end
|
||||
timer=timer-1
|
||||
if timer==0 then
|
||||
state=3
|
||||
end
|
||||
end
|
||||
elseif state==3 then--play
|
||||
ang=ang+.02
|
||||
pos=pos-.016
|
||||
if ang>0 then
|
||||
ang=ang-tau
|
||||
end
|
||||
if pos<ang then
|
||||
pos=pos+tau
|
||||
end
|
||||
end
|
||||
if state==0 then--main
|
||||
ang=ang-.02
|
||||
if ang>0 then ang=ang-tau end
|
||||
if pos<ang then pos=pos+tau end
|
||||
if timer>0 then timer=timer-1 end
|
||||
elseif state==1 or state==2 then--zoom
|
||||
ang=ang+.02+timer/260
|
||||
pos=pos-.016
|
||||
if ang>0 then ang=ang-tau end
|
||||
if pos<ang then pos=pos+tau end
|
||||
if state==1 then
|
||||
for c=1,side do
|
||||
dist[c]=dist[c]+timer/2
|
||||
end
|
||||
timer=timer+1
|
||||
if timer==50 then
|
||||
state=2
|
||||
new()
|
||||
end
|
||||
else
|
||||
for c=1,side do
|
||||
dist[c]=dist[c]-timer/2
|
||||
end
|
||||
timer=timer-1
|
||||
if timer==0 then
|
||||
state=3
|
||||
end
|
||||
end
|
||||
elseif state==3 then--play
|
||||
ang=ang+.02
|
||||
pos=pos-.016
|
||||
if ang>0 then
|
||||
ang=ang-tau
|
||||
end
|
||||
if pos<ang then
|
||||
pos=pos+tau
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.clear(.9,.9,.9)
|
||||
gc.setColor(0,0,0,1-timer/50)
|
||||
setFont(80)
|
||||
mStr(side,640,300)
|
||||
gc.polygon('fill',
|
||||
640+cos(pos-.03)*300,360+sin(pos-.03)*300,
|
||||
640+cos(pos)*285,360+sin(pos)*285,
|
||||
640+cos(pos+.03)*300,360+sin(pos+.03)*300
|
||||
)
|
||||
gc.setLineWidth(4)
|
||||
for i=1,side do
|
||||
local dx=cos(ang+tau*i/side)*dist[i]
|
||||
local dy=sin(ang+tau*i/side)*dist[i]
|
||||
local dX=cos(ang+tau*(i%side+1)/side)*dist[i%side+1]
|
||||
local dY=sin(ang+tau*(i%side+1)/side)*dist[i%side+1]
|
||||
gc.setColor(0,0,0,.12)
|
||||
gc.line(640,360,640+dx,360+dy)
|
||||
if hit[i]==0 then gc.setColor(0,0,0,.3)
|
||||
elseif hit[i]==1 then gc.setColor(.8,0,0)
|
||||
elseif hit[i]==2 then gc.setColor(.4,0,.8)
|
||||
end
|
||||
gc.line(640+dx,360+dy,640+dX,360+dY)
|
||||
end
|
||||
if state==0 then
|
||||
gc.setColor(0,0,0,1-timer/50)
|
||||
setFont(30)
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",640,630)
|
||||
else
|
||||
gc.setColor(0,0,0,timer/50)
|
||||
gc.print("POLYFORGE",20,620)
|
||||
setFont(30)
|
||||
gc.print("Idea by ImpactBlue Studios",860,630)
|
||||
gc.print("n-Spire ver. & ported & improved by MrZ",670,670)
|
||||
end
|
||||
gc.clear(.9,.9,.9)
|
||||
gc.setColor(0,0,0,1-timer/50)
|
||||
setFont(80)
|
||||
mStr(side,640,300)
|
||||
gc.polygon('fill',
|
||||
640+cos(pos-.03)*300,360+sin(pos-.03)*300,
|
||||
640+cos(pos)*285,360+sin(pos)*285,
|
||||
640+cos(pos+.03)*300,360+sin(pos+.03)*300
|
||||
)
|
||||
gc.setLineWidth(4)
|
||||
for i=1,side do
|
||||
local dx=cos(ang+tau*i/side)*dist[i]
|
||||
local dy=sin(ang+tau*i/side)*dist[i]
|
||||
local dX=cos(ang+tau*(i%side+1)/side)*dist[i%side+1]
|
||||
local dY=sin(ang+tau*(i%side+1)/side)*dist[i%side+1]
|
||||
gc.setColor(0,0,0,.12)
|
||||
gc.line(640,360,640+dx,360+dy)
|
||||
if hit[i]==0 then gc.setColor(0,0,0,.3)
|
||||
elseif hit[i]==1 then gc.setColor(.8,0,0)
|
||||
elseif hit[i]==2 then gc.setColor(.4,0,.8)
|
||||
end
|
||||
gc.line(640+dx,360+dy,640+dX,360+dY)
|
||||
end
|
||||
if state==0 then
|
||||
gc.setColor(0,0,0,1-timer/50)
|
||||
setFont(30)
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",640,630)
|
||||
else
|
||||
gc.setColor(0,0,0,timer/50)
|
||||
gc.print("POLYFORGE",20,620)
|
||||
setFont(30)
|
||||
gc.print("Idea by ImpactBlue Studios",860,630)
|
||||
gc.print("n-Spire ver. & ported & improved by MrZ",670,670)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="back",x=1140,y=60,w=170,h=80,color='D',fText=TEXTURE.back,code=pressKey"escape"},
|
||||
WIDGET.newKey{name="back",x=1140,y=60,w=170,h=80,color='D',fText=TEXTURE.back,code=pressKey"escape"},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -15,165 +15,165 @@ local ry=0--Rotation Y
|
||||
local p1,p2--Player data
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('none')
|
||||
BGM.play('way')
|
||||
state=0
|
||||
BG.set('none')
|
||||
BGM.play('way')
|
||||
state=0
|
||||
|
||||
bx,by=640,360
|
||||
vx,vy=0,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()
|
||||
state=1
|
||||
vx=rnd()>.5 and 6 or -6
|
||||
vy=rnd()*6-3
|
||||
state=1
|
||||
vx=rnd()>.5 and 6 or -6
|
||||
vy=rnd()*6-3
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="space"then
|
||||
if state==0 then
|
||||
start()
|
||||
end
|
||||
elseif key=="r"then
|
||||
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
|
||||
p1.y0=false
|
||||
elseif key=="up"or key=="down"then
|
||||
p2.y0=false
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="space"then
|
||||
if state==0 then
|
||||
start()
|
||||
end
|
||||
elseif key=="r"then
|
||||
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
|
||||
p1.y0=false
|
||||
elseif key=="up"or key=="down"then
|
||||
p2.y0=false
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
scene.touchMove(x,y)
|
||||
if state==0 then start()end
|
||||
scene.touchMove(x,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()
|
||||
--Update pads
|
||||
local P=p1
|
||||
while P do
|
||||
if P.y0 then
|
||||
if P.y>P.y0 then
|
||||
P.y=max(P.y-8,P.y0,70)
|
||||
P.vy=-10
|
||||
elseif P.y<P.y0 then
|
||||
P.y=min(P.y+8,P.y0,650)
|
||||
P.vy=10
|
||||
else
|
||||
P.vy=P.vy*.5
|
||||
end
|
||||
else
|
||||
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
|
||||
P.vy=-P.vy*.5
|
||||
P.y=650
|
||||
elseif P.y<70 then
|
||||
P.vy=-P.vy*.5
|
||||
P.y=70
|
||||
end
|
||||
end
|
||||
P=P==p1 and p2
|
||||
end
|
||||
--Update pads
|
||||
local P=p1
|
||||
while P do
|
||||
if P.y0 then
|
||||
if P.y>P.y0 then
|
||||
P.y=max(P.y-8,P.y0,70)
|
||||
P.vy=-10
|
||||
elseif P.y<P.y0 then
|
||||
P.y=min(P.y+8,P.y0,650)
|
||||
P.vy=10
|
||||
else
|
||||
P.vy=P.vy*.5
|
||||
end
|
||||
else
|
||||
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
|
||||
P.vy=-P.vy*.5
|
||||
P.y=650
|
||||
elseif P.y<70 then
|
||||
P.vy=-P.vy*.5
|
||||
P.y=70
|
||||
end
|
||||
end
|
||||
P=P==p1 and p2
|
||||
end
|
||||
|
||||
--Update ball
|
||||
bx,by=bx+vx,by+vy
|
||||
if ry~=0 then
|
||||
if ry>0 then
|
||||
ry=max(ry-.1,0)
|
||||
vy=vy-.1
|
||||
else
|
||||
ry=min(ry+.1,0)
|
||||
vy=vy+.1
|
||||
end
|
||||
end
|
||||
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
|
||||
state=2
|
||||
end
|
||||
end
|
||||
if by<30 or by>690 then
|
||||
by=by<30 and 30 or 690
|
||||
vy,ry=-vy,-ry
|
||||
SFX.play('collect')
|
||||
end
|
||||
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",bx>1400 and 470 or 810,226,50,'score')
|
||||
SFX.play('reach')
|
||||
--Update ball
|
||||
bx,by=bx+vx,by+vy
|
||||
if ry~=0 then
|
||||
if ry>0 then
|
||||
ry=max(ry-.1,0)
|
||||
vy=vy-.1
|
||||
else
|
||||
ry=min(ry+.1,0)
|
||||
vy=vy+.1
|
||||
end
|
||||
end
|
||||
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
|
||||
state=2
|
||||
end
|
||||
end
|
||||
if by<30 or by>690 then
|
||||
by=by<30 and 30 or 690
|
||||
vy,ry=-vy,-ry
|
||||
SFX.play('collect')
|
||||
end
|
||||
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",bx>1400 and 470 or 810,226,50,'score')
|
||||
SFX.play('reach')
|
||||
|
||||
state=0
|
||||
bx,by=640,360
|
||||
vx,vy=0,0
|
||||
end
|
||||
end
|
||||
bx,by,vx,vy,ry=bx,by,vx,vy,ry
|
||||
state=0
|
||||
bx,by=640,360
|
||||
vx,vy=0,0
|
||||
end
|
||||
end
|
||||
bx,by,vx,vy,ry=bx,by,vx,vy,ry
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Draw score
|
||||
setFont(100)
|
||||
gc.setColor(.4,.4,.4)
|
||||
mStr(p1.score,470,20)
|
||||
mStr(p2.score,810,20)
|
||||
--Draw score
|
||||
setFont(100)
|
||||
gc.setColor(.4,.4,.4)
|
||||
mStr(p1.score,470,20)
|
||||
mStr(p2.score,810,20)
|
||||
|
||||
--Draw boundary
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(4)
|
||||
gc.line(134,20,1146,20)
|
||||
gc.line(134,700,1146,700)
|
||||
--Draw boundary
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(4)
|
||||
gc.line(134,20,1146,20)
|
||||
gc.line(134,700,1146,700)
|
||||
|
||||
--Draw ball & speed line
|
||||
gc.setColor(1,1,1-abs(ry)*.16)
|
||||
gc.circle('fill',bx,by,10)
|
||||
gc.setColor(1,1,1,.1)
|
||||
gc.line(bx+vx*22,by+vy*22,bx+vx*30,by+vy*30)
|
||||
--Draw ball & speed line
|
||||
gc.setColor(1,1,1-abs(ry)*.16)
|
||||
gc.circle('fill',bx,by,10)
|
||||
gc.setColor(1,1,1,.1)
|
||||
gc.line(bx+vx*22,by+vy*22,bx+vx*30,by+vy*30)
|
||||
|
||||
--Draw pads
|
||||
gc.setColor(1,.8,.8)
|
||||
gc.rectangle('fill',134,p1.y-50,16,100)
|
||||
gc.setColor(.8,.8,1)
|
||||
gc.rectangle('fill',1130,p2.y-50,16,100)
|
||||
--Draw pads
|
||||
gc.setColor(1,.8,.8)
|
||||
gc.rectangle('fill',134,p1.y-50,16,100)
|
||||
gc.setColor(.8,.8,1)
|
||||
gc.rectangle('fill',1130,p2.y-50,16,100)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="reset",x=640,y=45,w=150,h=50,font=35,code=pressKey"r"},
|
||||
WIDGET.newKey{name="back",x=640,y=675,w=150,h=50,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="reset",x=640,y=45,w=150,h=50,font=35,code=pressKey"r"},
|
||||
WIDGET.newKey{name="back",x=640,y=675,w=150,h=50,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -9,128 +9,128 @@ local s1,s2
|
||||
local up,winner=true
|
||||
|
||||
local function reset()
|
||||
state=0
|
||||
ct=20
|
||||
s1,s2=0,0
|
||||
state=0
|
||||
ct=20
|
||||
s1,s2=0,0
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
reset()
|
||||
BG.set('none')
|
||||
reset()
|
||||
BG.set('none')
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if state==0 then
|
||||
if key=="space"then
|
||||
reset()
|
||||
state=1
|
||||
ct=60
|
||||
end
|
||||
elseif state==2 and #key==1 then
|
||||
key=("qapl"):find(key)
|
||||
if key then
|
||||
--BEAUTIFUL LOGIC BELOW:
|
||||
if isRep then return end
|
||||
if state==0 then
|
||||
if key=="space"then
|
||||
reset()
|
||||
state=1
|
||||
ct=60
|
||||
end
|
||||
elseif state==2 and #key==1 then
|
||||
key=("qapl"):find(key)
|
||||
if key then
|
||||
--BEAUTIFUL LOGIC BELOW:
|
||||
|
||||
--early = error, [UP-key]==[target is up] = correct sfx, else = wrong sfx
|
||||
SFX.play(ct>6 and'finesseError'or key%2==1==up and'reach'or'fail')
|
||||
--early = error, [UP-key]==[target is up] = correct sfx, else = wrong sfx
|
||||
SFX.play(ct>6 and'finesseError'or key%2==1==up and'reach'or'fail')
|
||||
|
||||
--(early && P2-key || not early && [P1-key]==[target is up]) = P1 win, else P2 win
|
||||
if ct>6 and key>2 or ct<=6 and key%4<2==up then
|
||||
winner=1;s1=s1+1
|
||||
else
|
||||
winner=2;s2=s2+1
|
||||
end
|
||||
state=3
|
||||
ct=60
|
||||
end
|
||||
end
|
||||
--(early && P2-key || not early && [P1-key]==[target is up]) = P1 win, else P2 win
|
||||
if ct>6 and key>2 or ct<=6 and key%4<2==up then
|
||||
winner=1;s1=s1+1
|
||||
else
|
||||
winner=2;s2=s2+1
|
||||
end
|
||||
state=3
|
||||
ct=60
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
scene.keyDown(
|
||||
state==0 and "space"or
|
||||
x<640 and
|
||||
(y<360 and"q"or"a")or
|
||||
(y<360 and"p"or"l")
|
||||
)
|
||||
scene.keyDown(
|
||||
state==0 and "space"or
|
||||
x<640 and
|
||||
(y<360 and"q"or"a")or
|
||||
(y<360 and"p"or"l")
|
||||
)
|
||||
end
|
||||
function scene.update()
|
||||
if state==0 then--Menu
|
||||
if ct>0 then
|
||||
ct=ct-1
|
||||
elseif rnd()<.00626 then
|
||||
ct=30
|
||||
end
|
||||
elseif state==1 then--Waiting
|
||||
ct=ct-1
|
||||
if ct==0 then
|
||||
ct=rnd(26,162)
|
||||
up=rnd()<.5
|
||||
state=2
|
||||
end
|
||||
elseif state==2 then--Winking
|
||||
ct=ct-1
|
||||
if ct==0 then ct=6 end
|
||||
elseif state==3 then
|
||||
ct=ct-1
|
||||
if ct==0 then
|
||||
if s1==6 or s2==6 then
|
||||
state=0
|
||||
else
|
||||
state=1
|
||||
end
|
||||
ct=60
|
||||
end
|
||||
end
|
||||
if state==0 then--Menu
|
||||
if ct>0 then
|
||||
ct=ct-1
|
||||
elseif rnd()<.00626 then
|
||||
ct=30
|
||||
end
|
||||
elseif state==1 then--Waiting
|
||||
ct=ct-1
|
||||
if ct==0 then
|
||||
ct=rnd(26,162)
|
||||
up=rnd()<.5
|
||||
state=2
|
||||
end
|
||||
elseif state==2 then--Winking
|
||||
ct=ct-1
|
||||
if ct==0 then ct=6 end
|
||||
elseif state==3 then
|
||||
ct=ct-1
|
||||
if ct==0 then
|
||||
if s1==6 or s2==6 then
|
||||
state=0
|
||||
else
|
||||
state=1
|
||||
end
|
||||
ct=60
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.draw()
|
||||
--Dividing line
|
||||
gc.setLineWidth(10)
|
||||
gc.setColor(1,1,1,.9)
|
||||
gc.line(640,0,640,720)
|
||||
gc.setColor(1,1,1,.3)
|
||||
gc.line(500,360,780,360)
|
||||
--Dividing line
|
||||
gc.setLineWidth(10)
|
||||
gc.setColor(1,1,1,.9)
|
||||
gc.line(640,0,640,720)
|
||||
gc.setColor(1,1,1,.3)
|
||||
gc.line(500,360,780,360)
|
||||
|
||||
--Help
|
||||
setFont(100)
|
||||
mStr("Q",80,100)
|
||||
mStr("A",80,480)
|
||||
mStr("P",1200,100)
|
||||
mStr("L",1200,480)
|
||||
--Help
|
||||
setFont(100)
|
||||
mStr("Q",80,100)
|
||||
mStr("A",80,480)
|
||||
mStr("P",1200,100)
|
||||
mStr("L",1200,480)
|
||||
|
||||
--Score
|
||||
setFont(80)
|
||||
gc.printf(s1,50,300,200)
|
||||
gc.printf(s2,1030,300,200,'right')
|
||||
--Score
|
||||
setFont(80)
|
||||
gc.printf(s1,50,300,200)
|
||||
gc.printf(s2,1030,300,200,'right')
|
||||
|
||||
if state==0 then
|
||||
setFont(40)
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",640,400)
|
||||
mStr("Press key on the same side when block appear!",640,500)
|
||||
if ct>0 then
|
||||
setFont(100)
|
||||
gc.setColor(1,1,1,ct/30)
|
||||
mStr("REFLECT",640,140)
|
||||
end
|
||||
elseif state==1 then
|
||||
gc.setColor(.2,.7,.4,math.min((60-ct)/10,ct/10)*.8)
|
||||
gc.arc('fill',640,360,260,-1.5708,-1.5708+(ct/60)*6.2832)
|
||||
elseif state==2 and ct<5 then
|
||||
gc.setColor(1,ct>2 and 1 or 0,0)
|
||||
gc.rectangle('fill',640-100,(up and 180 or 540)-100,200,200,10)
|
||||
elseif state==3 then
|
||||
local x=(60-ct)*62
|
||||
gc.setColor(.4,1,.4,ct/100)
|
||||
if winner==1 then
|
||||
gc.rectangle('fill',0,0,x,720)
|
||||
else
|
||||
gc.rectangle('fill',1280,0,-x,720)
|
||||
end
|
||||
end
|
||||
if state==0 then
|
||||
setFont(40)
|
||||
mStr(MOBILE and"Touch to Start"or"Press space to Start",640,400)
|
||||
mStr("Press key on the same side when block appear!",640,500)
|
||||
if ct>0 then
|
||||
setFont(100)
|
||||
gc.setColor(1,1,1,ct/30)
|
||||
mStr("REFLECT",640,140)
|
||||
end
|
||||
elseif state==1 then
|
||||
gc.setColor(.2,.7,.4,math.min((60-ct)/10,ct/10)*.8)
|
||||
gc.arc('fill',640,360,260,-1.5708,-1.5708+(ct/60)*6.2832)
|
||||
elseif state==2 and ct<5 then
|
||||
gc.setColor(1,ct>2 and 1 or 0,0)
|
||||
gc.rectangle('fill',640-100,(up and 180 or 540)-100,200,200,10)
|
||||
elseif state==3 then
|
||||
local x=(60-ct)*62
|
||||
gc.setColor(.4,1,.4,ct/100)
|
||||
if winner==1 then
|
||||
gc.rectangle('fill',0,0,x,720)
|
||||
else
|
||||
gc.rectangle('fill',1280,0,-x,720)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="back",x=640,y=675,w=150,h=50,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="back",x=640,y=675,w=150,h=50,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -15,166 +15,166 @@ local state,progress
|
||||
local tapFX,mistake
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('space')
|
||||
BGM.play('way')
|
||||
board={}
|
||||
rank=3
|
||||
blind=false
|
||||
disappear=false
|
||||
tapFX=true
|
||||
BG.set('space')
|
||||
BGM.play('way')
|
||||
board={}
|
||||
rank=3
|
||||
blind=false
|
||||
disappear=false
|
||||
tapFX=true
|
||||
|
||||
startTime=0
|
||||
time=0
|
||||
mistake=0
|
||||
state=0
|
||||
progress=0
|
||||
startTime=0
|
||||
time=0
|
||||
mistake=0
|
||||
state=0
|
||||
progress=0
|
||||
end
|
||||
|
||||
local function newBoard()
|
||||
local L={}
|
||||
for i=1,rank^2 do
|
||||
L[i]=i
|
||||
end
|
||||
for i=1,rank^2 do
|
||||
board[i]=rem(L,rnd(#L))
|
||||
end
|
||||
local L={}
|
||||
for i=1,rank^2 do
|
||||
L[i]=i
|
||||
end
|
||||
for i=1,rank^2 do
|
||||
board[i]=rem(L,rnd(#L))
|
||||
end
|
||||
end
|
||||
local function tapBoard(x,y)
|
||||
local R=rank
|
||||
if x>320 and x<960 and y>40 and y<680 then
|
||||
if state==0 then
|
||||
newBoard()
|
||||
state=1
|
||||
startTime=TIME()
|
||||
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 board[x]==progress+1 then
|
||||
progress=progress+1
|
||||
if progress<R^2 then
|
||||
SFX.play('lock')
|
||||
else
|
||||
time=TIME()-startTime+mistake
|
||||
state=2
|
||||
SFX.play('reach')
|
||||
end
|
||||
if tapFX then
|
||||
SYSFX.newShade(3,320+640/R*X,40+640/R*Y,640/R,640/R,.6,.8,1)
|
||||
end
|
||||
else
|
||||
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')
|
||||
end
|
||||
end
|
||||
end
|
||||
local R=rank
|
||||
if x>320 and x<960 and y>40 and y<680 then
|
||||
if state==0 then
|
||||
newBoard()
|
||||
state=1
|
||||
startTime=TIME()
|
||||
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 board[x]==progress+1 then
|
||||
progress=progress+1
|
||||
if progress<R^2 then
|
||||
SFX.play('lock')
|
||||
else
|
||||
time=TIME()-startTime+mistake
|
||||
state=2
|
||||
SFX.play('reach')
|
||||
end
|
||||
if tapFX then
|
||||
SYSFX.newShade(3,320+640/R*X,40+640/R*Y,640/R,640/R,.6,.8,1)
|
||||
end
|
||||
else
|
||||
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')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.mouseDown(x,y)
|
||||
tapBoard(x,y)
|
||||
tapBoard(x,y)
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
tapBoard(x,y)
|
||||
tapBoard(x,y)
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="z"or key=="x"then
|
||||
love.mousepressed(ms.getPosition())
|
||||
elseif key=="space"then
|
||||
if state>0 then
|
||||
board={}
|
||||
time=0
|
||||
mistake=0
|
||||
state=0
|
||||
progress=0
|
||||
end
|
||||
elseif key=="q"then
|
||||
if state==0 then
|
||||
blind=not blind
|
||||
end
|
||||
elseif key=="w"then
|
||||
if state==0 then
|
||||
disappear=not disappear
|
||||
end
|
||||
elseif key=="e"then
|
||||
if state==0 then
|
||||
tapFX=not tapFX
|
||||
end
|
||||
elseif key=="3"or key=="4"or key=="5"or key=="6"then
|
||||
if state==0 then
|
||||
rank=tonumber(key)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="z"or key=="x"then
|
||||
love.mousepressed(ms.getPosition())
|
||||
elseif key=="space"then
|
||||
if state>0 then
|
||||
board={}
|
||||
time=0
|
||||
mistake=0
|
||||
state=0
|
||||
progress=0
|
||||
end
|
||||
elseif key=="q"then
|
||||
if state==0 then
|
||||
blind=not blind
|
||||
end
|
||||
elseif key=="w"then
|
||||
if state==0 then
|
||||
disappear=not disappear
|
||||
end
|
||||
elseif key=="e"then
|
||||
if state==0 then
|
||||
tapFX=not tapFX
|
||||
end
|
||||
elseif key=="3"or key=="4"or key=="5"or key=="6"then
|
||||
if state==0 then
|
||||
rank=tonumber(key)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state==1 then
|
||||
time=TIME()-startTime+mistake
|
||||
end
|
||||
if state==1 then
|
||||
time=TIME()-startTime+mistake
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(("%.3f"):format(time),1026,80)
|
||||
gc.print(mistake,1026,150)
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(("%.3f"):format(time),1026,80)
|
||||
gc.print(mistake,1026,150)
|
||||
|
||||
setFont(70)
|
||||
mStr(state==1 and progress or state==0 and"Ready"or state==2 and"Win",1130,300)
|
||||
setFont(70)
|
||||
mStr(state==1 and progress or state==0 and"Ready"or state==2 and"Win",1130,300)
|
||||
|
||||
if state==2 then
|
||||
--Draw no-setting area
|
||||
gc.setColor(1,0,0,.3)
|
||||
gc.rectangle('fill',15,295,285,250)
|
||||
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 state==1 then
|
||||
gc.setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
gc.setColor(.2,.8,.2)--ready
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
gc.rectangle('line',310,30,660,660)
|
||||
gc.setColor(.9,.9,0)--win
|
||||
elseif state==1 then
|
||||
gc.setColor(.9,.9,.9)--game
|
||||
elseif state==0 then
|
||||
gc.setColor(.2,.8,.2)--ready
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
gc.rectangle('line',310,30,660,660)
|
||||
|
||||
local width=640/rank
|
||||
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=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(COLOR.Z)
|
||||
gc.rectangle('line',320+(j-1)*width,(i-1)*width+40,width,width)
|
||||
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)
|
||||
mStr(N,x-1,y-3)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(N,x,y)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local width=640/rank
|
||||
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=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(COLOR.Z)
|
||||
gc.rectangle('line',320+(j-1)*width,(i-1)*width+40,width,width)
|
||||
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)
|
||||
mStr(N,x-1,y-3)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(N,x,y)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color='lG',font=40,code=pressKey"space",hideF=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,hideF=function()return state>0 end},
|
||||
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=function()return blind end, code=pressKey"q",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="disappear", x=240,y=420,w=60, font=40,disp=function()return disappear end,code=pressKey"w",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="tapFX", x=240,y=510,w=60, font=40,disp=function()return tapFX end, code=pressKey"e",hideF=function()return state==1 end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color='lG',font=40,code=pressKey"space",hideF=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,hideF=function()return state>0 end},
|
||||
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=function()return blind end, code=pressKey"q",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="disappear",x=240,y=420,w=60, font=40,disp=function()return disappear end,code=pressKey"w",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="tapFX", x=240,y=510,w=60, font=40,disp=function()return tapFX end, code=pressKey"e",hideF=function()return state==1 end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -9,68 +9,68 @@ local lastKey,keyTime
|
||||
local speed,maxSpeed=0,260
|
||||
|
||||
function scene.sceneInit()
|
||||
lastKey=nil
|
||||
speed=0
|
||||
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
||||
BG.set('gray')
|
||||
BGM.play('push')
|
||||
lastKey=nil
|
||||
speed=0
|
||||
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
||||
BG.set('gray')
|
||||
BGM.play('push')
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
if lastKey~=key then
|
||||
lastKey=key
|
||||
else
|
||||
ins(keyTime,1,TIME())
|
||||
keyTime[41]=nil
|
||||
SFX.play('click',.3)
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
if lastKey~=key then
|
||||
lastKey=key
|
||||
else
|
||||
ins(keyTime,1,TIME())
|
||||
keyTime[41]=nil
|
||||
SFX.play('click',.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
local t=TIME()
|
||||
local v=0
|
||||
for i=2,40 do v=v+i*(i-1)*.075/(t-keyTime[i])end
|
||||
speed=speed*.99+v*.01
|
||||
if speed>maxSpeed then maxSpeed=speed end
|
||||
local t=TIME()
|
||||
local v=0
|
||||
for i=2,40 do v=v+i*(i-1)*.075/(t-keyTime[i])end
|
||||
speed=speed*.99+v*.01
|
||||
if speed>maxSpeed then maxSpeed=speed end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(70)gc.setColor(1,.6,.6)
|
||||
mStr(("%.2f"):format(maxSpeed),640,20)
|
||||
setFont(70)gc.setColor(1,.6,.6)
|
||||
mStr(("%.2f"):format(maxSpeed),640,20)
|
||||
|
||||
setFont(100)gc.setColor(COLOR.Z)
|
||||
mStr(("%.2f"):format(speed),640,150)
|
||||
setFont(100)gc.setColor(COLOR.Z)
|
||||
mStr(("%.2f"):format(speed),640,150)
|
||||
|
||||
setFont(35)
|
||||
gc.setColor(.6,.6,.9)
|
||||
mStr(("%.2f"):format(maxSpeed/60),640,95)
|
||||
gc.setColor(.8,.8,.8)
|
||||
mStr(("%.2f"):format(speed/60),640,255)
|
||||
setFont(35)
|
||||
gc.setColor(.6,.6,.9)
|
||||
mStr(("%.2f"):format(maxSpeed/60),640,95)
|
||||
gc.setColor(.8,.8,.8)
|
||||
mStr(("%.2f"):format(speed/60),640,255)
|
||||
|
||||
setFont(60)gc.setColor(.7,.7,.7)
|
||||
mStr("/min",640,310)
|
||||
setFont(60)gc.setColor(.7,.7,.7)
|
||||
mStr("/min",640,310)
|
||||
|
||||
|
||||
gc.setLineWidth(4)
|
||||
if speed==maxSpeed then
|
||||
local t=TIME()%.1>.05 and 1 or 0
|
||||
gc.setColor(1,t,t)
|
||||
else
|
||||
gc.setColor(max(speed/maxSpeed*10-9,0),1-max(speed/maxSpeed*8-7,0),1-max(speed/maxSpeed*4-3,0))
|
||||
end
|
||||
gc.rectangle('fill',960,360,30,-320*max(speed/maxSpeed*4-3,0))
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',960,360,30,-320)
|
||||
gc.setLineWidth(4)
|
||||
if speed==maxSpeed then
|
||||
local t=TIME()%.1>.05 and 1 or 0
|
||||
gc.setColor(1,t,t)
|
||||
else
|
||||
gc.setColor(max(speed/maxSpeed*10-9,0),1-max(speed/maxSpeed*8-7,0),1-max(speed/maxSpeed*4-3,0))
|
||||
end
|
||||
gc.rectangle('fill',960,360,30,-320*max(speed/maxSpeed*4-3,0))
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',960,360,30,-320)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="tap",x=640,y=540,w=626,h=260,fText="TAP",color='Z',font=100,code=function(i)love.keypressed('b'..i)end},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="tap",x=640,y=540,w=626,h=260,fText="TAP",color='Z',font=100,code=function(i)love.keypressed('b'..i)end},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -10,18 +10,18 @@ local scene={}
|
||||
|
||||
local previewX={245,186,129,78,35}
|
||||
local tileColor={
|
||||
{.39, 1.0, .39},
|
||||
{.39, .39, 1.0},
|
||||
{1.0, .70, .31},
|
||||
{.94, .31, .31},
|
||||
{.00, .71, .12},
|
||||
{.90, .20, .90},
|
||||
{.94, .47, .39},
|
||||
{.90, .00, .00},
|
||||
{.86, .86, .31},
|
||||
{.78, .31, .00},
|
||||
{.78, .55, .04},
|
||||
{.12, .12, .51},
|
||||
{.39, 1.0, .39},
|
||||
{.39, .39, 1.0},
|
||||
{1.0, .70, .31},
|
||||
{.94, .31, .31},
|
||||
{.00, .71, .12},
|
||||
{.90, .20, .90},
|
||||
{.94, .47, .39},
|
||||
{.90, .00, .00},
|
||||
{.86, .86, .31},
|
||||
{.78, .31, .00},
|
||||
{.78, .55, .04},
|
||||
{.12, .12, .51},
|
||||
}
|
||||
|
||||
local board,preview,cx,cy
|
||||
@@ -37,273 +37,273 @@ local blind
|
||||
local fast
|
||||
|
||||
local function reset()
|
||||
progress={}
|
||||
state=0
|
||||
score=0
|
||||
time=0
|
||||
maxTile=2
|
||||
maxNew=2
|
||||
for i=1,5 do
|
||||
preview[i]=rnd(2)
|
||||
end
|
||||
for i=1,5 do for j=1,5 do
|
||||
board[i][j]=rnd(2)
|
||||
end end
|
||||
board[rnd(5)][rnd(5)]=2
|
||||
fallingTimer=false
|
||||
failPos=false
|
||||
progress={}
|
||||
state=0
|
||||
score=0
|
||||
time=0
|
||||
maxTile=2
|
||||
maxNew=2
|
||||
for i=1,5 do
|
||||
preview[i]=rnd(2)
|
||||
end
|
||||
for i=1,5 do for j=1,5 do
|
||||
board[i][j]=rnd(2)
|
||||
end end
|
||||
board[rnd(5)][rnd(5)]=2
|
||||
fallingTimer=false
|
||||
failPos=false
|
||||
end
|
||||
function scene.sceneInit()
|
||||
BG.set('rainbow2')
|
||||
BGM.play('truth')
|
||||
preview={}
|
||||
board={{},{},{},{},{}}
|
||||
cx,cy=3,3
|
||||
startTime=0
|
||||
blind=false
|
||||
nexts=true
|
||||
reset()
|
||||
BG.set('rainbow2')
|
||||
BGM.play('truth')
|
||||
preview={}
|
||||
board={{},{},{},{},{}}
|
||||
cx,cy=3,3
|
||||
startTime=0
|
||||
blind=false
|
||||
nexts=true
|
||||
reset()
|
||||
end
|
||||
|
||||
local function merge()
|
||||
if fallingTimer or state==2 or not cx then return end
|
||||
if state==0 then
|
||||
state=1
|
||||
startTime=TIME()
|
||||
end
|
||||
if failPos==cy*10+cx then return end
|
||||
local chosen=board[cy][cx]
|
||||
local connected={{cy,cx}}
|
||||
local count=1
|
||||
repeat
|
||||
local c=rem(connected)
|
||||
local y,x=c[1],c[2]
|
||||
if board[y][x]~=0 then
|
||||
board[y][x]=0
|
||||
SYSFX.newShade(2,320+x*128-128,40+y*128-128,128,128)
|
||||
if x>1 and board[y][x-1]==chosen then ins(connected,{y,x-1})count=count+1 end
|
||||
if x<5 and board[y][x+1]==chosen then ins(connected,{y,x+1})count=count+1 end
|
||||
if y>1 and board[y-1][x]==chosen then ins(connected,{y-1,x})count=count+1 end
|
||||
if y<5 and board[y+1][x]==chosen then ins(connected,{y+1,x})count=count+1 end
|
||||
end
|
||||
until not connected[1]
|
||||
if count>1 then
|
||||
board[cy][cx]=chosen+1
|
||||
local getScore=3^(chosen-1)*math.min(int(.5+count/2),4)
|
||||
score=score+getScore
|
||||
TEXT.show(getScore,cx*128+256,cy*128-40,40,'score')
|
||||
SYSFX.newRectRipple(2,320+cx*128-128,40+cy*128-128,128,128)
|
||||
SFX.play('lock')
|
||||
if chosen==maxTile then
|
||||
maxTile=chosen+1
|
||||
if maxTile>=6 then
|
||||
ins(progress,("%s - %.3fs"):format(maxTile,TIME()-startTime))
|
||||
end
|
||||
maxNew=
|
||||
maxTile<=4 and 2 or
|
||||
maxTile<=8 and 3 or
|
||||
maxTile<=11 and 4 or
|
||||
5
|
||||
SFX.play('reach')
|
||||
end
|
||||
if chosen>=5 then
|
||||
SFX.play(
|
||||
chosen>=9 and"ren_mega"or
|
||||
chosen>=8 and"spin_3"or
|
||||
chosen>=7 and"spin_2"or
|
||||
chosen>=6 and"spin_1"or
|
||||
"spin_0"
|
||||
)
|
||||
end
|
||||
fallingTimer=fast and 8 or 12
|
||||
failPos=false
|
||||
else
|
||||
board[cy][cx]=chosen
|
||||
failPos=cy*10+cx
|
||||
end
|
||||
if fallingTimer or state==2 or not cx then return end
|
||||
if state==0 then
|
||||
state=1
|
||||
startTime=TIME()
|
||||
end
|
||||
if failPos==cy*10+cx then return end
|
||||
local chosen=board[cy][cx]
|
||||
local connected={{cy,cx}}
|
||||
local count=1
|
||||
repeat
|
||||
local c=rem(connected)
|
||||
local y,x=c[1],c[2]
|
||||
if board[y][x]~=0 then
|
||||
board[y][x]=0
|
||||
SYSFX.newShade(2,320+x*128-128,40+y*128-128,128,128)
|
||||
if x>1 and board[y][x-1]==chosen then ins(connected,{y,x-1})count=count+1 end
|
||||
if x<5 and board[y][x+1]==chosen then ins(connected,{y,x+1})count=count+1 end
|
||||
if y>1 and board[y-1][x]==chosen then ins(connected,{y-1,x})count=count+1 end
|
||||
if y<5 and board[y+1][x]==chosen then ins(connected,{y+1,x})count=count+1 end
|
||||
end
|
||||
until not connected[1]
|
||||
if count>1 then
|
||||
board[cy][cx]=chosen+1
|
||||
local getScore=3^(chosen-1)*math.min(int(.5+count/2),4)
|
||||
score=score+getScore
|
||||
TEXT.show(getScore,cx*128+256,cy*128-40,40,'score')
|
||||
SYSFX.newRectRipple(2,320+cx*128-128,40+cy*128-128,128,128)
|
||||
SFX.play('lock')
|
||||
if chosen==maxTile then
|
||||
maxTile=chosen+1
|
||||
if maxTile>=6 then
|
||||
ins(progress,("%s - %.3fs"):format(maxTile,TIME()-startTime))
|
||||
end
|
||||
maxNew=
|
||||
maxTile<=4 and 2 or
|
||||
maxTile<=8 and 3 or
|
||||
maxTile<=11 and 4 or
|
||||
5
|
||||
SFX.play('reach')
|
||||
end
|
||||
if chosen>=5 then
|
||||
SFX.play(
|
||||
chosen>=9 and"ren_mega"or
|
||||
chosen>=8 and"spin_3"or
|
||||
chosen>=7 and"spin_2"or
|
||||
chosen>=6 and"spin_1"or
|
||||
"spin_0"
|
||||
)
|
||||
end
|
||||
fallingTimer=fast and 8 or 12
|
||||
failPos=false
|
||||
else
|
||||
board[cy][cx]=chosen
|
||||
failPos=cy*10+cx
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if state==2 then return end
|
||||
if not cx then
|
||||
cx,cy=3,3
|
||||
else
|
||||
if key=="up"then
|
||||
if cy>1 then cy=cy-1 end
|
||||
elseif key=="down"then
|
||||
if cy<5 then cy=cy+1 end
|
||||
elseif key=="left"then
|
||||
if cx>1 then cx=cx-1 end
|
||||
elseif key=="right"then
|
||||
if cx<5 then cx=cx+1 end
|
||||
end
|
||||
end
|
||||
elseif key=="z"or key=="space"then
|
||||
merge()
|
||||
elseif key=="r"then
|
||||
reset()
|
||||
elseif key=="q"then
|
||||
if state==0 then
|
||||
nexts=not nexts
|
||||
end
|
||||
elseif key=="w"then
|
||||
if state==0 then
|
||||
blind=not blind
|
||||
end
|
||||
elseif key=="e"then
|
||||
if state==0 then
|
||||
fast=not fast
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if state==2 then return end
|
||||
if not cx then
|
||||
cx,cy=3,3
|
||||
else
|
||||
if key=="up"then
|
||||
if cy>1 then cy=cy-1 end
|
||||
elseif key=="down"then
|
||||
if cy<5 then cy=cy+1 end
|
||||
elseif key=="left"then
|
||||
if cx>1 then cx=cx-1 end
|
||||
elseif key=="right"then
|
||||
if cx<5 then cx=cx+1 end
|
||||
end
|
||||
end
|
||||
elseif key=="z"or key=="space"then
|
||||
merge()
|
||||
elseif key=="r"then
|
||||
reset()
|
||||
elseif key=="q"then
|
||||
if state==0 then
|
||||
nexts=not nexts
|
||||
end
|
||||
elseif key=="w"then
|
||||
if state==0 then
|
||||
blind=not blind
|
||||
end
|
||||
elseif key=="e"then
|
||||
if state==0 then
|
||||
fast=not fast
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
function scene.mouseMove(x,y)
|
||||
cx,cy=int((x-192)/128),int((y+88)/128)
|
||||
if cx<1 or cx>5 or cy<1 or cy>5 then cx,cy=false end
|
||||
cx,cy=int((x-192)/128),int((y+88)/128)
|
||||
if cx<1 or cx>5 or cy<1 or cy>5 then cx,cy=false end
|
||||
end
|
||||
function scene.mouseDown(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
merge()
|
||||
scene.mouseMove(x,y)
|
||||
merge()
|
||||
end
|
||||
|
||||
scene.touchMove=scene.mouseMove
|
||||
scene.touchDown=scene.mouseMove
|
||||
function scene.touchClick(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
if fallingTimer then
|
||||
fallingTimer=fallingTimer-1
|
||||
if fallingTimer==0 then
|
||||
for i=5,2,-1 do
|
||||
for j=1,5 do
|
||||
if board[i][j]==0 then
|
||||
board[i][j]=board[i-1][j]
|
||||
board[i-1][j]=0
|
||||
end
|
||||
end
|
||||
end
|
||||
local noNewTile=true
|
||||
for i=1,5 do
|
||||
if board[1][i]==0 then
|
||||
board[1][i]=rem(preview,1)
|
||||
preview[5]=
|
||||
maxTile<=4 and rnd(2)or
|
||||
maxTile<=8 and rnd(1+rnd(2))or
|
||||
maxTile<=11 and rnd(2+rnd(2))or
|
||||
rnd(2+rnd(3))
|
||||
noNewTile=false
|
||||
end
|
||||
end
|
||||
if noNewTile then
|
||||
fallingTimer=false
|
||||
for i=1,4 do for j=1,5 do if board[i][j]==board[i+1][j]then return end end end
|
||||
for i=1,5 do for j=1,4 do if board[i][j]==board[i][j+1]then return end end end
|
||||
state=2
|
||||
SFX.play('fail')
|
||||
else
|
||||
fallingTimer=fast and 4 or 5
|
||||
SFX.play('move')
|
||||
end
|
||||
end
|
||||
elseif fast and(
|
||||
msIsDown(1)or
|
||||
#tcTouches()>0 or
|
||||
kbIsDown("space")
|
||||
)then
|
||||
merge()
|
||||
end
|
||||
end
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
if fallingTimer then
|
||||
fallingTimer=fallingTimer-1
|
||||
if fallingTimer==0 then
|
||||
for i=5,2,-1 do
|
||||
for j=1,5 do
|
||||
if board[i][j]==0 then
|
||||
board[i][j]=board[i-1][j]
|
||||
board[i-1][j]=0
|
||||
end
|
||||
end
|
||||
end
|
||||
local noNewTile=true
|
||||
for i=1,5 do
|
||||
if board[1][i]==0 then
|
||||
board[1][i]=rem(preview,1)
|
||||
preview[5]=
|
||||
maxTile<=4 and rnd(2)or
|
||||
maxTile<=8 and rnd(1+rnd(2))or
|
||||
maxTile<=11 and rnd(2+rnd(2))or
|
||||
rnd(2+rnd(3))
|
||||
noNewTile=false
|
||||
end
|
||||
end
|
||||
if noNewTile then
|
||||
fallingTimer=false
|
||||
for i=1,4 do for j=1,5 do if board[i][j]==board[i+1][j]then return end end end
|
||||
for i=1,5 do for j=1,4 do if board[i][j]==board[i][j+1]then return end end end
|
||||
state=2
|
||||
SFX.play('fail')
|
||||
else
|
||||
fallingTimer=fast and 4 or 5
|
||||
SFX.play('move')
|
||||
end
|
||||
end
|
||||
elseif fast and(
|
||||
msIsDown(1)or
|
||||
#tcTouches()>0 or
|
||||
kbIsDown("space")
|
||||
)then
|
||||
merge()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(40)
|
||||
setColor(1,1,1)
|
||||
gc.print(("%.3f"):format(time),1026,50)
|
||||
gc.print(score,1026,100)
|
||||
setFont(40)
|
||||
setColor(1,1,1)
|
||||
gc.print(("%.3f"):format(time),1026,50)
|
||||
gc.print(score,1026,100)
|
||||
|
||||
--Progress time list
|
||||
setFont(25)
|
||||
setColor(.7,.7,.7)
|
||||
for i=1,#progress do
|
||||
gc.print(progress[i],1000,140+30*i)
|
||||
end
|
||||
--Progress time list
|
||||
setFont(25)
|
||||
setColor(.7,.7,.7)
|
||||
for i=1,#progress do
|
||||
gc.print(progress[i],1000,140+30*i)
|
||||
end
|
||||
|
||||
--Previews
|
||||
if nexts then
|
||||
gc.setColor(0,0,0,.2)
|
||||
rectangle('fill',20,450,280,75)
|
||||
gc.setLineWidth(6)
|
||||
setColor(1,1,1)
|
||||
rectangle('line',20,450,280,75)
|
||||
for i=1,5 do
|
||||
setFont(85-10*i)
|
||||
gc.setColor(tileColor[preview[i]])
|
||||
gc.print(preview[i],previewX[i],428+i*7)
|
||||
end
|
||||
end
|
||||
--Previews
|
||||
if nexts then
|
||||
gc.setColor(0,0,0,.2)
|
||||
rectangle('fill',20,450,280,75)
|
||||
gc.setLineWidth(6)
|
||||
setColor(1,1,1)
|
||||
rectangle('line',20,450,280,75)
|
||||
for i=1,5 do
|
||||
setFont(85-10*i)
|
||||
gc.setColor(tileColor[preview[i]])
|
||||
gc.print(preview[i],previewX[i],428+i*7)
|
||||
end
|
||||
end
|
||||
|
||||
if state==2 then
|
||||
--Draw no-setting area
|
||||
setColor(1,0,0,.3)
|
||||
rectangle('fill',15,200,285,210)
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
setColor(COLOR[
|
||||
state==0 and'G'or
|
||||
state==1 and(fast and'R'or'W')or
|
||||
state==2 and'Y'
|
||||
])
|
||||
rectangle('line',315,35,650,650)
|
||||
if state==2 then
|
||||
--Draw no-setting area
|
||||
setColor(1,0,0,.3)
|
||||
rectangle('fill',15,200,285,210)
|
||||
end
|
||||
gc.setLineWidth(10)
|
||||
setColor(COLOR[
|
||||
state==0 and'G'or
|
||||
state==1 and(fast and'R'or'W')or
|
||||
state==2 and'Y'
|
||||
])
|
||||
rectangle('line',315,35,650,650)
|
||||
|
||||
gc.setLineWidth(4)
|
||||
setFont(70)
|
||||
local hide=blind and state==1
|
||||
for i=1,5 do
|
||||
for j=1,5 do
|
||||
local N=board[i][j]
|
||||
if N>0 then
|
||||
if hide and N>maxNew then
|
||||
setColor(COLOR.dH)
|
||||
rectangle('fill',320+j*128-128,40+i*128-128,128,128)
|
||||
setColor(1,1,1,.3)
|
||||
mStr("?",j*128+256,i*128-75)
|
||||
else
|
||||
if N<=12 then
|
||||
setColor(tileColor[N])
|
||||
elseif N<=14 then
|
||||
setColor(COLOR.rainbow(4*TIME()-i-j))
|
||||
else
|
||||
setColor(0,0,0,1-math.abs(TIME()%.5-.25)*6-.25)
|
||||
end
|
||||
rectangle('fill',320+j*128-128,40+i*128-128,128,128)
|
||||
setColor(1,1,1,.9)
|
||||
mStr(N,j*128+256,i*128-75)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if state<2 and cx then
|
||||
setColor(1,1,1,.6)
|
||||
gc.setLineWidth(10)
|
||||
rectangle('line',325+cx*128-128,45+cy*128-128,118,118)
|
||||
end
|
||||
setFont(50)
|
||||
setColor(1,1,1)
|
||||
mStr("Just Get Ten",160,580)
|
||||
gc.setLineWidth(4)
|
||||
setFont(70)
|
||||
local hide=blind and state==1
|
||||
for i=1,5 do
|
||||
for j=1,5 do
|
||||
local N=board[i][j]
|
||||
if N>0 then
|
||||
if hide and N>maxNew then
|
||||
setColor(COLOR.dH)
|
||||
rectangle('fill',320+j*128-128,40+i*128-128,128,128)
|
||||
setColor(1,1,1,.3)
|
||||
mStr("?",j*128+256,i*128-75)
|
||||
else
|
||||
if N<=12 then
|
||||
setColor(tileColor[N])
|
||||
elseif N<=14 then
|
||||
setColor(COLOR.rainbow(4*TIME()-i-j))
|
||||
else
|
||||
setColor(0,0,0,1-math.abs(TIME()%.5-.25)*6-.25)
|
||||
end
|
||||
rectangle('fill',320+j*128-128,40+i*128-128,128,128)
|
||||
setColor(1,1,1,.9)
|
||||
mStr(N,j*128+256,i*128-75)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if state<2 and cx then
|
||||
setColor(1,1,1,.6)
|
||||
gc.setLineWidth(10)
|
||||
rectangle('line',325+cx*128-128,45+cy*128-128,118,118)
|
||||
end
|
||||
setFont(50)
|
||||
setColor(1,1,1)
|
||||
mStr("Just Get Ten",160,580)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
WIDGET.newSwitch{name="next", x=240,y=235,font=40,disp=function()return nexts end,code=pressKey"q",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="blind", x=240,y=305,font=40,disp=function()return blind end,code=pressKey"w",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="fast", x=240,y=375,font=30,disp=function()return fast end,code=pressKey"e",hideF=function()return state==1 end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="reset",x=160,y=100,w=180,h=100,color='lG',font=40,code=pressKey"r"},
|
||||
WIDGET.newSwitch{name="next", x=240,y=235,font=40,disp=function()return nexts end,code=pressKey"q",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="blind",x=240,y=305,font=40,disp=function()return blind end,code=pressKey"w",hideF=function()return state==1 end},
|
||||
WIDGET.newSwitch{name="fast", x=240,y=375,font=30,disp=function()return fast end,code=pressKey"e",hideF=function()return state==1 end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,26 +3,26 @@ local int=math.floor
|
||||
local CUSTOMENV=CUSTOMENV
|
||||
|
||||
local function _notAir(L)
|
||||
for i=1,10 do
|
||||
if L[i]>0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
for i=1,10 do
|
||||
if L[i]>0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
local sList={
|
||||
visible={"show","easy","slow","medium","fast","none"},
|
||||
freshLimit={0,1,2,4,6,8,10,12,15,30,1e99},
|
||||
opponent={"X","9S Lv.1","9S Lv.2","9S Lv.3","9S Lv.4","9S Lv.5","CC Lv.1","CC Lv.2","CC Lv.3","CC Lv.4","CC Lv.5"},
|
||||
life={0,1,2,3,5,10,15,26,42,87,500},
|
||||
pushSpeed={1,2,3,5,15},
|
||||
fieldH={1,2,3,4,6,8,10,15,20,30,50,100},
|
||||
heightLimit={2,3,4,6,8,10,15,20,30,40,70,100,150,200,1e99},
|
||||
bufferLimit={4,6,10,15,20,40,100,1e99},
|
||||
visible={"show","easy","slow","medium","fast","none"},
|
||||
freshLimit={0,1,2,4,6,8,10,12,15,30,1e99},
|
||||
opponent={"X","9S Lv.1","9S Lv.2","9S Lv.3","9S Lv.4","9S Lv.5","CC Lv.1","CC Lv.2","CC Lv.3","CC Lv.4","CC Lv.5"},
|
||||
life={0,1,2,3,5,10,15,26,42,87,500},
|
||||
pushSpeed={1,2,3,5,15},
|
||||
fieldH={1,2,3,4,6,8,10,15,20,30,50,100},
|
||||
heightLimit={2,3,4,6,8,10,15,20,30,40,70,100,150,200,1e99},
|
||||
bufferLimit={4,6,10,15,20,40,100,1e99},
|
||||
|
||||
drop={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
drop={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
}
|
||||
|
||||
local scene={}
|
||||
@@ -30,229 +30,229 @@ local scene={}
|
||||
local sure
|
||||
local initField
|
||||
local function _freshMiniFieldVisible()
|
||||
initField=false
|
||||
for y=1,20 do
|
||||
if _notAir(FIELD[1][y])then
|
||||
initField=true
|
||||
return
|
||||
end
|
||||
end
|
||||
initField=false
|
||||
for y=1,20 do
|
||||
if _notAir(FIELD[1][y])then
|
||||
initField=true
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.sceneInit()
|
||||
sure=0
|
||||
destroyPlayers()
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
_freshMiniFieldVisible()
|
||||
sure=0
|
||||
destroyPlayers()
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
_freshMiniFieldVisible()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
BGM.play()
|
||||
BGM.play()
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="return"or key=="return2"then
|
||||
if CUSTOMENV.opponent~="X"then
|
||||
if CUSTOMENV.opponent:sub(1,2)=='CC'and CUSTOMENV.sequence=="fixed"then
|
||||
MES.new('error',text.ai_fixed)
|
||||
return
|
||||
end
|
||||
if #BAG>0 then
|
||||
for _=1,#BAG do
|
||||
if BAG[_]>7 then
|
||||
MES.new('error',text.ai_prebag)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if #MISSION>0 then
|
||||
MES.new('error',text.ai_mission)
|
||||
return
|
||||
end
|
||||
end
|
||||
if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
|
||||
if initField then
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
loadGame('custom_puzzle',true)
|
||||
end
|
||||
else
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
loadGame('custom_clear',true)
|
||||
end
|
||||
elseif key=="f"then
|
||||
SCN.go('custom_field','swipeD')
|
||||
elseif key=="s"then
|
||||
SCN.go('custom_sequence','swipeD')
|
||||
elseif key=="m"then
|
||||
SCN.go('custom_mission','swipeD')
|
||||
elseif key=="delete"then
|
||||
if sure>.3 then
|
||||
TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
_freshMiniFieldVisible()
|
||||
TABLE.clear(CUSTOMENV)
|
||||
TABLE.complete(require"parts.customEnv0",CUSTOMENV)
|
||||
for _,W in next,scene.widgetList do W:reset()end
|
||||
FILE.save(DATA.copyMission(),'conf/customMissions')
|
||||
FILE.save(DATA.copyBoards(),'conf/customBoards')
|
||||
FILE.save(DATA.copySequence(),'conf/customSequence')
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
elseif key=="f1"then
|
||||
SCN.go('mod','swipeD')
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
local str="Techmino Quest:"..DATA.copyQuestArgs().."!"
|
||||
if #BAG>0 then str=str..DATA.copySequence()end
|
||||
str=str.."!"
|
||||
if #MISSION>0 then str=str..DATA.copyMission()end
|
||||
sys.setClipboardText(str.."!"..DATA.copyBoards().."!")
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local args=STRING.split(str:sub((str:find(":")or 0)+1),"!")
|
||||
if #args<4 then goto THROW_fail end
|
||||
if not(
|
||||
DATA.pasteQuestArgs(args[1])and
|
||||
DATA.pasteSequence(args[2])and
|
||||
DATA.pasteMission(args[3])
|
||||
)then goto THROW_fail end
|
||||
TABLE.cut(FIELD)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
for i=4,#args do
|
||||
if args[i]:find("%S")and not DATA.pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end
|
||||
end
|
||||
_freshMiniFieldVisible()
|
||||
MES.new('check',text.importSuccess)
|
||||
do return end
|
||||
::THROW_fail::MES.new('error',text.dataCorrupted)
|
||||
elseif key=="escape"then
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="return"or key=="return2"then
|
||||
if CUSTOMENV.opponent~="X"then
|
||||
if CUSTOMENV.opponent:sub(1,2)=='CC'and CUSTOMENV.sequence=="fixed"then
|
||||
MES.new('error',text.ai_fixed)
|
||||
return
|
||||
end
|
||||
if #BAG>0 then
|
||||
for _=1,#BAG do
|
||||
if BAG[_]>7 then
|
||||
MES.new('error',text.ai_prebag)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if #MISSION>0 then
|
||||
MES.new('error',text.ai_mission)
|
||||
return
|
||||
end
|
||||
end
|
||||
if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
|
||||
if initField then
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
loadGame('custom_puzzle',true)
|
||||
end
|
||||
else
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
loadGame('custom_clear',true)
|
||||
end
|
||||
elseif key=="f"then
|
||||
SCN.go('custom_field','swipeD')
|
||||
elseif key=="s"then
|
||||
SCN.go('custom_sequence','swipeD')
|
||||
elseif key=="m"then
|
||||
SCN.go('custom_mission','swipeD')
|
||||
elseif key=="delete"then
|
||||
if sure>.3 then
|
||||
TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
_freshMiniFieldVisible()
|
||||
TABLE.clear(CUSTOMENV)
|
||||
TABLE.complete(require"parts.customEnv0",CUSTOMENV)
|
||||
for _,W in next,scene.widgetList do W:reset()end
|
||||
FILE.save(DATA.copyMission(),'conf/customMissions')
|
||||
FILE.save(DATA.copyBoards(),'conf/customBoards')
|
||||
FILE.save(DATA.copySequence(),'conf/customSequence')
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
elseif key=="f1"then
|
||||
SCN.go('mod','swipeD')
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
local str="Techmino Quest:"..DATA.copyQuestArgs().."!"
|
||||
if #BAG>0 then str=str..DATA.copySequence()end
|
||||
str=str.."!"
|
||||
if #MISSION>0 then str=str..DATA.copyMission()end
|
||||
sys.setClipboardText(str.."!"..DATA.copyBoards().."!")
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local args=STRING.split(str:sub((str:find(":")or 0)+1),"!")
|
||||
if #args<4 then goto THROW_fail end
|
||||
if not(
|
||||
DATA.pasteQuestArgs(args[1])and
|
||||
DATA.pasteSequence(args[2])and
|
||||
DATA.pasteMission(args[3])
|
||||
)then goto THROW_fail end
|
||||
TABLE.cut(FIELD)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
for i=4,#args do
|
||||
if args[i]:find("%S")and not DATA.pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end
|
||||
end
|
||||
_freshMiniFieldVisible()
|
||||
MES.new('check',text.importSuccess)
|
||||
do return end
|
||||
::THROW_fail::MES.new('error',text.dataCorrupted)
|
||||
elseif key=="escape"then
|
||||
FILE.save(CUSTOMENV,'conf/customEnv')
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then sure=sure-dt end
|
||||
if sure>0 then sure=sure-dt end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.translate(0,-WIDGET.scrollPos)
|
||||
setFont(30)
|
||||
gc.translate(0,-WIDGET.scrollPos)
|
||||
setFont(30)
|
||||
|
||||
--Sequence
|
||||
if #MISSION>0 then
|
||||
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,int(TIME()*6.26)%2)
|
||||
gc.print("#"..#MISSION,70,220)
|
||||
end
|
||||
--Sequence
|
||||
if #MISSION>0 then
|
||||
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,int(TIME()*6.26)%2)
|
||||
gc.print("#"..#MISSION,70,220)
|
||||
end
|
||||
|
||||
--Field content
|
||||
if initField then
|
||||
gc.push('transform')
|
||||
gc.translate(330,240)
|
||||
gc.scale(.5)
|
||||
gc.setColor(1,1,1)
|
||||
gc.setLineWidth(3)
|
||||
gc.rectangle('line',-2,-2,304,604)
|
||||
local F=FIELD[1]
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
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 then
|
||||
gc.draw(cross,30*x-30,600-30*y)
|
||||
end
|
||||
end end
|
||||
gc.pop()
|
||||
if #FIELD>1 then
|
||||
gc.setColor(1,1,int(TIME()*6.26)%2)
|
||||
gc.print("+"..#FIELD-1,490,220)
|
||||
end
|
||||
end
|
||||
--Field content
|
||||
if initField then
|
||||
gc.push('transform')
|
||||
gc.translate(330,240)
|
||||
gc.scale(.5)
|
||||
gc.setColor(1,1,1)
|
||||
gc.setLineWidth(3)
|
||||
gc.rectangle('line',-2,-2,304,604)
|
||||
local F=FIELD[1]
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
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 then
|
||||
gc.draw(cross,30*x-30,600-30*y)
|
||||
end
|
||||
end end
|
||||
gc.pop()
|
||||
if #FIELD>1 then
|
||||
gc.setColor(1,1,int(TIME()*6.26)%2)
|
||||
gc.print("+"..#FIELD-1,490,220)
|
||||
end
|
||||
end
|
||||
|
||||
--Sequence
|
||||
if #BAG>0 then
|
||||
gc.setColor(1,1,int(TIME()*6.26)%2)
|
||||
gc.print("#"..#BAG,615,220)
|
||||
end
|
||||
--Sequence
|
||||
if #BAG>0 then
|
||||
gc.setColor(1,1,int(TIME()*6.26)%2)
|
||||
gc.print("#"..#BAG,615,220)
|
||||
end
|
||||
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(CUSTOMENV.sequence,610,250)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(CUSTOMENV.sequence,610,250)
|
||||
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
gc.draw(TEXTURE.sure,920,50)
|
||||
end
|
||||
gc.translate(0, WIDGET.scrollPos)
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
gc.draw(TEXTURE.sure,920,50)
|
||||
end
|
||||
gc.translate(0, WIDGET.scrollPos)
|
||||
end
|
||||
|
||||
scene.widgetScrollHeight=400
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=520, y=15,font=70,align='R'},
|
||||
WIDGET.newText{name="subTitle", x=530, y=60,font=35,align='L',color='H'},
|
||||
WIDGET.newText{name="title", x=520,y=15,font=70,align='R'},
|
||||
WIDGET.newText{name="subTitle",x=530,y=60,font=35,align='L',color='H'},
|
||||
|
||||
WIDGET.newKey{name="reset", x=1110, y=90,w=230,h=90,color='R',code=pressKey"delete"},
|
||||
WIDGET.newKey{name="mod", x=1110, y=200,w=230,h=90,color='Z',code=pressKey"f1"},
|
||||
WIDGET.newKey{name="reset", x=1110,y=90,w=230,h=90,color='R',code=pressKey"delete"},
|
||||
WIDGET.newKey{name="mod", x=1110,y=200,w=230,h=90,color='Z',code=pressKey"f1"},
|
||||
|
||||
--Mission / Field / Sequence
|
||||
WIDGET.newKey{name="mission", x=170, y=180,w=240,h=80,color='N',font=25,code=pressKey"m"},
|
||||
WIDGET.newKey{name="field", x=450, y=180,w=240,h=80,color='A',font=25,code=pressKey"f"},
|
||||
WIDGET.newKey{name="sequence", x=730, y=180,w=240,h=80,color='W',font=25,code=pressKey"s"},
|
||||
--Mission / Field / Sequence
|
||||
WIDGET.newKey{name="mission", x=170,y=180,w=240,h=80,color='N',font=25,code=pressKey"m"},
|
||||
WIDGET.newKey{name="field", x=450,y=180,w=240,h=80,color='A',font=25,code=pressKey"f"},
|
||||
WIDGET.newKey{name="sequence", x=730,y=180,w=240,h=80,color='W',font=25,code=pressKey"s"},
|
||||
|
||||
WIDGET.newText{name="noMsn", x=50, y=220,align='L',color='H',hideF=function()return MISSION[1]end},
|
||||
WIDGET.newText{name="defSeq", x=610, y=220,align='L',color='H',hideF=function()return BAG[1]end},
|
||||
WIDGET.newText{name="noMsn", x=50, y=220,align='L',color='H',hideF=function()return MISSION[1]end},
|
||||
WIDGET.newText{name="defSeq", x=610,y=220,align='L',color='H',hideF=function()return BAG[1]end},
|
||||
|
||||
--Selectors
|
||||
WIDGET.newSelector{name="opponent", x=170,y=330,w=260,color='R',list=sList.opponent, disp=CUSval("opponent"), code=CUSsto("opponent")},
|
||||
WIDGET.newSelector{name="life", x=170,y=410,w=260,color='R',list=sList.life, disp=CUSval("life"), code=CUSsto("life")},
|
||||
WIDGET.newSelector{name="pushSpeed", x=170,y=520,w=260,color='V',list=sList.pushSpeed, disp=CUSval("pushSpeed"), code=CUSsto("pushSpeed")},
|
||||
WIDGET.newSelector{name="garbageSpeed", x=170,y=600,w=260,color='V',list=sList.pushSpeed, disp=CUSval("garbageSpeed"),code=CUSsto("garbageSpeed")},
|
||||
WIDGET.newSelector{name="visible", x=170,y=710,w=260,color='lB',list=sList.visible, disp=CUSval("visible"), code=CUSsto("visible")},
|
||||
WIDGET.newSelector{name="freshLimit", x=170,y=790,w=260,color='lB',list=sList.freshLimit, disp=CUSval("freshLimit"), code=CUSsto("freshLimit")},
|
||||
--Selectors
|
||||
WIDGET.newSelector{name="opponent", x=170,y=330,w=260,color='R',list=sList.opponent, disp=CUSval("opponent"), code=CUSsto("opponent")},
|
||||
WIDGET.newSelector{name="life", x=170,y=410,w=260,color='R',list=sList.life, disp=CUSval("life"), code=CUSsto("life")},
|
||||
WIDGET.newSelector{name="pushSpeed", x=170,y=520,w=260,color='V',list=sList.pushSpeed, disp=CUSval("pushSpeed"), code=CUSsto("pushSpeed")},
|
||||
WIDGET.newSelector{name="garbageSpeed",x=170,y=600,w=260,color='V',list=sList.pushSpeed, disp=CUSval("garbageSpeed"),code=CUSsto("garbageSpeed")},
|
||||
WIDGET.newSelector{name="visible", x=170,y=710,w=260,color='lB',list=sList.visible, disp=CUSval("visible"), code=CUSsto("visible")},
|
||||
WIDGET.newSelector{name="freshLimit", x=170,y=790,w=260,color='lB',list=sList.freshLimit,disp=CUSval("freshLimit"), code=CUSsto("freshLimit")},
|
||||
|
||||
WIDGET.newSelector{name="fieldH", x=450,y=600,w=260,color='N',list=sList.fieldH, disp=CUSval("fieldH"), code=CUSsto("fieldH")},
|
||||
WIDGET.newSelector{name="heightLimit", x=450,y=710,w=260,color='S',list=sList.heightLimit, disp=CUSval("heightLimit"), code=CUSsto("heightLimit")},
|
||||
WIDGET.newSelector{name="bufferLimit", x=450,y=790,w=260,color='B',list=sList.bufferLimit, disp=CUSval("bufferLimit"), code=CUSsto("bufferLimit")},
|
||||
WIDGET.newSelector{name="fieldH", x=450,y=600,w=260,color='N',list=sList.fieldH, disp=CUSval("fieldH"), code=CUSsto("fieldH")},
|
||||
WIDGET.newSelector{name="heightLimit", x=450,y=710,w=260,color='S',list=sList.heightLimit,disp=CUSval("heightLimit"), code=CUSsto("heightLimit")},
|
||||
WIDGET.newSelector{name="bufferLimit", x=450,y=790,w=260,color='B',list=sList.bufferLimit,disp=CUSval("bufferLimit"), code=CUSsto("bufferLimit")},
|
||||
|
||||
WIDGET.newSelector{name="drop",x=730,y=330,w=260,color='O',list=sList.drop,disp=CUSval("drop"),code=CUSsto("drop")},
|
||||
WIDGET.newSelector{name="lock",x=730,y=410,w=260,color='O',list=sList.lock,disp=CUSval("lock"),code=CUSsto("lock")},
|
||||
WIDGET.newSelector{name="wait",x=730,y=520,w=260,color='G',list=sList.wait,disp=CUSval("wait"),code=CUSsto("wait")},
|
||||
WIDGET.newSelector{name="fall",x=730,y=600,w=260,color='G',list=sList.fall,disp=CUSval("fall"),code=CUSsto("fall")},
|
||||
WIDGET.newSelector{name="drop", x=730,y=330,w=260,color='O',list=sList.drop,disp=CUSval("drop"),code=CUSsto("drop")},
|
||||
WIDGET.newSelector{name="lock", x=730,y=410,w=260,color='O',list=sList.lock,disp=CUSval("lock"),code=CUSsto("lock")},
|
||||
WIDGET.newSelector{name="wait", x=730,y=520,w=260,color='G',list=sList.wait,disp=CUSval("wait"),code=CUSsto("wait")},
|
||||
WIDGET.newSelector{name="fall", x=730,y=600,w=260,color='G',list=sList.fall,disp=CUSval("fall"),code=CUSsto("fall")},
|
||||
|
||||
--Copy / Paste / Start
|
||||
WIDGET.newButton{name="copy", x=1070, y=300,w=310,h=70,color='lR',font=25,code=pressKey"cC"},
|
||||
WIDGET.newButton{name="paste", x=1070, y=380,w=310,h=70,color='lB',font=25,code=pressKey"cV"},
|
||||
WIDGET.newButton{name="clear", x=1070, y=460,w=310,h=70,color='lY',font=35,code=pressKey"return"},
|
||||
WIDGET.newButton{name="puzzle", x=1070, y=540,w=310,h=70,color='lM',font=35,code=pressKey"return2",hideF=function()return not initField end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},
|
||||
--Copy / Paste / Start
|
||||
WIDGET.newButton{name="copy", x=1070,y=300,w=310,h=70,color='lR',font=25,code=pressKey"cC"},
|
||||
WIDGET.newButton{name="paste", x=1070,y=380,w=310,h=70,color='lB',font=25,code=pressKey"cV"},
|
||||
WIDGET.newButton{name="clear", x=1070,y=460,w=310,h=70,color='lY',font=35,code=pressKey"return"},
|
||||
WIDGET.newButton{name="puzzle", x=1070,y=540,w=310,h=70,color='lM',font=35,code=pressKey"return2",hideF=function()return not initField end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},
|
||||
|
||||
--Special rules
|
||||
WIDGET.newSwitch{name="ospin", x=830, y=750,disp=CUSval("ospin"), code=CUSrev("ospin")},
|
||||
WIDGET.newSwitch{name="fineKill", x=830, y=840,disp=CUSval("fineKill"), code=CUSrev("fineKill")},
|
||||
WIDGET.newSwitch{name="b2bKill", x=830, y=930,disp=CUSval("b2bKill"), code=CUSrev("b2bKill")},
|
||||
WIDGET.newSwitch{name="easyFresh", x=1170, y=750,disp=CUSval("easyFresh"), code=CUSrev("easyFresh")},
|
||||
WIDGET.newSwitch{name="deepDrop", x=1170, y=840,disp=CUSval("deepDrop"), code=CUSrev("deepDrop")},
|
||||
WIDGET.newSwitch{name="bone", x=1170, y=930,disp=CUSval("bone"), code=CUSrev("bone")},
|
||||
--Special rules
|
||||
WIDGET.newSwitch{name="ospin", x=830, y=750,disp=CUSval("ospin"), code=CUSrev("ospin")},
|
||||
WIDGET.newSwitch{name="fineKill", x=830, y=840,disp=CUSval("fineKill"), code=CUSrev("fineKill")},
|
||||
WIDGET.newSwitch{name="b2bKill", x=830, y=930,disp=CUSval("b2bKill"), code=CUSrev("b2bKill")},
|
||||
WIDGET.newSwitch{name="easyFresh",x=1170,y=750,disp=CUSval("easyFresh"),code=CUSrev("easyFresh")},
|
||||
WIDGET.newSwitch{name="deepDrop", x=1170,y=840,disp=CUSval("deepDrop"), code=CUSrev("deepDrop")},
|
||||
WIDGET.newSwitch{name="bone", x=1170,y=930,disp=CUSval("bone"), code=CUSrev("bone")},
|
||||
|
||||
--Next & Hold
|
||||
WIDGET.newSlider{name="nextCount", x=120,y=940,w=200,unit=6, disp=CUSval("nextCount"),code=CUSsto("nextCount")},
|
||||
WIDGET.newSlider{name="holdCount", x=120,y=1030,w=200,unit=6, disp=CUSval("holdCount"),code=CUSsto("holdCount")},
|
||||
WIDGET.newSwitch{name="infHold", x=560,y=940, disp=CUSval("infHold"),code=CUSrev("infHold"),hideF=function()return CUSTOMENV.holdCount==0 end},
|
||||
WIDGET.newSwitch{name="phyHold", x=560,y=1030, disp=CUSval("phyHold"),code=CUSrev("phyHold"),hideF=function()return CUSTOMENV.holdCount==0 end},
|
||||
--Next & Hold
|
||||
WIDGET.newSlider{name="nextCount",x=120, y=940,w=200,unit=6, disp=CUSval("nextCount"),code=CUSsto("nextCount")},
|
||||
WIDGET.newSlider{name="holdCount",x=120, y=1030,w=200,unit=6,disp=CUSval("holdCount"),code=CUSsto("holdCount")},
|
||||
WIDGET.newSwitch{name="infHold", x=560, y=940, disp=CUSval("infHold"),code=CUSrev("infHold"),hideF=function()return CUSTOMENV.holdCount==0 end},
|
||||
WIDGET.newSwitch{name="phyHold", x=560, y=1030, disp=CUSval("phyHold"),code=CUSrev("phyHold"),hideF=function()return CUSTOMENV.holdCount==0 end},
|
||||
|
||||
--BG & BGM
|
||||
WIDGET.newSelector{name="bg", x=840, y=1030,w=250,color='Y',list=BG.getList(),disp=CUSval("bg"),code=function(i)CUSTOMENV.bg=i BG.set(i)end},
|
||||
WIDGET.newSelector{name="bgm", x=1120, y=1030,w=250,color='Y',list=BGM.getList(),disp=CUSval("bgm"),code=function(i)CUSTOMENV.bgm=i BGM.play(i)end},
|
||||
--BG & BGM
|
||||
WIDGET.newSelector{name="bg", x=840, y=1030,w=250,color='Y',list=BG.getList(),disp=CUSval("bg"),code=function(i)CUSTOMENV.bg=i BG.set(i)end},
|
||||
WIDGET.newSelector{name="bgm", x=1120,y=1030,w=250,color='Y',list=BGM.getList(),disp=CUSval("bgm"),code=function(i)CUSTOMENV.bgm=i BGM.play(i)end},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -17,133 +17,133 @@ local demo--If show x
|
||||
local page
|
||||
|
||||
local penKey={
|
||||
["1"]=1,["2"]=2,["3"]=3,["4"]=4,["5"]=5,["6"]=6,["7"]=7,["8"]=8,
|
||||
q=9,w=10,e=11,r=12,t=13,y=14,u=15,i=16,
|
||||
a=17,s=18,d=19,f=20,g=21,h=22,j=23,k=24,
|
||||
z=0,x=-1,
|
||||
["1"]=1,["2"]=2,["3"]=3,["4"]=4,["5"]=5,["6"]=6,["7"]=7,["8"]=8,
|
||||
q=9,w=10,e=11,r=12,t=13,y=14,u=15,i=16,
|
||||
a=17,s=18,d=19,f=20,g=21,h=22,j=23,k=24,
|
||||
z=0,x=-1,
|
||||
}
|
||||
local minoPosCode={
|
||||
[102]=1,[1121]=1,--Z
|
||||
[195]=2,[610]=2,--S
|
||||
[39]=3,[1569]=3,[228]=3,[1091]=3,--J
|
||||
[135]=4,[547]=4,[225]=4,[1602]=4,--L
|
||||
[71]=5,[609]=5,[226]=5,[1122]=5,--T
|
||||
[99]=6,--O
|
||||
[15]=7,[4641]=7,--I
|
||||
[1606]=8,[2273]=8,--Z5
|
||||
[3139]=9,[740]=9,--S5
|
||||
[103]=10,[1633]=10,[230]=10,[1123]=10,--P
|
||||
[199]=11,[611]=11,[227]=11,[1634]=11,--Q
|
||||
[738]=12,[3170]=12,[1252]=12,[1219]=12,--F
|
||||
[2274]=13,[1126]=13,[1249]=13,[1730]=13,--E
|
||||
[1095]=14,[737]=14,[3650]=14,[2276]=14,--T5
|
||||
[167]=15,[1571]=15,[229]=15,[1603]=15,--U
|
||||
[2183]=16,[551]=16,[3617]=16,[3716]=16,--V
|
||||
[614]=17,[3169]=17,[1732]=17,[2243]=17,--W
|
||||
[1250]=18,--X
|
||||
[47]=19,[12833]=19,[488]=19,[9283]=19,--J5
|
||||
[271]=20,[4643]=20,[481]=20,[13378]=20,--L5
|
||||
[79]=21,[5665]=21,[484]=21,[9314]=21,--R
|
||||
[143]=22,[4705]=22,[482]=22,[9794]=22,--Y
|
||||
[110]=23,[9761]=23,[236]=23,[9313]=23,--N
|
||||
[391]=24,[4706]=24,[451]=24,[5698]=24,--H
|
||||
[31]=25,[21025]=25,--I5
|
||||
[7]=26,[545]=26,--I3
|
||||
[67]=27,[35]=27,[97]=27,[98]=27,--C
|
||||
[3]=28,[33]=28,--I2
|
||||
[1]=29,--O1
|
||||
[102]=1,[1121]=1,--Z
|
||||
[195]=2,[610]=2,--S
|
||||
[39]=3,[1569]=3,[228]=3,[1091]=3,--J
|
||||
[135]=4,[547]=4,[225]=4,[1602]=4,--L
|
||||
[71]=5,[609]=5,[226]=5,[1122]=5,--T
|
||||
[99]=6,--O
|
||||
[15]=7,[4641]=7,--I
|
||||
[1606]=8,[2273]=8,--Z5
|
||||
[3139]=9,[740]=9,--S5
|
||||
[103]=10,[1633]=10,[230]=10,[1123]=10,--P
|
||||
[199]=11,[611]=11,[227]=11,[1634]=11,--Q
|
||||
[738]=12,[3170]=12,[1252]=12,[1219]=12,--F
|
||||
[2274]=13,[1126]=13,[1249]=13,[1730]=13,--E
|
||||
[1095]=14,[737]=14,[3650]=14,[2276]=14,--T5
|
||||
[167]=15,[1571]=15,[229]=15,[1603]=15,--U
|
||||
[2183]=16,[551]=16,[3617]=16,[3716]=16,--V
|
||||
[614]=17,[3169]=17,[1732]=17,[2243]=17,--W
|
||||
[1250]=18,--X
|
||||
[47]=19,[12833]=19,[488]=19,[9283]=19,--J5
|
||||
[271]=20,[4643]=20,[481]=20,[13378]=20,--L5
|
||||
[79]=21,[5665]=21,[484]=21,[9314]=21,--R
|
||||
[143]=22,[4705]=22,[482]=22,[9794]=22,--Y
|
||||
[110]=23,[9761]=23,[236]=23,[9313]=23,--N
|
||||
[391]=24,[4706]=24,[451]=24,[5698]=24,--H
|
||||
[31]=25,[21025]=25,--I5
|
||||
[7]=26,[545]=26,--I3
|
||||
[67]=27,[35]=27,[97]=27,[98]=27,--C
|
||||
[3]=28,[33]=28,--I2
|
||||
[1]=29,--O1
|
||||
}
|
||||
local function _pTouch(x,y)
|
||||
if not curPen then return end
|
||||
for i=1,#penPath do
|
||||
if x==penPath[i][1]and y==penPath[i][2]then
|
||||
return
|
||||
end
|
||||
end
|
||||
if #penPath==0 then
|
||||
penMode=
|
||||
pens[curPen]>0 and(FIELD[page][y][x]~=pens[curPen] and 0 or 1)or
|
||||
pens[curPen]==0 and 1 or
|
||||
pens[curPen]==-1 and 0 or
|
||||
pens[curPen]==-2 and (FIELD[page][y][x]<=0 and 0 or 1)
|
||||
end
|
||||
ins(penPath,{x,y})
|
||||
if not curPen then return end
|
||||
for i=1,#penPath do
|
||||
if x==penPath[i][1]and y==penPath[i][2]then
|
||||
return
|
||||
end
|
||||
end
|
||||
if #penPath==0 then
|
||||
penMode=
|
||||
pens[curPen]>0 and(FIELD[page][y][x]~=pens[curPen] and 0 or 1)or
|
||||
pens[curPen]==0 and 1 or
|
||||
pens[curPen]==-1 and 0 or
|
||||
pens[curPen]==-2 and (FIELD[page][y][x]<=0 and 0 or 1)
|
||||
end
|
||||
ins(penPath,{x,y})
|
||||
end
|
||||
local function _pDraw()
|
||||
local l=#penPath
|
||||
if l==0 then return end
|
||||
local l=#penPath
|
||||
if l==0 then return end
|
||||
|
||||
local C--Color
|
||||
if penMode==0 then
|
||||
if pens[curPen]==-2 then
|
||||
if l<=5 then
|
||||
local sum=0
|
||||
local x,y={},{}
|
||||
for i=1,l do
|
||||
ins(x,penPath[i][1])
|
||||
ins(y,penPath[i][2])
|
||||
end
|
||||
local minY,minX=min(unpack(y)),min(unpack(x))
|
||||
for i=1,#y do
|
||||
sum=sum+2^((11-(y[i]-minY))*(y[i]-minY)/2+(x[i]-minX))
|
||||
end
|
||||
if minoPosCode[sum]then
|
||||
C=SETTING.skin[minoPosCode[sum]]
|
||||
end
|
||||
else
|
||||
C=20
|
||||
end
|
||||
else
|
||||
C=pens[curPen]
|
||||
end
|
||||
else
|
||||
C=0
|
||||
end
|
||||
local C--Color
|
||||
if penMode==0 then
|
||||
if pens[curPen]==-2 then
|
||||
if l<=5 then
|
||||
local sum=0
|
||||
local x,y={},{}
|
||||
for i=1,l do
|
||||
ins(x,penPath[i][1])
|
||||
ins(y,penPath[i][2])
|
||||
end
|
||||
local minY,minX=min(unpack(y)),min(unpack(x))
|
||||
for i=1,#y do
|
||||
sum=sum+2^((11-(y[i]-minY))*(y[i]-minY)/2+(x[i]-minX))
|
||||
end
|
||||
if minoPosCode[sum]then
|
||||
C=SETTING.skin[minoPosCode[sum]]
|
||||
end
|
||||
else
|
||||
C=20
|
||||
end
|
||||
else
|
||||
C=pens[curPen]
|
||||
end
|
||||
else
|
||||
C=0
|
||||
end
|
||||
|
||||
if C then
|
||||
for i=1,l do
|
||||
FIELD[page][penPath[i][2]][penPath[i][1]]=C
|
||||
end
|
||||
end
|
||||
penPath={}
|
||||
penMode=0
|
||||
if C then
|
||||
for i=1,l do
|
||||
FIELD[page][penPath[i][2]][penPath[i][1]]=C
|
||||
end
|
||||
end
|
||||
penPath={}
|
||||
penMode=0
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
sure=0
|
||||
curPen=false
|
||||
penMode=0
|
||||
penX,penY=1,1
|
||||
demo=false
|
||||
page=1
|
||||
sure=0
|
||||
curPen=false
|
||||
penMode=0
|
||||
penX,penY=1,1
|
||||
demo=false
|
||||
page=1
|
||||
end
|
||||
function scene.sceneBack()
|
||||
FILE.save(DATA.copyBoards(),'conf/customBoards')
|
||||
FILE.save(DATA.copyBoards(),'conf/customBoards')
|
||||
end
|
||||
|
||||
function scene.mouseMove(x,y)
|
||||
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
|
||||
if sx>=1 and sx<=10 and sy>=1 and sy<=20 then
|
||||
penX,penY=sx,sy
|
||||
if curPen then _pTouch(sx,sy)end
|
||||
else
|
||||
penX,penY=nil
|
||||
end
|
||||
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
|
||||
if sx>=1 and sx<=10 and sy>=1 and sy<=20 then
|
||||
penX,penY=sx,sy
|
||||
if curPen then _pTouch(sx,sy)end
|
||||
else
|
||||
penX,penY=nil
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(x,y,k)
|
||||
if not curPen then
|
||||
curPen=k
|
||||
elseif curPen~=k then
|
||||
curPen=false
|
||||
penPath={}
|
||||
end
|
||||
scene.mouseMove(x,y)
|
||||
if not curPen then
|
||||
curPen=k
|
||||
elseif curPen~=k then
|
||||
curPen=false
|
||||
penPath={}
|
||||
end
|
||||
scene.mouseMove(x,y)
|
||||
end
|
||||
function scene.mouseUp(_,_,k)
|
||||
if curPen==k then
|
||||
_pDraw()
|
||||
curPen=false
|
||||
end
|
||||
if curPen==k then
|
||||
_pDraw()
|
||||
curPen=false
|
||||
end
|
||||
end
|
||||
|
||||
function scene.touchDown(x,y)scene.mouseDown(x,y,1)end
|
||||
@@ -151,343 +151,343 @@ function scene.touchMove(x,y)scene.mouseMove(x,y)end
|
||||
function scene.touchUp(x,y)scene.mouseUp(x,y,1)end
|
||||
|
||||
function scene.keyDown(key)
|
||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if not penX or not penY then penX,penY=1,1 end
|
||||
if key=="up"then
|
||||
if penY<20 then penY=penY+1 end
|
||||
elseif key=="down"then
|
||||
if penY>1 then penY=penY-1 end
|
||||
elseif key=="left"then
|
||||
if penX>1 then penX=penX-1 end
|
||||
elseif key=="right"then
|
||||
if penX<10 then penX=penX+1 end
|
||||
end
|
||||
if kb.isDown("space")then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
elseif key=="space"then
|
||||
if penX and penY then
|
||||
curPen=1
|
||||
_pTouch(penX,penY)
|
||||
end
|
||||
elseif key=="delete"then
|
||||
if sure>.3 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
|
||||
sure=1
|
||||
end
|
||||
elseif key=="j"then
|
||||
demo=not demo
|
||||
elseif key=="k"then
|
||||
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[page]
|
||||
for i=20,1,-1 do
|
||||
for j=1,10 do
|
||||
if F[i][j]<=0 then goto CONTINUE_notFull end
|
||||
end
|
||||
SYSFX.newShade(3,200,660-30*i,300,30)
|
||||
SYSFX.newRectRipple(3,200,660-30*i,300,30)
|
||||
rem(F,i)
|
||||
::CONTINUE_notFull::
|
||||
end
|
||||
if #F~=20 then
|
||||
repeat
|
||||
F[#F+1]={0,0,0,0,0,0,0,0,0,0}
|
||||
until#F==20
|
||||
SFX.play('clear_3',.8)
|
||||
SFX.play('fall',.8)
|
||||
end
|
||||
elseif key=="n"then
|
||||
ins(FIELD,page+1,DATA.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,page)
|
||||
page=max(page-1,1)
|
||||
if not FIELD[1]then
|
||||
ins(FIELD,DATA.newBoard())
|
||||
end
|
||||
SYSFX.newShade(3,200,60,300,600,1,.5,.5)
|
||||
SFX.play('clear_4',.8)
|
||||
SFX.play('fall',.8)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
sys.setClipboardText("Techmino Field:"..DATA.copyBoard(page))
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("Field")then
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteBoard(str,page)then
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="pageup"then
|
||||
page=max(page-1,1)
|
||||
elseif key=="pagedown"then
|
||||
page=min(page+1,#FIELD)
|
||||
elseif key=="escape"then
|
||||
if curPen then
|
||||
curPen=false
|
||||
penPath={}
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
pens[curPen]=penKey[key]or pens[curPen]
|
||||
end
|
||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
if not penX or not penY then penX,penY=1,1 end
|
||||
if key=="up"then
|
||||
if penY<20 then penY=penY+1 end
|
||||
elseif key=="down"then
|
||||
if penY>1 then penY=penY-1 end
|
||||
elseif key=="left"then
|
||||
if penX>1 then penX=penX-1 end
|
||||
elseif key=="right"then
|
||||
if penX<10 then penX=penX+1 end
|
||||
end
|
||||
if kb.isDown("space")then
|
||||
scene.keyDown("space")
|
||||
end
|
||||
elseif key=="space"then
|
||||
if penX and penY then
|
||||
curPen=1
|
||||
_pTouch(penX,penY)
|
||||
end
|
||||
elseif key=="delete"then
|
||||
if sure>.3 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
|
||||
sure=1
|
||||
end
|
||||
elseif key=="j"then
|
||||
demo=not demo
|
||||
elseif key=="k"then
|
||||
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[page]
|
||||
for i=20,1,-1 do
|
||||
for j=1,10 do
|
||||
if F[i][j]<=0 then goto CONTINUE_notFull end
|
||||
end
|
||||
SYSFX.newShade(3,200,660-30*i,300,30)
|
||||
SYSFX.newRectRipple(3,200,660-30*i,300,30)
|
||||
rem(F,i)
|
||||
::CONTINUE_notFull::
|
||||
end
|
||||
if #F~=20 then
|
||||
repeat
|
||||
F[#F+1]={0,0,0,0,0,0,0,0,0,0}
|
||||
until#F==20
|
||||
SFX.play('clear_3',.8)
|
||||
SFX.play('fall',.8)
|
||||
end
|
||||
elseif key=="n"then
|
||||
ins(FIELD,page+1,DATA.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,page)
|
||||
page=max(page-1,1)
|
||||
if not FIELD[1]then
|
||||
ins(FIELD,DATA.newBoard())
|
||||
end
|
||||
SYSFX.newShade(3,200,60,300,600,1,.5,.5)
|
||||
SFX.play('clear_4',.8)
|
||||
SFX.play('fall',.8)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
sys.setClipboardText("Techmino Field:"..DATA.copyBoard(page))
|
||||
MES.new('check',text.exportSuccess)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("Field")then
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteBoard(str,page)then
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="pageup"then
|
||||
page=max(page-1,1)
|
||||
elseif key=="pagedown"then
|
||||
page=min(page+1,#FIELD)
|
||||
elseif key=="escape"then
|
||||
if curPen then
|
||||
curPen=false
|
||||
penPath={}
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
pens[curPen]=penKey[key]or pens[curPen]
|
||||
end
|
||||
end
|
||||
function scene.keyUp(key)
|
||||
if key=="space"then
|
||||
_pDraw()
|
||||
curPen=false
|
||||
end
|
||||
if key=="space"then
|
||||
_pDraw()
|
||||
curPen=false
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then sure=sure-dt end
|
||||
if sure>0 then sure=sure-dt end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.translate(200,60)
|
||||
gc.translate(200,60)
|
||||
|
||||
--Draw grid
|
||||
gc.setColor(1,1,1,.2)
|
||||
gc.setLineWidth(1)
|
||||
for x=1,9 do gc.line(30*x,0,30*x,600)end
|
||||
for y=0,19 do gc.line(0,30*y,300,30*y)end
|
||||
--Draw grid
|
||||
gc.setColor(1,1,1,.2)
|
||||
gc.setLineWidth(1)
|
||||
for x=1,9 do gc.line(30*x,0,30*x,600)end
|
||||
for y=0,19 do gc.line(0,30*y,300,30*y)end
|
||||
|
||||
--Draw field
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',-2,-2,304,604,5)
|
||||
gc.setLineWidth(2)
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local F=FIELD[page]
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
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 demo then
|
||||
gc.draw(cross,30*x-30,600-30*y)
|
||||
end
|
||||
end end
|
||||
--Draw field
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',-2,-2,304,604,5)
|
||||
gc.setLineWidth(2)
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local F=FIELD[page]
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
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 demo then
|
||||
gc.draw(cross,30*x-30,600-30*y)
|
||||
end
|
||||
end end
|
||||
|
||||
--Draw pen
|
||||
if penX and penY then
|
||||
local x,y=30*penX,600-30*penY
|
||||
if curPen==1 or curPen==2 then
|
||||
gc.setLineWidth(5)
|
||||
gc.rectangle('line',x-30,y,30,30,4)
|
||||
elseif curPen==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)
|
||||
end
|
||||
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)
|
||||
end
|
||||
--Draw pen
|
||||
if penX and penY then
|
||||
local x,y=30*penX,600-30*penY
|
||||
if curPen==1 or curPen==2 then
|
||||
gc.setLineWidth(5)
|
||||
gc.rectangle('line',x-30,y,30,30,4)
|
||||
elseif curPen==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)
|
||||
end
|
||||
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)
|
||||
end
|
||||
|
||||
--Draw smart pen path
|
||||
if #penPath>0 then
|
||||
gc.setLineWidth(4)
|
||||
if penMode==0 then
|
||||
if pens[curPen]==-2 then
|
||||
if #penPath<=5 then
|
||||
gc.setColor(COLOR.rainbow_light(TIME()*6.2))
|
||||
else
|
||||
gc.setColor(.9,.9,.9,.7+.2*math.sin(TIME()*12.6))
|
||||
end
|
||||
for i=1,#penPath do
|
||||
gc.rectangle('line',30*penPath[i][1]-30+2,600-30*penPath[i][2]+2,30-4,30-4,3)
|
||||
end
|
||||
elseif pens[curPen]==-1 then
|
||||
gc.setColor(1,1,0,.7+.3*math.sin(TIME()*12.6))
|
||||
for i=1,#penPath do
|
||||
gc.draw(cross,30*penPath[i][1]-30,600-30*penPath[i][2])
|
||||
end
|
||||
elseif pens[curPen]==0 then
|
||||
gc.setColor(1,0,0)
|
||||
for i=1,#penPath do
|
||||
gc.draw(cross,30*penPath[i][1]-30+math.random(-1,1),600-30*penPath[i][2]+math.random(-1,1))
|
||||
end
|
||||
else
|
||||
local c=minoColor[pens[curPen]]
|
||||
gc.setColor(c[1],c[2],c[3],.7+.2*math.sin(TIME()*12.6))
|
||||
for i=1,#penPath do
|
||||
gc.rectangle('line',30*penPath[i][1]-30+2,600-30*penPath[i][2]+2,30-4,30-4,3)
|
||||
end
|
||||
end
|
||||
else
|
||||
gc.setColor(1,0,0)
|
||||
for i=1,#penPath do
|
||||
gc.draw(cross,30*penPath[i][1]-30+math.random(-1,1),600-30*penPath[i][2]+math.random(-1,1))
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.translate(-200,-60)
|
||||
--Draw smart pen path
|
||||
if #penPath>0 then
|
||||
gc.setLineWidth(4)
|
||||
if penMode==0 then
|
||||
if pens[curPen]==-2 then
|
||||
if #penPath<=5 then
|
||||
gc.setColor(COLOR.rainbow_light(TIME()*6.2))
|
||||
else
|
||||
gc.setColor(.9,.9,.9,.7+.2*math.sin(TIME()*12.6))
|
||||
end
|
||||
for i=1,#penPath do
|
||||
gc.rectangle('line',30*penPath[i][1]-30+2,600-30*penPath[i][2]+2,30-4,30-4,3)
|
||||
end
|
||||
elseif pens[curPen]==-1 then
|
||||
gc.setColor(1,1,0,.7+.3*math.sin(TIME()*12.6))
|
||||
for i=1,#penPath do
|
||||
gc.draw(cross,30*penPath[i][1]-30,600-30*penPath[i][2])
|
||||
end
|
||||
elseif pens[curPen]==0 then
|
||||
gc.setColor(1,0,0)
|
||||
for i=1,#penPath do
|
||||
gc.draw(cross,30*penPath[i][1]-30+math.random(-1,1),600-30*penPath[i][2]+math.random(-1,1))
|
||||
end
|
||||
else
|
||||
local c=minoColor[pens[curPen]]
|
||||
gc.setColor(c[1],c[2],c[3],.7+.2*math.sin(TIME()*12.6))
|
||||
for i=1,#penPath do
|
||||
gc.rectangle('line',30*penPath[i][1]-30+2,600-30*penPath[i][2]+2,30-4,30-4,3)
|
||||
end
|
||||
end
|
||||
else
|
||||
gc.setColor(1,0,0)
|
||||
for i=1,#penPath do
|
||||
gc.draw(cross,30*penPath[i][1]-30+math.random(-1,1),600-30*penPath[i][2]+math.random(-1,1))
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.translate(-200,-60)
|
||||
|
||||
--Draw page
|
||||
setFont(55)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(page,100,530)
|
||||
mStr(#FIELD,100,600)
|
||||
gc.rectangle('fill',50,600,100,6)
|
||||
--Draw page
|
||||
setFont(55)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(page,100,530)
|
||||
mStr(#FIELD,100,600)
|
||||
gc.rectangle('fill',50,600,100,6)
|
||||
|
||||
--Draw mouse & pen color
|
||||
gc.translate(560,475)
|
||||
--Mouse
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',0,0,80,110,5)
|
||||
gc.line(0,40,80,40)
|
||||
gc.line(33,0,33,25,47,25,47,0)
|
||||
gc.line(40,25,40,40)
|
||||
--Draw mouse & pen color
|
||||
gc.translate(560,475)
|
||||
--Mouse
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',0,0,80,110,5)
|
||||
gc.line(0,40,80,40)
|
||||
gc.line(33,0,33,25,47,25,47,0)
|
||||
gc.line(40,25,40,40)
|
||||
|
||||
--Left button
|
||||
if pens[1]>0 then
|
||||
gc.setColor(minoColor[pens[1]])
|
||||
gc.rectangle('fill',5,5,23,30,3)
|
||||
elseif pens[1]==-1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.line(5,5,28,35)
|
||||
gc.line(28,5,5,35)
|
||||
elseif pens[1]==-2 then
|
||||
if penMode==0 then
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(COLOR.rainbow(TIME()*12.6))
|
||||
gc.rectangle('fill',5,5,23,30,3)
|
||||
else
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,0,0)
|
||||
gc.line(5,5,28,35)
|
||||
gc.line(28,5,5,35)
|
||||
end
|
||||
end
|
||||
--Left button
|
||||
if pens[1]>0 then
|
||||
gc.setColor(minoColor[pens[1]])
|
||||
gc.rectangle('fill',5,5,23,30,3)
|
||||
elseif pens[1]==-1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.line(5,5,28,35)
|
||||
gc.line(28,5,5,35)
|
||||
elseif pens[1]==-2 then
|
||||
if penMode==0 then
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(COLOR.rainbow(TIME()*12.6))
|
||||
gc.rectangle('fill',5,5,23,30,3)
|
||||
else
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,0,0)
|
||||
gc.line(5,5,28,35)
|
||||
gc.line(28,5,5,35)
|
||||
end
|
||||
end
|
||||
|
||||
--Right button
|
||||
if pens[2]>0 then
|
||||
gc.setColor(minoColor[pens[2]])
|
||||
gc.rectangle('fill',52,5,23,30,3)
|
||||
elseif pens[2]==-1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(3)
|
||||
gc.line(52,5,75,35)
|
||||
gc.line(75,5,52,35)
|
||||
elseif pens[2]==-2 then
|
||||
if penMode==0 then
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(COLOR.rainbow(TIME()*12.6))
|
||||
gc.rectangle('fill',52,5,23,30,3)
|
||||
else
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,0,0)
|
||||
gc.line(52,5,75,35)
|
||||
gc.line(75,5,52,35)
|
||||
end
|
||||
end
|
||||
--Right button
|
||||
if pens[2]>0 then
|
||||
gc.setColor(minoColor[pens[2]])
|
||||
gc.rectangle('fill',52,5,23,30,3)
|
||||
elseif pens[2]==-1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(3)
|
||||
gc.line(52,5,75,35)
|
||||
gc.line(75,5,52,35)
|
||||
elseif pens[2]==-2 then
|
||||
if penMode==0 then
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(COLOR.rainbow(TIME()*12.6))
|
||||
gc.rectangle('fill',52,5,23,30,3)
|
||||
else
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,0,0)
|
||||
gc.line(52,5,75,35)
|
||||
gc.line(75,5,52,35)
|
||||
end
|
||||
end
|
||||
|
||||
--Middle button
|
||||
if pens[3]>0 then
|
||||
gc.setColor(minoColor[pens[3]])
|
||||
gc.rectangle('fill',35,2,10,21,3)
|
||||
elseif pens[3]==-1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.line(35,2,45,23)
|
||||
gc.line(45,2,35,23)
|
||||
elseif pens[3]==-2 then
|
||||
if penMode==0 then
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(COLOR.rainbow(TIME()*12.6))
|
||||
gc.rectangle('fill',35,2,10,21,3)
|
||||
else
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,0,0)
|
||||
gc.line(35,2,45,23)
|
||||
gc.line(45,2,35,23)
|
||||
end
|
||||
end
|
||||
gc.translate(-560,-475)
|
||||
--Middle button
|
||||
if pens[3]>0 then
|
||||
gc.setColor(minoColor[pens[3]])
|
||||
gc.rectangle('fill',35,2,10,21,3)
|
||||
elseif pens[3]==-1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.line(35,2,45,23)
|
||||
gc.line(45,2,35,23)
|
||||
elseif pens[3]==-2 then
|
||||
if penMode==0 then
|
||||
gc.setLineWidth(13)
|
||||
gc.setColor(COLOR.rainbow(TIME()*12.6))
|
||||
gc.rectangle('fill',35,2,10,21,3)
|
||||
else
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,0,0)
|
||||
gc.line(35,2,45,23)
|
||||
gc.line(45,2,35,23)
|
||||
end
|
||||
end
|
||||
gc.translate(-560,-475)
|
||||
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,990,530,nil,1.2)
|
||||
end
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,990,530,nil,1.2)
|
||||
end
|
||||
|
||||
--Block name
|
||||
setFont(55)
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,7 do
|
||||
local skin=SETTING.skin[i]
|
||||
mStr(text.block[i],500+skin%8*80,90+80*int(skin/8))
|
||||
end
|
||||
--Block name
|
||||
setFont(55)
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,7 do
|
||||
local skin=SETTING.skin[i]
|
||||
mStr(text.block[i],500+skin%8*80,90+80*int(skin/8))
|
||||
end
|
||||
end
|
||||
|
||||
local function _setPen(i)return function(k)pens[k]=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='H'},
|
||||
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='H'},
|
||||
|
||||
WIDGET.newButton{name="b1", x=580, y=130,w=75,fText="",color='R',code=_setPen(1)},--B1
|
||||
WIDGET.newButton{name="b2", x=660, y=130,w=75,fText="",color='F',code=_setPen(2)},--B2
|
||||
WIDGET.newButton{name="b3", x=740, y=130,w=75,fText="",color='O',code=_setPen(3)},--B3
|
||||
WIDGET.newButton{name="b4", x=820, y=130,w=75,fText="",color='Y',code=_setPen(4)},--B4
|
||||
WIDGET.newButton{name="b5", x=900, y=130,w=75,fText="",color='L',code=_setPen(5)},--B5
|
||||
WIDGET.newButton{name="b6", x=980, y=130,w=75,fText="",color='J',code=_setPen(6)},--B6
|
||||
WIDGET.newButton{name="b7", x=1060, y=130,w=75,fText="",color='G',code=_setPen(7)},--B7
|
||||
WIDGET.newButton{name="b8", x=1140, y=130,w=75,fText="",color='A',code=_setPen(8)},--B8
|
||||
WIDGET.newButton{name="b1", x=580, y=130,w=75,fText="",color='R',code=_setPen(1)},--B1
|
||||
WIDGET.newButton{name="b2", x=660, y=130,w=75,fText="",color='F',code=_setPen(2)},--B2
|
||||
WIDGET.newButton{name="b3", x=740, y=130,w=75,fText="",color='O',code=_setPen(3)},--B3
|
||||
WIDGET.newButton{name="b4", x=820, y=130,w=75,fText="",color='Y',code=_setPen(4)},--B4
|
||||
WIDGET.newButton{name="b5", x=900, y=130,w=75,fText="",color='L',code=_setPen(5)},--B5
|
||||
WIDGET.newButton{name="b6", x=980, y=130,w=75,fText="",color='J',code=_setPen(6)},--B6
|
||||
WIDGET.newButton{name="b7", x=1060,y=130,w=75,fText="",color='G',code=_setPen(7)},--B7
|
||||
WIDGET.newButton{name="b8", x=1140,y=130,w=75,fText="",color='A',code=_setPen(8)},--B8
|
||||
|
||||
WIDGET.newButton{name="b9", x=580, y=210,w=75,fText="",color='C',code=_setPen(9)},--B9
|
||||
WIDGET.newButton{name="b10", x=660, y=210,w=75,fText="",color='N',code=_setPen(10)},--B10
|
||||
WIDGET.newButton{name="b11", x=740, y=210,w=75,fText="",color='S',code=_setPen(11)},--B11
|
||||
WIDGET.newButton{name="b12", x=820, y=210,w=75,fText="",color='B',code=_setPen(12)},--B12
|
||||
WIDGET.newButton{name="b13", x=900, y=210,w=75,fText="",color='V',code=_setPen(13)},--B13
|
||||
WIDGET.newButton{name="b14", x=980, y=210,w=75,fText="",color='P',code=_setPen(14)},--B14
|
||||
WIDGET.newButton{name="b15", x=1060, y=210,w=75,fText="",color='M',code=_setPen(15)},--B15
|
||||
WIDGET.newButton{name="b16", x=1140, y=210,w=75,fText="",color='W',code=_setPen(16)},--B16
|
||||
WIDGET.newButton{name="b9", x=580, y=210,w=75,fText="",color='C',code=_setPen(9)},--B9
|
||||
WIDGET.newButton{name="b10", x=660, y=210,w=75,fText="",color='N',code=_setPen(10)},--B10
|
||||
WIDGET.newButton{name="b11", x=740, y=210,w=75,fText="",color='S',code=_setPen(11)},--B11
|
||||
WIDGET.newButton{name="b12", x=820, y=210,w=75,fText="",color='B',code=_setPen(12)},--B12
|
||||
WIDGET.newButton{name="b13", x=900, y=210,w=75,fText="",color='V',code=_setPen(13)},--B13
|
||||
WIDGET.newButton{name="b14", x=980, y=210,w=75,fText="",color='P',code=_setPen(14)},--B14
|
||||
WIDGET.newButton{name="b15", x=1060,y=210,w=75,fText="",color='M',code=_setPen(15)},--B15
|
||||
WIDGET.newButton{name="b16", x=1140,y=210,w=75,fText="",color='W',code=_setPen(16)},--B16
|
||||
|
||||
WIDGET.newButton{name="b17", x=580, y=290,w=75,fText="[ ]",color='dH', code=_setPen(17)},--BONE
|
||||
WIDGET.newButton{name="b18", x=660, y=290,w=75,fText="N", color='D', code=_setPen(18)},--HIDE
|
||||
WIDGET.newButton{name="b19", x=740, y=290,w=75,fText="B", color='lY', code=_setPen(19)},--BOMB
|
||||
WIDGET.newButton{name="b20", x=820, y=290,w=75,fText="_", color='H', code=_setPen(20)},--GB1
|
||||
WIDGET.newButton{name="b21", x=900, y=290,w=75,fText="_", color='lH', code=_setPen(21)},--GB2
|
||||
WIDGET.newButton{name="b22", x=980, y=290,w=75,fText="_", color='dV', code=_setPen(22)},--GB3
|
||||
WIDGET.newButton{name="b23", x=1060, y=290,w=75,fText="_", color='dR', code=_setPen(23)},--GB4
|
||||
WIDGET.newButton{name="b24", x=1140, y=290,w=75,fText="_", color='dG', code=_setPen(24)},--GB5
|
||||
WIDGET.newButton{name="b17", x=580, y=290,w=75,fText="[ ]",color='dH',code=_setPen(17)},--BONE
|
||||
WIDGET.newButton{name="b18", x=660, y=290,w=75,fText="N", color='D', code=_setPen(18)},--HIDE
|
||||
WIDGET.newButton{name="b19", x=740, y=290,w=75,fText="B", color='lY',code=_setPen(19)},--BOMB
|
||||
WIDGET.newButton{name="b20", x=820, y=290,w=75,fText="_", color='H', code=_setPen(20)},--GB1
|
||||
WIDGET.newButton{name="b21", x=900, y=290,w=75,fText="_", color='lH',code=_setPen(21)},--GB2
|
||||
WIDGET.newButton{name="b22", x=980, y=290,w=75,fText="_", color='dV',code=_setPen(22)},--GB3
|
||||
WIDGET.newButton{name="b23", x=1060,y=290,w=75,fText="_", color='dR',code=_setPen(23)},--GB4
|
||||
WIDGET.newButton{name="b24", x=1140,y=290,w=75,fText="_", color='dG',code=_setPen(24)},--GB5
|
||||
|
||||
WIDGET.newButton{name="any", x=600, y=400,w=120,color='lH', font=40,code=_setPen(0)},
|
||||
WIDGET.newButton{name="space", x=730, y=400,w=120,color='H', font=65,code=_setPen(-1)},
|
||||
WIDGET.newButton{name="smart", x=860, y=400,w=120,color='lG', font=30,code=_setPen(-2)},
|
||||
WIDGET.newButton{name="push", x=990, y=400,w=120,h=120,color='lY',font=20,code=pressKey"k"},
|
||||
WIDGET.newButton{name="del", x=1120, y=400,w=120,h=120,color='lY',font=20,code=pressKey"l"},
|
||||
WIDGET.newButton{name="any", x=600, y=400,w=120,color='lH', font=40,code=_setPen(0)},
|
||||
WIDGET.newButton{name="space", x=730, y=400,w=120,color='H', font=65,code=_setPen(-1)},
|
||||
WIDGET.newButton{name="smart", x=860, y=400,w=120,color='lG', font=30,code=_setPen(-2)},
|
||||
WIDGET.newButton{name="push", x=990, y=400,w=120,h=120,color='lY',font=20,code=pressKey"k"},
|
||||
WIDGET.newButton{name="del", x=1120,y=400,w=120,h=120,color='lY',font=20,code=pressKey"l"},
|
||||
|
||||
WIDGET.newButton{name="copy", x=730, y=530,w=120,color='lR', font=35,code=pressKey"cC"},
|
||||
WIDGET.newButton{name="paste", x=860, y=530,w=120,color='lB', font=35,code=pressKey"cV"},
|
||||
WIDGET.newButton{name="clear", x=990, y=530,w=120,color='Z', font=40,code=pressKey"delete"},
|
||||
WIDGET.newSwitch{name="demo", x=755, y=640,disp=function()return demo end,code=function()demo=not demo end},
|
||||
WIDGET.newButton{name="copy", x=730, y=530,w=120,color='lR', font=35,code=pressKey"cC"},
|
||||
WIDGET.newButton{name="paste", x=860, y=530,w=120,color='lB', font=35,code=pressKey"cV"},
|
||||
WIDGET.newButton{name="clear", x=990, y=530,w=120,color='Z', font=40,code=pressKey"delete"},
|
||||
WIDGET.newSwitch{name="demo", x=755, y=640,disp=function()return demo end,code=function()demo=not demo end},
|
||||
|
||||
WIDGET.newButton{name="newPg", x=100, y=110,w=160,h=110,color='N',font=20,code=pressKey"n"},
|
||||
WIDGET.newButton{name="delPg", x=100, y=230,w=160,h=110,color='lR',font=20,code=pressKey"m"},
|
||||
WIDGET.newButton{name="prevPg", x=100, y=350,w=160,h=110,color='lG',font=20,code=pressKey"pageup",hideF=function()return page==1 end},
|
||||
WIDGET.newButton{name="nextPg", x=100, y=470,w=160,h=110,color='lG',font=20,code=pressKey"pagedown",hideF=function()return page==#FIELD end},
|
||||
WIDGET.newButton{name="newPg", x=100, y=110,w=160,h=110,color='N',font=20,code=pressKey"n"},
|
||||
WIDGET.newButton{name="delPg", x=100, y=230,w=160,h=110,color='lR',font=20,code=pressKey"m"},
|
||||
WIDGET.newButton{name="prevPg", x=100, y=350,w=160,h=110,color='lG',font=20,code=pressKey"pageup",hideF=function()return page==1 end},
|
||||
WIDGET.newButton{name="nextPg", x=100, y=470,w=160,h=110,color='lG',font=20,code=pressKey"pagedown",hideF=function()return page==#FIELD end},
|
||||
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -11,235 +11,235 @@ local cur--Cursor position
|
||||
local sure
|
||||
|
||||
function scene.sceneInit()
|
||||
input=""
|
||||
cur=#MISSION
|
||||
sure=0
|
||||
input=""
|
||||
cur=#MISSION
|
||||
sure=0
|
||||
end
|
||||
function scene.sceneBack()
|
||||
FILE.save(DATA.copyMission(),'conf/customMissions')
|
||||
FILE.save(DATA.copyMission(),'conf/customMissions')
|
||||
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)
|
||||
if key=="left"then
|
||||
local p=cur
|
||||
if p==0 then
|
||||
cur=#MISSION
|
||||
else
|
||||
repeat
|
||||
p=p-1
|
||||
until MISSION[p]~=MISSION[cur]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="right"then
|
||||
local p=cur
|
||||
if p==#MISSION then
|
||||
cur=0
|
||||
else
|
||||
repeat
|
||||
p=p+1
|
||||
until MISSION[p+1]~=MISSION[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="ten"then
|
||||
for _=1,10 do
|
||||
local p=cur
|
||||
if p==#MISSION then break end
|
||||
repeat
|
||||
p=p+1
|
||||
until MISSION[p+1]~=MISSION[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="backspace"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 sure>.3 then
|
||||
TABLE.cut(MISSION)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #MISSION>0 then
|
||||
sys.setClipboardText("Techmino Target:"..DATA.copyMission())
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("Target")then
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteMission(str)then
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#MISSION
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif type(key)=='number'then
|
||||
local p=cur+1
|
||||
while MISSION[p]==key do p=p+1 end
|
||||
ins(MISSION,p,key)
|
||||
cur=p
|
||||
else
|
||||
if key=="space"then
|
||||
key="_"
|
||||
else
|
||||
key=string.upper(key)
|
||||
end
|
||||
if key=="left"then
|
||||
local p=cur
|
||||
if p==0 then
|
||||
cur=#MISSION
|
||||
else
|
||||
repeat
|
||||
p=p-1
|
||||
until MISSION[p]~=MISSION[cur]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="right"then
|
||||
local p=cur
|
||||
if p==#MISSION then
|
||||
cur=0
|
||||
else
|
||||
repeat
|
||||
p=p+1
|
||||
until MISSION[p+1]~=MISSION[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="ten"then
|
||||
for _=1,10 do
|
||||
local p=cur
|
||||
if p==#MISSION then break end
|
||||
repeat
|
||||
p=p+1
|
||||
until MISSION[p+1]~=MISSION[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="backspace"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 sure>.3 then
|
||||
TABLE.cut(MISSION)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #MISSION>0 then
|
||||
sys.setClipboardText("Techmino Target:"..DATA.copyMission())
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("Target")then
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteMission(str)then
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#MISSION
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif type(key)=='number'then
|
||||
local p=cur+1
|
||||
while MISSION[p]==key do p=p+1 end
|
||||
ins(MISSION,p,key)
|
||||
cur=p
|
||||
else
|
||||
if key=="space"then
|
||||
key="_"
|
||||
else
|
||||
key=string.upper(key)
|
||||
end
|
||||
|
||||
input=input..key
|
||||
if missionEnum[input]then
|
||||
cur=cur+1
|
||||
ins(MISSION,cur,missionEnum[input])
|
||||
SFX.play('lock')
|
||||
input=""
|
||||
elseif #input>1 or not legalInput[input]then
|
||||
input=""
|
||||
end
|
||||
end
|
||||
input=input..key
|
||||
if missionEnum[input]then
|
||||
cur=cur+1
|
||||
ins(MISSION,cur,missionEnum[input])
|
||||
SFX.play('lock')
|
||||
input=""
|
||||
elseif #input>1 or not legalInput[input]then
|
||||
input=""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then sure=sure-dt end
|
||||
if sure>0 then sure=sure-dt end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Draw frame
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',58,108,1164,174,5)
|
||||
--Draw frame
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',58,108,1164,174,5)
|
||||
|
||||
--Draw inputing target
|
||||
setFont(30)
|
||||
gc.setColor(.9,.9,.9)
|
||||
gc.print(input,1200,275)
|
||||
--Draw inputing target
|
||||
setFont(30)
|
||||
gc.setColor(.9,.9,.9)
|
||||
gc.print(input,1200,275)
|
||||
|
||||
--Draw targets
|
||||
local libColor=minoColor
|
||||
local set=SETTING.skin
|
||||
local L=MISSION
|
||||
local x,y=100,136--Next block pos
|
||||
local cx,cy=100,136--Cursor-center pos
|
||||
local i,j=1,#L
|
||||
local count=1
|
||||
repeat
|
||||
if L[i]==L[i-1]then
|
||||
count=count+1
|
||||
else
|
||||
if count>1 then
|
||||
setFont(25)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print("×",x-10,y-14)
|
||||
gc.print(count,x+5,y-13)
|
||||
x=x+(count<10 and 33 or 45)
|
||||
count=1
|
||||
if i==cur+1 then
|
||||
cx,cy=x,y
|
||||
end
|
||||
end
|
||||
if x>1140 then
|
||||
x,y=100,y+36
|
||||
if y>1260 then break end
|
||||
end
|
||||
if i<=j then
|
||||
setFont(35)
|
||||
local N=int(L[i]*.1)
|
||||
if N>0 then
|
||||
gc.setColor(libColor[set[N]])
|
||||
elseif L[i]>4 then
|
||||
gc.setColor(COLOR.rainbow(i+TIME()*6.26))
|
||||
else
|
||||
gc.setColor(COLOR.H)
|
||||
end
|
||||
gc.print(missionEnum[L[i]],x,y-25)
|
||||
x=x+56
|
||||
end
|
||||
end
|
||||
if i==cur then
|
||||
cx,cy=x,y
|
||||
end
|
||||
i=i+1
|
||||
until i>j+1
|
||||
--Draw targets
|
||||
local libColor=minoColor
|
||||
local set=SETTING.skin
|
||||
local L=MISSION
|
||||
local x,y=100,136--Next block pos
|
||||
local cx,cy=100,136--Cursor-center pos
|
||||
local i,j=1,#L
|
||||
local count=1
|
||||
repeat
|
||||
if L[i]==L[i-1]then
|
||||
count=count+1
|
||||
else
|
||||
if count>1 then
|
||||
setFont(25)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print("×",x-10,y-14)
|
||||
gc.print(count,x+5,y-13)
|
||||
x=x+(count<10 and 33 or 45)
|
||||
count=1
|
||||
if i==cur+1 then
|
||||
cx,cy=x,y
|
||||
end
|
||||
end
|
||||
if x>1140 then
|
||||
x,y=100,y+36
|
||||
if y>1260 then break end
|
||||
end
|
||||
if i<=j then
|
||||
setFont(35)
|
||||
local N=int(L[i]*.1)
|
||||
if N>0 then
|
||||
gc.setColor(libColor[set[N]])
|
||||
elseif L[i]>4 then
|
||||
gc.setColor(COLOR.rainbow(i+TIME()*6.26))
|
||||
else
|
||||
gc.setColor(COLOR.H)
|
||||
end
|
||||
gc.print(missionEnum[L[i]],x,y-25)
|
||||
x=x+56
|
||||
end
|
||||
end
|
||||
if i==cur then
|
||||
cx,cy=x,y
|
||||
end
|
||||
i=i+1
|
||||
until i>j+1
|
||||
|
||||
--Draw cursor
|
||||
gc.setColor(1,1,.4,.6+.4*sin(TIME()*6.26))
|
||||
gc.line(cx-5,cy-20,cx-5,cy+20)
|
||||
--Draw cursor
|
||||
gc.setColor(1,1,.4,.6+.4*sin(TIME()*6.26))
|
||||
gc.line(cx-5,cy-20,cx-5,cy+20)
|
||||
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,1000,640,nil,.9)
|
||||
end
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,1000,640,nil,.9)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=520,y=5,font=70,align='R'},
|
||||
WIDGET.newText{name="subTitle", x=530,y=50,font=35,align='L',color='H'},
|
||||
WIDGET.newText{name="title", x=520,y=5,font=70,align='R'},
|
||||
WIDGET.newText{name="subTitle",x=530,y=50,font=35,align='L',color='H'},
|
||||
|
||||
WIDGET.newKey{name="_1", x=800,y=540,w=90,font=50,code=pressKey(01)},
|
||||
WIDGET.newKey{name="_2", x=900,y=540,w=90,font=50,code=pressKey(02)},
|
||||
WIDGET.newKey{name="_3", x=800,y=640,w=90,font=50,code=pressKey(03)},
|
||||
WIDGET.newKey{name="_4", x=900,y=640,w=90,font=50,code=pressKey(04)},
|
||||
WIDGET.newKey{name="any1", x=100,y=640,w=90, code=pressKey(05)},
|
||||
WIDGET.newKey{name="any2", x=200,y=640,w=90, code=pressKey(06)},
|
||||
WIDGET.newKey{name="any3", x=300,y=640,w=90, code=pressKey(07)},
|
||||
WIDGET.newKey{name="any4", x=400,y=640,w=90, code=pressKey(08)},
|
||||
WIDGET.newKey{name="PC", x=500,y=640,w=90,font=50,code=pressKey(09)},
|
||||
WIDGET.newKey{name="_1", x=800,y=540,w=90,font=50,code=pressKey(01)},
|
||||
WIDGET.newKey{name="_2", x=900,y=540,w=90,font=50,code=pressKey(02)},
|
||||
WIDGET.newKey{name="_3", x=800,y=640,w=90,font=50,code=pressKey(03)},
|
||||
WIDGET.newKey{name="_4", x=900,y=640,w=90,font=50,code=pressKey(04)},
|
||||
WIDGET.newKey{name="any1", x=100,y=640,w=90, code=pressKey(05)},
|
||||
WIDGET.newKey{name="any2", x=200,y=640,w=90, code=pressKey(06)},
|
||||
WIDGET.newKey{name="any3", x=300,y=640,w=90, code=pressKey(07)},
|
||||
WIDGET.newKey{name="any4", x=400,y=640,w=90, code=pressKey(08)},
|
||||
WIDGET.newKey{name="PC", x=500,y=640,w=90,font=50,code=pressKey(09)},
|
||||
|
||||
WIDGET.newKey{name="Z1", x=100,y=340,w=90,font=50,code=pressKey(11)},
|
||||
WIDGET.newKey{name="S1", x=200,y=340,w=90,font=50,code=pressKey(21)},
|
||||
WIDGET.newKey{name="J1", x=300,y=340,w=90,font=50,code=pressKey(31)},
|
||||
WIDGET.newKey{name="L1", x=400,y=340,w=90,font=50,code=pressKey(41)},
|
||||
WIDGET.newKey{name="T1", x=500,y=340,w=90,font=50,code=pressKey(51)},
|
||||
WIDGET.newKey{name="O1", x=600,y=340,w=90,font=50,code=pressKey(61)},
|
||||
WIDGET.newKey{name="I1", x=700,y=340,w=90,font=50,code=pressKey(71)},
|
||||
WIDGET.newKey{name="Z1", x=100,y=340,w=90,font=50,code=pressKey(11)},
|
||||
WIDGET.newKey{name="S1", x=200,y=340,w=90,font=50,code=pressKey(21)},
|
||||
WIDGET.newKey{name="J1", x=300,y=340,w=90,font=50,code=pressKey(31)},
|
||||
WIDGET.newKey{name="L1", x=400,y=340,w=90,font=50,code=pressKey(41)},
|
||||
WIDGET.newKey{name="T1", x=500,y=340,w=90,font=50,code=pressKey(51)},
|
||||
WIDGET.newKey{name="O1", x=600,y=340,w=90,font=50,code=pressKey(61)},
|
||||
WIDGET.newKey{name="I1", x=700,y=340,w=90,font=50,code=pressKey(71)},
|
||||
|
||||
WIDGET.newKey{name="Z2", x=100,y=440,w=90,font=50,code=pressKey(12)},
|
||||
WIDGET.newKey{name="S2", x=200,y=440,w=90,font=50,code=pressKey(22)},
|
||||
WIDGET.newKey{name="J2", x=300,y=440,w=90,font=50,code=pressKey(32)},
|
||||
WIDGET.newKey{name="L2", x=400,y=440,w=90,font=50,code=pressKey(42)},
|
||||
WIDGET.newKey{name="T2", x=500,y=440,w=90,font=50,code=pressKey(52)},
|
||||
WIDGET.newKey{name="O2", x=600,y=440,w=90,font=50,code=pressKey(62)},
|
||||
WIDGET.newKey{name="I2", x=700,y=440,w=90,font=50,code=pressKey(72)},
|
||||
WIDGET.newKey{name="Z2", x=100,y=440,w=90,font=50,code=pressKey(12)},
|
||||
WIDGET.newKey{name="S2", x=200,y=440,w=90,font=50,code=pressKey(22)},
|
||||
WIDGET.newKey{name="J2", x=300,y=440,w=90,font=50,code=pressKey(32)},
|
||||
WIDGET.newKey{name="L2", x=400,y=440,w=90,font=50,code=pressKey(42)},
|
||||
WIDGET.newKey{name="T2", x=500,y=440,w=90,font=50,code=pressKey(52)},
|
||||
WIDGET.newKey{name="O2", x=600,y=440,w=90,font=50,code=pressKey(62)},
|
||||
WIDGET.newKey{name="I2", x=700,y=440,w=90,font=50,code=pressKey(72)},
|
||||
|
||||
WIDGET.newKey{name="Z3", x=100,y=540,w=90,font=50,code=pressKey(13)},
|
||||
WIDGET.newKey{name="S3", x=200,y=540,w=90,font=50,code=pressKey(23)},
|
||||
WIDGET.newKey{name="J3", x=300,y=540,w=90,font=50,code=pressKey(33)},
|
||||
WIDGET.newKey{name="L3", x=400,y=540,w=90,font=50,code=pressKey(43)},
|
||||
WIDGET.newKey{name="T3", x=500,y=540,w=90,font=50,code=pressKey(53)},
|
||||
WIDGET.newKey{name="O3", x=600,y=540,w=90,font=50,code=pressKey(63)},
|
||||
WIDGET.newKey{name="I3", x=700,y=540,w=90,font=50,code=pressKey(73)},
|
||||
WIDGET.newKey{name="Z3", x=100,y=540,w=90,font=50,code=pressKey(13)},
|
||||
WIDGET.newKey{name="S3", x=200,y=540,w=90,font=50,code=pressKey(23)},
|
||||
WIDGET.newKey{name="J3", x=300,y=540,w=90,font=50,code=pressKey(33)},
|
||||
WIDGET.newKey{name="L3", x=400,y=540,w=90,font=50,code=pressKey(43)},
|
||||
WIDGET.newKey{name="T3", x=500,y=540,w=90,font=50,code=pressKey(53)},
|
||||
WIDGET.newKey{name="O3", x=600,y=540,w=90,font=50,code=pressKey(63)},
|
||||
WIDGET.newKey{name="I3", x=700,y=540,w=90,font=50,code=pressKey(73)},
|
||||
|
||||
WIDGET.newKey{name="O4", x=600,y=640,w=90,font=50,code=pressKey(64)},
|
||||
WIDGET.newKey{name="I4", x=700,y=640,w=90,font=50,code=pressKey(74)},
|
||||
WIDGET.newKey{name="O4", x=600,y=640,w=90,font=50,code=pressKey(64)},
|
||||
WIDGET.newKey{name="I4", x=700,y=640,w=90,font=50,code=pressKey(74)},
|
||||
|
||||
WIDGET.newKey{name="left", x=800, y=440,w=90, color='lG',font=55,code=pressKey"left"},
|
||||
WIDGET.newKey{name="right", x=900, y=440,w=90, color='lG',font=55,code=pressKey"right"},
|
||||
WIDGET.newKey{name="ten", x=1000, y=440,w=90, color='lG',font=40,code=pressKey"ten"},
|
||||
WIDGET.newKey{name="backsp", x=1000, y=540,w=90, color='lY',font=50,code=pressKey"backspace"},
|
||||
WIDGET.newKey{name="reset", x=1000, y=640,w=90, color='lY',font=50,code=pressKey"delete"},
|
||||
WIDGET.newButton{name="copy", x=1140, y=440,w=170,h=80, color='lR',font=40,code=pressKey"cC",hideF=function()return #MISSION==0 end},
|
||||
WIDGET.newButton{name="paste", x=1140, y=540,w=170,h=80, color='lB',font=40,code=pressKey"cV"},
|
||||
WIDGET.newSwitch{name="mission",x=1150, y=340,disp=CUSval("missionKill"),code=CUSrev("missionKill")},
|
||||
WIDGET.newKey{name="left", x=800, y=440,w=90, color='lG',font=55,code=pressKey"left"},
|
||||
WIDGET.newKey{name="right", x=900, y=440,w=90, color='lG',font=55,code=pressKey"right"},
|
||||
WIDGET.newKey{name="ten", x=1000,y=440,w=90, color='lG',font=40,code=pressKey"ten"},
|
||||
WIDGET.newKey{name="backsp", x=1000,y=540,w=90, color='lY',font=50,code=pressKey"backspace"},
|
||||
WIDGET.newKey{name="reset", x=1000,y=640,w=90, color='lY',font=50,code=pressKey"delete"},
|
||||
WIDGET.newButton{name="copy", x=1140,y=440,w=170,h=80,color='lR',font=40,code=pressKey"cC",hideF=function()return #MISSION==0 end},
|
||||
WIDGET.newButton{name="paste", x=1140,y=540,w=170,h=80,color='lB',font=40,code=pressKey"cV"},
|
||||
WIDGET.newSwitch{name="mission",x=1150,y=340,disp=CUSval("missionKill"),code=CUSrev("missionKill")},
|
||||
|
||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -10,234 +10,234 @@ local cur--Cursor position
|
||||
local sure
|
||||
|
||||
function scene.sceneInit()
|
||||
cur=#BAG
|
||||
sure=0
|
||||
cur=#BAG
|
||||
sure=0
|
||||
end
|
||||
function scene.sceneBack()
|
||||
FILE.save(DATA.copySequence(),'conf/customSequence')
|
||||
FILE.save(DATA.copySequence(),'conf/customSequence')
|
||||
end
|
||||
|
||||
local minoKey={
|
||||
['1']=1,['2']=2,['3']=3,['4']=4,['5']=5,['6']=6,['7']=7,
|
||||
z=1,s=2,j=3,l=4,t=5,o=6,i=7,
|
||||
p=10,q=11,f=12,e=13,u=15,
|
||||
v=16,w=17,x=18,r=21,y=22,n=23,h=24,
|
||||
['/']=26,c=27,[',']=27,['\'']=27,['-']=28,[';']=28,['.']=29,
|
||||
['1']=1,['2']=2,['3']=3,['4']=4,['5']=5,['6']=6,['7']=7,
|
||||
z=1,s=2,j=3,l=4,t=5,o=6,i=7,
|
||||
p=10,q=11,f=12,e=13,u=15,
|
||||
v=16,w=17,x=18,r=21,y=22,n=23,h=24,
|
||||
['/']=26,c=27,[',']=27,['\'']=27,['-']=28,[';']=28,['.']=29,
|
||||
}
|
||||
local minoKey2={
|
||||
['1']=8,['2']=9,['3']=19,['4']=20,['5']=14,['7']=25,
|
||||
z=8,s=9,t=14,j=19,l=20,i=25,['-']=26,o=29,
|
||||
['1']=8,['2']=9,['3']=19,['4']=20,['5']=14,['7']=25,
|
||||
z=8,s=9,t=14,j=19,l=20,i=25,['-']=26,o=29,
|
||||
}
|
||||
function scene.keyDown(key)
|
||||
if key=="left"then
|
||||
local p=cur
|
||||
if p==0 then
|
||||
cur=#BAG
|
||||
else
|
||||
repeat
|
||||
p=p-1
|
||||
until BAG[p]~=BAG[cur]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="right"then
|
||||
local p=cur
|
||||
if p==#BAG then
|
||||
cur=0
|
||||
else
|
||||
repeat
|
||||
p=p+1
|
||||
until BAG[p+1]~=BAG[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="ten"then
|
||||
for _=1,10 do
|
||||
local p=cur
|
||||
if p==#BAG then break end
|
||||
repeat
|
||||
p=p+1
|
||||
until BAG[p+1]~=BAG[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="backspace"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 sure>.3 then
|
||||
TABLE.cut(BAG)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
elseif key=="="then
|
||||
local l={1,2,3,4,5,6,7}
|
||||
repeat scene.keyDown(rem(l,math.random(#l)))until not l[1]
|
||||
elseif key=="tab"then
|
||||
WIDGET.active.sequence:scroll(kb.isDown("lshift","rshift")and -1 or 1)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #BAG>0 then
|
||||
sys.setClipboardText("Techmino SEQ:"..DATA.copySequence())
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("SEQ")then
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteSequence(str)then
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#BAG
|
||||
else
|
||||
TABLE.cut(BAG)
|
||||
cur=0
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif type(key)=='number'then
|
||||
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=cur+1
|
||||
while BAG[p]==key do p=p+1 end
|
||||
ins(BAG,p,key)
|
||||
cur=p
|
||||
SFX.play('lock')
|
||||
end
|
||||
end
|
||||
if key=="left"then
|
||||
local p=cur
|
||||
if p==0 then
|
||||
cur=#BAG
|
||||
else
|
||||
repeat
|
||||
p=p-1
|
||||
until BAG[p]~=BAG[cur]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="right"then
|
||||
local p=cur
|
||||
if p==#BAG then
|
||||
cur=0
|
||||
else
|
||||
repeat
|
||||
p=p+1
|
||||
until BAG[p+1]~=BAG[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="ten"then
|
||||
for _=1,10 do
|
||||
local p=cur
|
||||
if p==#BAG then break end
|
||||
repeat
|
||||
p=p+1
|
||||
until BAG[p+1]~=BAG[cur+1]
|
||||
cur=p
|
||||
end
|
||||
elseif key=="backspace"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 sure>.3 then
|
||||
TABLE.cut(BAG)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
elseif key=="="then
|
||||
local l={1,2,3,4,5,6,7}
|
||||
repeat scene.keyDown(rem(l,math.random(#l)))until not l[1]
|
||||
elseif key=="tab"then
|
||||
WIDGET.active.sequence:scroll(kb.isDown("lshift","rshift")and -1 or 1)
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
if #BAG>0 then
|
||||
sys.setClipboardText("Techmino SEQ:"..DATA.copySequence())
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p=str:find(":")--ptr*
|
||||
if p then
|
||||
if not str:sub(1,p-1):find("SEQ")then
|
||||
MES.new('error',text.pasteWrongPlace)
|
||||
end
|
||||
str=str:sub(p+1)
|
||||
end
|
||||
if DATA.pasteSequence(str)then
|
||||
MES.new('check',text.importSuccess)
|
||||
cur=#BAG
|
||||
else
|
||||
TABLE.cut(BAG)
|
||||
cur=0
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif type(key)=='number'then
|
||||
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=cur+1
|
||||
while BAG[p]==key do p=p+1 end
|
||||
ins(BAG,p,key)
|
||||
cur=p
|
||||
SFX.play('lock')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then sure=sure-dt end
|
||||
if sure>0 then sure=sure-dt end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Draw frame
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',100,110,1080,260,5)
|
||||
--Draw frame
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',100,110,1080,260,5)
|
||||
|
||||
--Draw sequence
|
||||
local miniBlock=TEXTURE.miniBlock
|
||||
local libColor=minoColor
|
||||
local set=SETTING.skin
|
||||
local L=BAG
|
||||
local x,y=120,136--Next block pos
|
||||
local cx,cy=120,136--Cursor-center pos
|
||||
local i,j=1,#L
|
||||
local count=1
|
||||
setFont(25)
|
||||
repeat
|
||||
if L[i]==L[i-1]then
|
||||
count=count+1
|
||||
else
|
||||
if count>1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print("×",x-5,y-14)
|
||||
gc.print(count,x+10,y-13)
|
||||
x=x+(count<10 and 33 or 45)
|
||||
count=1
|
||||
if i==cur+1 then
|
||||
cx,cy=x,y
|
||||
end
|
||||
end
|
||||
if x>1060 then
|
||||
x,y=120,y+50
|
||||
if y>1260 then break end
|
||||
end
|
||||
if i<=j then
|
||||
local B=miniBlock[L[i]]
|
||||
gc.setColor(libColor[set[L[i]]])
|
||||
gc.draw(B,x,y,nil,15,15,0,B:getHeight()*.5)
|
||||
x=x+B:getWidth()*15+10
|
||||
end
|
||||
end
|
||||
--Draw sequence
|
||||
local miniBlock=TEXTURE.miniBlock
|
||||
local libColor=minoColor
|
||||
local set=SETTING.skin
|
||||
local L=BAG
|
||||
local x,y=120,136--Next block pos
|
||||
local cx,cy=120,136--Cursor-center pos
|
||||
local i,j=1,#L
|
||||
local count=1
|
||||
setFont(25)
|
||||
repeat
|
||||
if L[i]==L[i-1]then
|
||||
count=count+1
|
||||
else
|
||||
if count>1 then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print("×",x-5,y-14)
|
||||
gc.print(count,x+10,y-13)
|
||||
x=x+(count<10 and 33 or 45)
|
||||
count=1
|
||||
if i==cur+1 then
|
||||
cx,cy=x,y
|
||||
end
|
||||
end
|
||||
if x>1060 then
|
||||
x,y=120,y+50
|
||||
if y>1260 then break end
|
||||
end
|
||||
if i<=j then
|
||||
local B=miniBlock[L[i]]
|
||||
gc.setColor(libColor[set[L[i]]])
|
||||
gc.draw(B,x,y,nil,15,15,0,B:getHeight()*.5)
|
||||
x=x+B:getWidth()*15+10
|
||||
end
|
||||
end
|
||||
|
||||
if i==cur then
|
||||
cx,cy=x,y
|
||||
end
|
||||
i=i+1
|
||||
until i>j+1
|
||||
if i==cur then
|
||||
cx,cy=x,y
|
||||
end
|
||||
i=i+1
|
||||
until i>j+1
|
||||
|
||||
--Draw lenth
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(#L,120,310)
|
||||
--Draw lenth
|
||||
setFont(40)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.print(#L,120,310)
|
||||
|
||||
--Draw cursor
|
||||
gc.setColor(.5,1,.5,.6+.4*sin(TIME()*6.26))
|
||||
gc.line(cx-5,cy-20,cx-5,cy+20)
|
||||
--Draw cursor
|
||||
gc.setColor(.5,1,.5,.6+.4*sin(TIME()*6.26))
|
||||
gc.line(cx-5,cy-20,cx-5,cy+20)
|
||||
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,1000,460,nil,.8)
|
||||
end
|
||||
--Confirm reset
|
||||
if sure>0 then
|
||||
gc.setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,1000,460,nil,.8)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title",x=520,y=5,font=70,align='R'},
|
||||
WIDGET.newText{name="subTitle",x=530,y=50,font=35,align='L',color='H'},
|
||||
WIDGET.newText{name="title",x=520,y=5,font=70,align='R'},
|
||||
WIDGET.newText{name="subTitle",x=530,y=50,font=35,align='L',color='H'},
|
||||
|
||||
WIDGET.newSelector{name="sequence",x=1080,y=60,w=200,color='Y',
|
||||
list={'bag','his','hisPool','c2','rnd','mess','reverb','loop','fixed'},
|
||||
disp=CUSval("sequence"),code=CUSsto("sequence")
|
||||
},
|
||||
WIDGET.newSelector{name="sequence",x=1080,y=60,w=200,color='Y',
|
||||
list={'bag','his','hisPool','c2','rnd','mess','reverb','loop','fixed'},
|
||||
disp=CUSval("sequence"),code=CUSsto("sequence")
|
||||
},
|
||||
|
||||
WIDGET.newKey{name="Z", x=120,y=460,w=80,font=50,code=pressKey(1)},
|
||||
WIDGET.newKey{name="S", x=200,y=460,w=80,font=50,code=pressKey(2)},
|
||||
WIDGET.newKey{name="J", x=280,y=460,w=80,font=50,code=pressKey(3)},
|
||||
WIDGET.newKey{name="L", x=360,y=460,w=80,font=50,code=pressKey(4)},
|
||||
WIDGET.newKey{name="T", x=440,y=460,w=80,font=50,code=pressKey(5)},
|
||||
WIDGET.newKey{name="O", x=520,y=460,w=80,font=50,code=pressKey(6)},
|
||||
WIDGET.newKey{name="I", x=600,y=460,w=80,font=50,code=pressKey(7)},
|
||||
WIDGET.newKey{name="left", x=680,y=460,w=80,color='lG',font=55,code=pressKey"left"},
|
||||
WIDGET.newKey{name="right", x=760,y=460,w=80,color='lG',font=55,code=pressKey"right"},
|
||||
WIDGET.newKey{name="ten", x=840,y=460,w=80,color='lG',font=40,code=pressKey"ten"},
|
||||
WIDGET.newKey{name="backsp",x=920,y=460,w=80,color='lY',font=50,code=pressKey"backspace"},
|
||||
WIDGET.newKey{name="reset", x=1000,y=460,w=80,color='lY',font=25,code=pressKey"delete"},
|
||||
WIDGET.newKey{name="Z", x=120,y=460,w=80,font=50,code=pressKey(1)},
|
||||
WIDGET.newKey{name="S", x=200,y=460,w=80,font=50,code=pressKey(2)},
|
||||
WIDGET.newKey{name="J", x=280,y=460,w=80,font=50,code=pressKey(3)},
|
||||
WIDGET.newKey{name="L", x=360,y=460,w=80,font=50,code=pressKey(4)},
|
||||
WIDGET.newKey{name="T", x=440,y=460,w=80,font=50,code=pressKey(5)},
|
||||
WIDGET.newKey{name="O", x=520,y=460,w=80,font=50,code=pressKey(6)},
|
||||
WIDGET.newKey{name="I", x=600,y=460,w=80,font=50,code=pressKey(7)},
|
||||
WIDGET.newKey{name="left", x=680,y=460,w=80,color='lG',font=55,code=pressKey"left"},
|
||||
WIDGET.newKey{name="right", x=760,y=460,w=80,color='lG',font=55,code=pressKey"right"},
|
||||
WIDGET.newKey{name="ten", x=840,y=460,w=80,color='lG',font=40,code=pressKey"ten"},
|
||||
WIDGET.newKey{name="backsp",x=920,y=460,w=80,color='lY',font=50,code=pressKey"backspace"},
|
||||
WIDGET.newKey{name="reset", x=1000,y=460,w=80,color='lY',font=25,code=pressKey"delete"},
|
||||
|
||||
WIDGET.newKey{name="Z5", x=120,y=550,w=80,color='lH',font=50,code=pressKey(8)},
|
||||
WIDGET.newKey{name="S5", x=200,y=550,w=80,color='lH',font=50,code=pressKey(9)},
|
||||
WIDGET.newKey{name="P", x=280,y=550,w=80,color='lH',font=50,code=pressKey(10)},
|
||||
WIDGET.newKey{name="Q", x=360,y=550,w=80,color='lH',font=50,code=pressKey(11)},
|
||||
WIDGET.newKey{name="F", x=440,y=550,w=80,color='lH',font=50,code=pressKey(12)},
|
||||
WIDGET.newKey{name="E", x=520,y=550,w=80,color='lH',font=50,code=pressKey(13)},
|
||||
WIDGET.newKey{name="T5", x=600,y=550,w=80,color='lH',font=50,code=pressKey(14)},
|
||||
WIDGET.newKey{name="U", x=680,y=550,w=80,color='lH',font=50,code=pressKey(15)},
|
||||
WIDGET.newKey{name="V", x=760,y=550,w=80,color='lH',font=50,code=pressKey(16)},
|
||||
WIDGET.newKey{name="I3", x=840,y=550,w=80,color='H',font=50,code=pressKey(26)},
|
||||
WIDGET.newKey{name="C", x=920,y=550,w=80,color='H',font=50,code=pressKey(27)},
|
||||
WIDGET.newKey{name="rnd", x=1000,y=550,w=80,color='R',font=25,code=pressKey"="},
|
||||
WIDGET.newKey{name="Z5", x=120,y=550,w=80,color='lH',font=50,code=pressKey(8)},
|
||||
WIDGET.newKey{name="S5", x=200,y=550,w=80,color='lH',font=50,code=pressKey(9)},
|
||||
WIDGET.newKey{name="P", x=280,y=550,w=80,color='lH',font=50,code=pressKey(10)},
|
||||
WIDGET.newKey{name="Q", x=360,y=550,w=80,color='lH',font=50,code=pressKey(11)},
|
||||
WIDGET.newKey{name="F", x=440,y=550,w=80,color='lH',font=50,code=pressKey(12)},
|
||||
WIDGET.newKey{name="E", x=520,y=550,w=80,color='lH',font=50,code=pressKey(13)},
|
||||
WIDGET.newKey{name="T5", x=600,y=550,w=80,color='lH',font=50,code=pressKey(14)},
|
||||
WIDGET.newKey{name="U", x=680,y=550,w=80,color='lH',font=50,code=pressKey(15)},
|
||||
WIDGET.newKey{name="V", x=760,y=550,w=80,color='lH',font=50,code=pressKey(16)},
|
||||
WIDGET.newKey{name="I3", x=840,y=550,w=80,color='H',font=50,code=pressKey(26)},
|
||||
WIDGET.newKey{name="C", x=920,y=550,w=80,color='H',font=50,code=pressKey(27)},
|
||||
WIDGET.newKey{name="rnd", x=1000,y=550,w=80,color='R',font=25,code=pressKey"="},
|
||||
|
||||
WIDGET.newKey{name="W", x=120,y=640,w=80,color='lH',font=50,code=pressKey(17)},
|
||||
WIDGET.newKey{name="X", x=200,y=640,w=80,color='lH',font=50,code=pressKey(18)},
|
||||
WIDGET.newKey{name="J5", x=280,y=640,w=80,color='lH',font=50,code=pressKey(19)},
|
||||
WIDGET.newKey{name="L5", x=360,y=640,w=80,color='lH',font=50,code=pressKey(20)},
|
||||
WIDGET.newKey{name="R", x=440,y=640,w=80,color='lH',font=50,code=pressKey(21)},
|
||||
WIDGET.newKey{name="Y", x=520,y=640,w=80,color='lH',font=50,code=pressKey(22)},
|
||||
WIDGET.newKey{name="N", x=600,y=640,w=80,color='lH',font=50,code=pressKey(23)},
|
||||
WIDGET.newKey{name="H", x=680,y=640,w=80,color='lH',font=50,code=pressKey(24)},
|
||||
WIDGET.newKey{name="I5", x=760,y=640,w=80,color='lH',font=50,code=pressKey(25)},
|
||||
WIDGET.newKey{name="I2", x=840,y=640,w=80,color='dH',font=50,code=pressKey(28)},
|
||||
WIDGET.newKey{name="O1", x=920,y=640,w=80,color='dH',font=50,code=pressKey(29)},
|
||||
WIDGET.newKey{name="W", x=120,y=640,w=80,color='lH',font=50,code=pressKey(17)},
|
||||
WIDGET.newKey{name="X", x=200,y=640,w=80,color='lH',font=50,code=pressKey(18)},
|
||||
WIDGET.newKey{name="J5", x=280,y=640,w=80,color='lH',font=50,code=pressKey(19)},
|
||||
WIDGET.newKey{name="L5", x=360,y=640,w=80,color='lH',font=50,code=pressKey(20)},
|
||||
WIDGET.newKey{name="R", x=440,y=640,w=80,color='lH',font=50,code=pressKey(21)},
|
||||
WIDGET.newKey{name="Y", x=520,y=640,w=80,color='lH',font=50,code=pressKey(22)},
|
||||
WIDGET.newKey{name="N", x=600,y=640,w=80,color='lH',font=50,code=pressKey(23)},
|
||||
WIDGET.newKey{name="H", x=680,y=640,w=80,color='lH',font=50,code=pressKey(24)},
|
||||
WIDGET.newKey{name="I5", x=760,y=640,w=80,color='lH',font=50,code=pressKey(25)},
|
||||
WIDGET.newKey{name="I2", x=840,y=640,w=80,color='dH',font=50,code=pressKey(28)},
|
||||
WIDGET.newKey{name="O1", x=920,y=640,w=80,color='dH',font=50,code=pressKey(29)},
|
||||
|
||||
|
||||
WIDGET.newButton{name="copy",x=1140,y=460,w=170,h=80,color='lR',font=40,code=pressKey"cC",hideF=function()return #BAG==0 end},
|
||||
WIDGET.newButton{name="paste",x=1140,y=550,w=170,h=80,color='lB',font=40,code=pressKey"cV"},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="copy", x=1140,y=460,w=170,h=80,color='lR',font=40,code=pressKey"cC",hideF=function()return #BAG==0 end},
|
||||
WIDGET.newButton{name="paste",x=1140,y=550,w=170,h=80,color='lB',font=40,code=pressKey"cV"},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -5,50 +5,50 @@ local scene={}
|
||||
local timer
|
||||
|
||||
function scene.sceneInit()
|
||||
timer=1
|
||||
scene.widgetList.pause.x=
|
||||
SETTING.menuPos=='right'and 1195 or
|
||||
SETTING.menuPos=='middle'and 860 or
|
||||
SETTING.menuPos=='left'and 190
|
||||
timer=1
|
||||
scene.widgetList.pause.x=
|
||||
SETTING.menuPos=='right'and 1195 or
|
||||
SETTING.menuPos=='middle'and 860 or
|
||||
SETTING.menuPos=='left'and 190
|
||||
end
|
||||
|
||||
function scene.keyDown(key)
|
||||
if key=="escape"then
|
||||
pauseGame()
|
||||
end
|
||||
if key=="escape"then
|
||||
pauseGame()
|
||||
end
|
||||
end
|
||||
|
||||
scene.mouseDown=NULL
|
||||
scene.touchDown=NULL
|
||||
|
||||
function scene.update(dt)
|
||||
timer=timer-dt*.8
|
||||
if timer<0 then
|
||||
SFX.play('click')
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
timer=timer-dt*.8
|
||||
if timer<0 then
|
||||
SFX.play('click')
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Game scene
|
||||
SCN.scenes.game.draw()
|
||||
--Game scene
|
||||
SCN.scenes.game.draw()
|
||||
|
||||
--Gray screen cover
|
||||
gc.setColor(.12,.12,.12,timer*8-7)
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
--Gray screen cover
|
||||
gc.setColor(.12,.12,.12,timer*8-7)
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
|
||||
--Counter bar
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(.9,.9,.9,math.min(1,12*timer,8*(1-timer))*.6)
|
||||
gc.rectangle('line',494,336,292,48,14)
|
||||
gc.setColor(.9,.9,.9,math.min(1,12*timer,8*(1-timer))*.75)
|
||||
gc.rectangle('fill',500,342,280*timer,36,10)
|
||||
--Counter bar
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(.9,.9,.9,math.min(1,12*timer,8*(1-timer))*.6)
|
||||
gc.rectangle('line',494,336,292,48,14)
|
||||
gc.setColor(.9,.9,.9,math.min(1,12*timer,8*(1-timer))*.75)
|
||||
gc.rectangle('fill',500,342,280*timer,36,10)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="pause",x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause},
|
||||
WIDGET.newKey{name="pause",x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -20,174 +20,174 @@ local scrollPos--Scroll down length
|
||||
local lastSearch--Last searched string
|
||||
|
||||
local typeColor={
|
||||
help=COLOR.Y,
|
||||
other=COLOR.lO,
|
||||
game=COLOR.lC,
|
||||
term=COLOR.lR,
|
||||
setup=COLOR.lY,
|
||||
pattern=COLOR.lJ,
|
||||
command=COLOR.lN,
|
||||
english=COLOR.B,
|
||||
name=COLOR.lV,
|
||||
help=COLOR.Y,
|
||||
other=COLOR.lO,
|
||||
game=COLOR.lC,
|
||||
term=COLOR.lR,
|
||||
setup=COLOR.lY,
|
||||
pattern=COLOR.lJ,
|
||||
command=COLOR.lN,
|
||||
english=COLOR.B,
|
||||
name=COLOR.lV,
|
||||
}
|
||||
local function _getList()return result[1]and result or dict end
|
||||
local function _clearResult()
|
||||
TABLE.cut(result)
|
||||
selected,scrollPos=1,0
|
||||
waiting,lastSearch=0,false
|
||||
TABLE.cut(result)
|
||||
selected,scrollPos=1,0
|
||||
waiting,lastSearch=0,false
|
||||
end
|
||||
local function _search()
|
||||
local input=inputBox:getText():lower()
|
||||
_clearResult()
|
||||
local first
|
||||
for i=1,#dict do
|
||||
local pos=find(dict[i][2],input,nil,true)
|
||||
if pos==1 and not first then
|
||||
ins(result,1,dict[i])
|
||||
first=true
|
||||
elseif pos then
|
||||
ins(result,dict[i])
|
||||
end
|
||||
end
|
||||
if #result>0 then
|
||||
SFX.play('reach')
|
||||
end
|
||||
url=_getList()[selected][5]
|
||||
lastSearch=input
|
||||
local input=inputBox:getText():lower()
|
||||
_clearResult()
|
||||
local first
|
||||
for i=1,#dict do
|
||||
local pos=find(dict[i][2],input,nil,true)
|
||||
if pos==1 and not first then
|
||||
ins(result,1,dict[i])
|
||||
first=true
|
||||
elseif pos then
|
||||
ins(result,dict[i])
|
||||
end
|
||||
end
|
||||
if #result>0 then
|
||||
SFX.play('reach')
|
||||
end
|
||||
url=_getList()[selected][5]
|
||||
lastSearch=input
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
dict=require("parts.language.dict_"..({"zh","zh","zh","en","en","en","en","en"})[SETTING.lang])
|
||||
dict=require("parts.language.dict_"..({"zh","zh","zh","en","en","en","en","en"})[SETTING.lang])
|
||||
|
||||
inputBox:clear()
|
||||
result={}
|
||||
url=dict[1][5]
|
||||
inputBox:clear()
|
||||
result={}
|
||||
url=dict[1][5]
|
||||
|
||||
waiting=0
|
||||
selected=1
|
||||
scrollPos=0
|
||||
waiting=0
|
||||
selected=1
|
||||
scrollPos=0
|
||||
|
||||
lastSearch=false
|
||||
WIDGET.focus(inputBox)
|
||||
BG.set('rainbow')
|
||||
lastSearch=false
|
||||
WIDGET.focus(inputBox)
|
||||
BG.set('rainbow')
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
WHEELMOV(y)
|
||||
WHEELMOV(y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
if key=="up"then
|
||||
if selected and selected>1 then
|
||||
selected=selected-1
|
||||
if selected<scrollPos+1 then
|
||||
scrollPos=scrollPos-1
|
||||
end
|
||||
end
|
||||
elseif key=="down"then
|
||||
if selected and selected<#_getList()then
|
||||
selected=selected+1
|
||||
if selected>scrollPos+15 then
|
||||
scrollPos=selected-15
|
||||
end
|
||||
end
|
||||
elseif key=="left"or key=="pageup"then
|
||||
for _=1,12 do scene.keyDown("up")end
|
||||
elseif key=="right"or key=="pagedown"then
|
||||
for _=1,12 do scene.keyDown("down")end
|
||||
elseif key=="link"then
|
||||
love.system.openURL(url)
|
||||
elseif key=="delete"then
|
||||
if inputBox:hasText()then
|
||||
_clearResult()
|
||||
inputBox:clear()
|
||||
SFX.play('hold')
|
||||
end
|
||||
elseif key=="backspace"then
|
||||
WIDGET.keyPressed("backspace")
|
||||
elseif key=="escape"then
|
||||
if inputBox:hasText()then
|
||||
scene.keyDown("delete")
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
url=_getList()[selected][5]
|
||||
if key=="up"then
|
||||
if selected and selected>1 then
|
||||
selected=selected-1
|
||||
if selected<scrollPos+1 then
|
||||
scrollPos=scrollPos-1
|
||||
end
|
||||
end
|
||||
elseif key=="down"then
|
||||
if selected and selected<#_getList()then
|
||||
selected=selected+1
|
||||
if selected>scrollPos+15 then
|
||||
scrollPos=selected-15
|
||||
end
|
||||
end
|
||||
elseif key=="left"or key=="pageup"then
|
||||
for _=1,12 do scene.keyDown("up")end
|
||||
elseif key=="right"or key=="pagedown"then
|
||||
for _=1,12 do scene.keyDown("down")end
|
||||
elseif key=="link"then
|
||||
love.system.openURL(url)
|
||||
elseif key=="delete"then
|
||||
if inputBox:hasText()then
|
||||
_clearResult()
|
||||
inputBox:clear()
|
||||
SFX.play('hold')
|
||||
end
|
||||
elseif key=="backspace"then
|
||||
WIDGET.keyPressed("backspace")
|
||||
elseif key=="escape"then
|
||||
if inputBox:hasText()then
|
||||
scene.keyDown("delete")
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
url=_getList()[selected][5]
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
local input=inputBox:getText()
|
||||
if input~=lastTickInput then
|
||||
if #input==0 then
|
||||
_clearResult()
|
||||
else
|
||||
waiting=.8
|
||||
end
|
||||
lastTickInput=input
|
||||
end
|
||||
if waiting>0 then
|
||||
waiting=waiting-dt
|
||||
if waiting<=0 then
|
||||
if #input>0 and input~=lastSearch then
|
||||
_search()
|
||||
end
|
||||
end
|
||||
end
|
||||
local input=inputBox:getText()
|
||||
if input~=lastTickInput then
|
||||
if #input==0 then
|
||||
_clearResult()
|
||||
else
|
||||
waiting=.8
|
||||
end
|
||||
lastTickInput=input
|
||||
end
|
||||
if waiting>0 then
|
||||
waiting=waiting-dt
|
||||
if waiting<=0 then
|
||||
if #input>0 and input~=lastSearch then
|
||||
_search()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
local list=_getList()
|
||||
gc.setColor(COLOR.Z)
|
||||
local t=list[selected][4]
|
||||
setFont(
|
||||
#t>900 and 15 or
|
||||
#t>600 and 20 or
|
||||
#t>400 and 25 or
|
||||
30
|
||||
)
|
||||
gc.printf(t,306,180,950)
|
||||
local list=_getList()
|
||||
gc.setColor(COLOR.Z)
|
||||
local t=list[selected][4]
|
||||
setFont(
|
||||
#t>900 and 15 or
|
||||
#t>600 and 20 or
|
||||
#t>400 and 25 or
|
||||
30
|
||||
)
|
||||
gc.printf(t,306,180,950)
|
||||
|
||||
setFont(30)
|
||||
gc.setColor(1,1,1,.4+.2*sin(TIME()*4))
|
||||
gc.rectangle('fill',20,143+35*(selected-scrollPos),280,35)
|
||||
setFont(30)
|
||||
gc.setColor(1,1,1,.4+.2*sin(TIME()*4))
|
||||
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+scrollPos
|
||||
local item=list[i]
|
||||
gc.setColor(COLOR.D)
|
||||
gc.print(item[1],29,y-1)
|
||||
gc.print(item[1],29,y+1)
|
||||
gc.print(item[1],31,y-1)
|
||||
gc.print(item[1],31,y+1)
|
||||
gc.setColor(typeColor[item[3]])
|
||||
gc.print(item[1],30,y)
|
||||
end
|
||||
setFont(30)
|
||||
for i=1,min(#list,15)do
|
||||
local y=142+35*i
|
||||
i=i+scrollPos
|
||||
local item=list[i]
|
||||
gc.setColor(COLOR.D)
|
||||
gc.print(item[1],29,y-1)
|
||||
gc.print(item[1],29,y+1)
|
||||
gc.print(item[1],31,y-1)
|
||||
gc.print(item[1],31,y+1)
|
||||
gc.setColor(typeColor[item[3]])
|
||||
gc.print(item[1],30,y)
|
||||
end
|
||||
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',300,180,958,526,5)
|
||||
gc.rectangle('line',20,180,280,526,5)
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.rectangle('line',300,180,958,526,5)
|
||||
gc.rectangle('line',20,180,280,526,5)
|
||||
|
||||
if waiting>0 then
|
||||
local r=TIME()*2
|
||||
local R=int(r)%7+1
|
||||
gc.setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc.draw(TEXTURE.miniBlock[R],785,140,TIME()*10%6.2832,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
end
|
||||
if waiting>0 then
|
||||
local r=TIME()*2
|
||||
local R=int(r)%7+1
|
||||
gc.setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc.draw(TEXTURE.miniBlock[R],785,140,TIME()*10%6.2832,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=20,y=5,font=70,align='L'},
|
||||
inputBox,
|
||||
WIDGET.newKey{name="link", x=1150,y=655,w=200,h=80,font=35,code=pressKey"link",hideF=function()return not url end},
|
||||
WIDGET.newKey{name="up", x=1130,y=460,w=60,h=90,font=35,fText="↑",code=pressKey"up",hide=not MOBILE},
|
||||
WIDGET.newKey{name="down", x=1130,y=560,w=60,h=90,font=35,fText="↓",code=pressKey"down",hide=not MOBILE},
|
||||
WIDGET.newKey{name="pageup", x=1210,y=460,w=80,h=90,font=35,fText="↑↑",code=pressKey"pageup",hide=not MOBILE},
|
||||
WIDGET.newKey{name="pagedown", x=1210,y=560,w=80,h=90,font=35,fText="↓↓",code=pressKey"pagedown",hide=not MOBILE},
|
||||
WIDGET.newButton{name="back", x=1165,y=60,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newText{name="title", x=20,y=5,font=70,align='L'},
|
||||
inputBox,
|
||||
WIDGET.newKey{name="link", x=1150,y=655,w=200,h=80,font=35,code=pressKey"link",hideF=function()return not url end},
|
||||
WIDGET.newKey{name="up", x=1130,y=460,w=60,h=90,font=35,fText="↑",code=pressKey"up",hide=not MOBILE},
|
||||
WIDGET.newKey{name="down", x=1130,y=560,w=60,h=90,font=35,fText="↓",code=pressKey"down",hide=not MOBILE},
|
||||
WIDGET.newKey{name="pageup", x=1210,y=460,w=80,h=90,font=35,fText="↑↑",code=pressKey"pageup",hide=not MOBILE},
|
||||
WIDGET.newKey{name="pagedown",x=1210,y=560,w=80,h=90,font=35,fText="↓↓",code=pressKey"pagedown",hide=not MOBILE},
|
||||
WIDGET.newButton{name="back", x=1165,y=60,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -8,37 +8,37 @@ local errorShot,errorInfo
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926}
|
||||
stateInfo=SYSTEM.."-"..VERSION.string.." scene:"..ERRDATA[#ERRDATA].scene
|
||||
errorText=LOADED and text.errorMsg or"An error has occurred during loading.\nError info has been created, and you can send it to the author."
|
||||
errorShot,errorInfo=ERRDATA[#ERRDATA].shot,ERRDATA[#ERRDATA].mes
|
||||
NET.wsclose_app()
|
||||
NET.wsclose_user()
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_stream()
|
||||
if SETTING then SFX.fplay('error',SETTING.voc*.8 or 0)end
|
||||
BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926}
|
||||
stateInfo=SYSTEM.."-"..VERSION.string.." scene:"..ERRDATA[#ERRDATA].scene
|
||||
errorText=LOADED and text.errorMsg or"An error has occurred during loading.\nError info has been created, and you can send it to the author."
|
||||
errorShot,errorInfo=ERRDATA[#ERRDATA].shot,ERRDATA[#ERRDATA].mes
|
||||
NET.wsclose_app()
|
||||
NET.wsclose_user()
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_stream()
|
||||
if SETTING then SFX.fplay('error',SETTING.voc*.8 or 0)end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.clear(BGcolor)
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(errorShot,100,345,nil,512/errorShot:getWidth(),288/errorShot:getHeight())
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(100)gc.print(":(",100,0,0,1.2)
|
||||
setFont(40)gc.printf(errorText,100,160,SCR.w0-100)
|
||||
setFont(20)
|
||||
gc.clear(BGcolor)
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(errorShot,100,345,nil,512/errorShot:getWidth(),288/errorShot:getHeight())
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(100)gc.print(":(",100,0,0,1.2)
|
||||
setFont(40)gc.printf(errorText,100,160,SCR.w0-100)
|
||||
setFont(20)
|
||||
|
||||
gc.print(stateInfo,100,640)
|
||||
gc.printf(errorInfo[1],626,326,1260-626)
|
||||
gc.print("TRACEBACK",626,390)
|
||||
for i=4,#errorInfo do
|
||||
gc.print(errorInfo[i],626,340+20*i)
|
||||
end
|
||||
gc.print(stateInfo,100,640)
|
||||
gc.printf(errorInfo[1],626,326,1260-626)
|
||||
gc.print("TRACEBACK",626,390)
|
||||
for i=4,#errorInfo do
|
||||
gc.print(errorInfo[i],626,340+20*i)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="console",x=940,y=640,w=170,h=80,font=35,code=goScene'app_console'},
|
||||
WIDGET.newKey{name="quit",x=1140,y=640,w=170,h=80,font=35,code=backScene},
|
||||
WIDGET.newKey{name="console",x=940,y=640,w=170,h=80,font=35,code=goScene'app_console'},
|
||||
WIDGET.newKey{name="quit",x=1140,y=640,w=170,h=80,font=35,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -15,386 +15,386 @@ local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",
|
||||
local scene={}
|
||||
|
||||
local function _updateMenuButtons()
|
||||
WIDGET.active.restart.hide=replaying
|
||||
WIDGET.active.restart.hide=replaying
|
||||
|
||||
local pos=(tasMode or replaying)and'right'or SETTING.menuPos
|
||||
if GAME.replaying or pos=='right'then
|
||||
WIDGET.active.restart.x=1125
|
||||
WIDGET.active.pause.x=1195
|
||||
modeTextPos=1100-drawableText.modeName:getWidth()
|
||||
elseif pos=='middle'then
|
||||
WIDGET.active.restart.x=360
|
||||
WIDGET.active.pause.x=860
|
||||
modeTextPos=940
|
||||
elseif pos=='left'then
|
||||
WIDGET.active.restart.x=120
|
||||
WIDGET.active.pause.x=190
|
||||
modeTextPos=1200-drawableText.modeName:getWidth()
|
||||
end
|
||||
local pos=(tasMode or replaying)and'right'or SETTING.menuPos
|
||||
if GAME.replaying or pos=='right'then
|
||||
WIDGET.active.restart.x=1125
|
||||
WIDGET.active.pause.x=1195
|
||||
modeTextPos=1100-drawableText.modeName:getWidth()
|
||||
elseif pos=='middle'then
|
||||
WIDGET.active.restart.x=360
|
||||
WIDGET.active.pause.x=860
|
||||
modeTextPos=940
|
||||
elseif pos=='left'then
|
||||
WIDGET.active.restart.x=120
|
||||
WIDGET.active.pause.x=190
|
||||
modeTextPos=1200-drawableText.modeName:getWidth()
|
||||
end
|
||||
end
|
||||
local function _updateRepButtons()
|
||||
local L=scene.widgetList
|
||||
if replaying or tasMode then
|
||||
for i=1,6 do L[i].hide=false end L[7].hide=true
|
||||
if gameRate==0 then
|
||||
L[1].hide=true
|
||||
L[7].hide=false
|
||||
elseif gameRate==.125 then
|
||||
L[2].hide=true
|
||||
elseif gameRate==.5 then
|
||||
L[3].hide=true
|
||||
elseif gameRate==1 then
|
||||
L[4].hide=true
|
||||
elseif gameRate==2 then
|
||||
L[5].hide=true
|
||||
elseif gameRate==5 then
|
||||
L[6].hide=true
|
||||
end
|
||||
else
|
||||
for i=1,7 do L[i].hide=true end
|
||||
end
|
||||
local L=scene.widgetList
|
||||
if replaying or tasMode then
|
||||
for i=1,6 do L[i].hide=false end L[7].hide=true
|
||||
if gameRate==0 then
|
||||
L[1].hide=true
|
||||
L[7].hide=false
|
||||
elseif gameRate==.125 then
|
||||
L[2].hide=true
|
||||
elseif gameRate==.5 then
|
||||
L[3].hide=true
|
||||
elseif gameRate==1 then
|
||||
L[4].hide=true
|
||||
elseif gameRate==2 then
|
||||
L[5].hide=true
|
||||
elseif gameRate==5 then
|
||||
L[6].hide=true
|
||||
end
|
||||
else
|
||||
for i=1,7 do L[i].hide=true end
|
||||
end
|
||||
end
|
||||
local function _speedUp()
|
||||
if gameRate==.125 then gameRate=.5
|
||||
elseif gameRate==.5 then gameRate=1
|
||||
elseif gameRate==1 then gameRate=2
|
||||
elseif gameRate==2 then gameRate=5
|
||||
end
|
||||
_updateRepButtons()
|
||||
if gameRate==.125 then gameRate=.5
|
||||
elseif gameRate==.5 then gameRate=1
|
||||
elseif gameRate==1 then gameRate=2
|
||||
elseif gameRate==2 then gameRate=5
|
||||
end
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _speedDown()
|
||||
if gameRate==.5 then gameRate=.125
|
||||
elseif gameRate==1 then gameRate=.5
|
||||
elseif gameRate==2 then gameRate=1
|
||||
elseif gameRate==5 then gameRate=2
|
||||
end
|
||||
_updateRepButtons()
|
||||
if gameRate==.5 then gameRate=.125
|
||||
elseif gameRate==1 then gameRate=.5
|
||||
elseif gameRate==2 then gameRate=1
|
||||
elseif gameRate==5 then gameRate=2
|
||||
end
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _rep0()
|
||||
scene.widgetList[1].hide=true
|
||||
scene.widgetList[7].hide=false
|
||||
gameRate=0
|
||||
_updateRepButtons()
|
||||
scene.widgetList[1].hide=true
|
||||
scene.widgetList[7].hide=false
|
||||
gameRate=0
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _repP8()
|
||||
scene.widgetList[2].hide=true
|
||||
gameRate=.125
|
||||
_updateRepButtons()
|
||||
scene.widgetList[2].hide=true
|
||||
gameRate=.125
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _repP2()
|
||||
scene.widgetList[3].hide=true
|
||||
gameRate=.5
|
||||
_updateRepButtons()
|
||||
scene.widgetList[3].hide=true
|
||||
gameRate=.5
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _rep1()
|
||||
scene.widgetList[4].hide=true
|
||||
gameRate=1
|
||||
_updateRepButtons()
|
||||
scene.widgetList[4].hide=true
|
||||
gameRate=1
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _rep2()
|
||||
scene.widgetList[5].hide=true
|
||||
gameRate=2
|
||||
_updateRepButtons()
|
||||
scene.widgetList[5].hide=true
|
||||
gameRate=2
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _rep5()
|
||||
scene.widgetList[6].hide=true
|
||||
gameRate=5
|
||||
_updateRepButtons()
|
||||
scene.widgetList[6].hide=true
|
||||
gameRate=5
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _step()floatGameRate=floatGameRate+1 end
|
||||
|
||||
local function _restart()
|
||||
resetGameData(PLAYERS[1].frameRun<240 and'q')
|
||||
noKey=replaying
|
||||
noTouch=replaying
|
||||
tasMode=false
|
||||
floatGameRate,gameRate=0,1
|
||||
_updateRepButtons()
|
||||
resetGameData(PLAYERS[1].frameRun<240 and'q')
|
||||
noKey=replaying
|
||||
noTouch=replaying
|
||||
tasMode=false
|
||||
floatGameRate,gameRate=0,1
|
||||
_updateRepButtons()
|
||||
end
|
||||
local function _checkGameKeyDown(key)
|
||||
local k=keyMap.keyboard[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
if noKey then return end
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
return
|
||||
elseif not GAME.fromRepMenu then
|
||||
_restart()
|
||||
return
|
||||
end
|
||||
end
|
||||
return true--No key pressed
|
||||
local k=keyMap.keyboard[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
if noKey then return end
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
return
|
||||
elseif not GAME.fromRepMenu then
|
||||
_restart()
|
||||
return
|
||||
end
|
||||
end
|
||||
return true--No key pressed
|
||||
end
|
||||
|
||||
function scene.sceneInit(org)
|
||||
if GAME.init then
|
||||
resetGameData()
|
||||
GAME.init=false
|
||||
end
|
||||
if GAME.init then
|
||||
resetGameData()
|
||||
GAME.init=false
|
||||
end
|
||||
|
||||
tasMode=GAME.tasUsed
|
||||
replaying=GAME.replaying
|
||||
noKey=replaying
|
||||
noTouch=not SETTING.VKSwitch or replaying
|
||||
tasMode=GAME.tasUsed
|
||||
replaying=GAME.replaying
|
||||
noKey=replaying
|
||||
noTouch=not SETTING.VKSwitch or replaying
|
||||
|
||||
if org~='depause'and org~='pause'then
|
||||
floatGameRate,gameRate=0,1
|
||||
elseif not replaying then
|
||||
if tasMode then
|
||||
floatGameRate,gameRate=0,0
|
||||
else
|
||||
floatGameRate,gameRate=0,1
|
||||
end
|
||||
end
|
||||
if org~='depause'and org~='pause'then
|
||||
floatGameRate,gameRate=0,1
|
||||
elseif not replaying then
|
||||
if tasMode then
|
||||
floatGameRate,gameRate=0,0
|
||||
else
|
||||
floatGameRate,gameRate=0,1
|
||||
end
|
||||
end
|
||||
|
||||
_updateRepButtons()
|
||||
_updateMenuButtons()
|
||||
_updateRepButtons()
|
||||
_updateMenuButtons()
|
||||
end
|
||||
|
||||
scene.mouseDown=NULL
|
||||
function scene.touchDown(x,y)
|
||||
if noTouch then return end
|
||||
if noTouch then return end
|
||||
|
||||
local t=VK.on(x,y)
|
||||
if t then
|
||||
PLAYERS[1]:pressKey(t)
|
||||
VK.touch(t,x,y)
|
||||
end
|
||||
local t=VK.on(x,y)
|
||||
if t then
|
||||
PLAYERS[1]:pressKey(t)
|
||||
VK.touch(t,x,y)
|
||||
end
|
||||
end
|
||||
function scene.touchUp(x,y)
|
||||
if noTouch then return end
|
||||
if noTouch then return end
|
||||
|
||||
local n=VK.on(x,y)
|
||||
if n then
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
local n=VK.on(x,y)
|
||||
if n then
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
end
|
||||
function scene.touchMove()
|
||||
if noTouch or touchMoveLastFrame then return end
|
||||
touchMoveLastFrame=true
|
||||
if noTouch or touchMoveLastFrame then return end
|
||||
touchMoveLastFrame=true
|
||||
|
||||
local L=tc.getTouches()
|
||||
for i=#L,1,-1 do
|
||||
L[2*i-1],L[2*i]=SCR.xOy:inverseTransformPoint(tc.getPosition(L[i]))
|
||||
end
|
||||
local keys=VK.keys
|
||||
for n=1,#keys do
|
||||
local B=keys[n]
|
||||
if B.ava then
|
||||
for i=1,#L,2 do
|
||||
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
||||
goto CONTINUE_nextKey
|
||||
end
|
||||
end
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
::CONTINUE_nextKey::
|
||||
end
|
||||
local L=tc.getTouches()
|
||||
for i=#L,1,-1 do
|
||||
L[2*i-1],L[2*i]=SCR.xOy:inverseTransformPoint(tc.getPosition(L[i]))
|
||||
end
|
||||
local keys=VK.keys
|
||||
for n=1,#keys do
|
||||
local B=keys[n]
|
||||
if B.ava then
|
||||
for i=1,#L,2 do
|
||||
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
||||
goto CONTINUE_nextKey
|
||||
end
|
||||
end
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
::CONTINUE_nextKey::
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if replaying then
|
||||
if key=="space"then
|
||||
if not isRep then gameRate=gameRate==0 and 1 or 0 end
|
||||
_updateRepButtons()
|
||||
elseif key=="left"then
|
||||
if not isRep then
|
||||
_speedDown()
|
||||
end
|
||||
elseif key=="right"then
|
||||
if gameRate==0 then
|
||||
_step()
|
||||
elseif not isRep then
|
||||
_speedUp()
|
||||
end
|
||||
elseif key=="escape"then
|
||||
pauseGame()
|
||||
end
|
||||
else
|
||||
if isRep then
|
||||
return
|
||||
elseif _checkGameKeyDown(key)then
|
||||
if tasMode then
|
||||
if key=="f1"then
|
||||
if not isRep then gameRate=gameRate==0 and .125 or 0 end
|
||||
_updateRepButtons()
|
||||
elseif key=='f2'then
|
||||
if not isRep then
|
||||
_speedDown()
|
||||
end
|
||||
elseif key=='f3'then
|
||||
if gameRate==0 then
|
||||
_step()
|
||||
elseif not isRep then
|
||||
_speedUp()
|
||||
end
|
||||
end
|
||||
end
|
||||
if key=="escape"then
|
||||
pauseGame()
|
||||
end
|
||||
end
|
||||
end
|
||||
if replaying then
|
||||
if key=="space"then
|
||||
if not isRep then gameRate=gameRate==0 and 1 or 0 end
|
||||
_updateRepButtons()
|
||||
elseif key=="left"then
|
||||
if not isRep then
|
||||
_speedDown()
|
||||
end
|
||||
elseif key=="right"then
|
||||
if gameRate==0 then
|
||||
_step()
|
||||
elseif not isRep then
|
||||
_speedUp()
|
||||
end
|
||||
elseif key=="escape"then
|
||||
pauseGame()
|
||||
end
|
||||
else
|
||||
if isRep then
|
||||
return
|
||||
elseif _checkGameKeyDown(key)then
|
||||
if tasMode then
|
||||
if key=="f1"then
|
||||
if not isRep then gameRate=gameRate==0 and .125 or 0 end
|
||||
_updateRepButtons()
|
||||
elseif key=='f2'then
|
||||
if not isRep then
|
||||
_speedDown()
|
||||
end
|
||||
elseif key=='f3'then
|
||||
if gameRate==0 then
|
||||
_step()
|
||||
elseif not isRep then
|
||||
_speedUp()
|
||||
end
|
||||
end
|
||||
end
|
||||
if key=="escape"then
|
||||
pauseGame()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyUp(key)
|
||||
if noKey then return end
|
||||
local k=keyMap.keyboard[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
end
|
||||
if noKey then return end
|
||||
local k=keyMap.keyboard[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.gamepadDown(key)
|
||||
if noKey then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
else
|
||||
_restart()
|
||||
end
|
||||
elseif key=="back"then
|
||||
pauseGame()
|
||||
end
|
||||
if noKey then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
else
|
||||
_restart()
|
||||
end
|
||||
elseif key=="back"then
|
||||
pauseGame()
|
||||
end
|
||||
end
|
||||
function scene.gamepadUp(key)
|
||||
if noKey then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
end
|
||||
if noKey then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k then
|
||||
if k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function _update_replay(repPtr)
|
||||
local P1=PLAYERS[1]
|
||||
local L=GAME.rep
|
||||
while P1.frameRun==L[repPtr]do
|
||||
local key=L[repPtr+1]
|
||||
if key==0 then--Just wait
|
||||
elseif key<=32 then--Press key
|
||||
P1:pressKey(key)
|
||||
VK.press(key)
|
||||
elseif key<=64 then--Release key
|
||||
P1:releaseKey(key-32)
|
||||
VK.release(key-32)
|
||||
end
|
||||
repPtr=repPtr+2
|
||||
end
|
||||
GAME.replaying=repPtr
|
||||
local P1=PLAYERS[1]
|
||||
local L=GAME.rep
|
||||
while P1.frameRun==L[repPtr]do
|
||||
local key=L[repPtr+1]
|
||||
if key==0 then--Just wait
|
||||
elseif key<=32 then--Press key
|
||||
P1:pressKey(key)
|
||||
VK.press(key)
|
||||
elseif key<=64 then--Release key
|
||||
P1:releaseKey(key-32)
|
||||
VK.release(key-32)
|
||||
end
|
||||
repPtr=repPtr+2
|
||||
end
|
||||
GAME.replaying=repPtr
|
||||
end
|
||||
local function _update_common(dt)
|
||||
--Update control
|
||||
touchMoveLastFrame=false
|
||||
VK.update()
|
||||
--Update control
|
||||
touchMoveLastFrame=false
|
||||
VK.update()
|
||||
|
||||
--Update players
|
||||
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||
--Update players
|
||||
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||
|
||||
--Fresh royale target
|
||||
if GAME.modeEnv.royaleMode and PLAYERS[1].frameRun%120==0 then
|
||||
freshMostDangerous()
|
||||
end
|
||||
--Fresh royale target
|
||||
if GAME.modeEnv.royaleMode and PLAYERS[1].frameRun%120==0 then
|
||||
freshMostDangerous()
|
||||
end
|
||||
|
||||
--Warning check
|
||||
checkWarning()
|
||||
--Warning check
|
||||
checkWarning()
|
||||
end
|
||||
function scene.update(dt)
|
||||
floatGameRate=floatGameRate+gameRate
|
||||
while floatGameRate>=1 do
|
||||
floatGameRate=floatGameRate-1
|
||||
if GAME.replaying then _update_replay(GAME.replaying)end
|
||||
_update_common(dt)
|
||||
end
|
||||
floatGameRate=floatGameRate+gameRate
|
||||
while floatGameRate>=1 do
|
||||
floatGameRate=floatGameRate-1
|
||||
if GAME.replaying then _update_replay(GAME.replaying)end
|
||||
_update_common(dt)
|
||||
end
|
||||
end
|
||||
|
||||
local tasText=gc.newText(getFont(100),"TAS")
|
||||
local function _drawAtkPointer(x,y)
|
||||
local t=TIME()
|
||||
local a=t*3%1*.8
|
||||
t=sin(t*20)
|
||||
local t=TIME()
|
||||
local a=t*3%1*.8
|
||||
t=sin(t*20)
|
||||
|
||||
gc.setColor(.2,.7+t*.2,1,.6+t*.4)
|
||||
gc.circle('fill',x,y,25,6)
|
||||
gc.setColor(.2,.7+t*.2,1,.6+t*.4)
|
||||
gc.circle('fill',x,y,25,6)
|
||||
|
||||
gc.setColor(0,.6,1,.8-a)
|
||||
gc.circle('line',x,y,30*(1+a),6)
|
||||
gc.setColor(0,.6,1,.8-a)
|
||||
gc.circle('line',x,y,30*(1+a),6)
|
||||
end
|
||||
function scene.draw()
|
||||
if tasMode then
|
||||
gc.push('transform')
|
||||
gc.scale(4)
|
||||
setFont(100)
|
||||
gc.setColor(.4,.4,.4,.5)
|
||||
gc.draw(tasText,72,20)
|
||||
gc.pop()
|
||||
end
|
||||
if tasMode then
|
||||
gc.push('transform')
|
||||
gc.scale(4)
|
||||
setFont(100)
|
||||
gc.setColor(.4,.4,.4,.5)
|
||||
gc.draw(tasText,72,20)
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
local repMode=GAME.replaying or tasMode
|
||||
local repMode=GAME.replaying or tasMode
|
||||
|
||||
--Players
|
||||
for p=1,#PLAYERS do
|
||||
PLAYERS[p]:draw(repMode)
|
||||
end
|
||||
--Players
|
||||
for p=1,#PLAYERS do
|
||||
PLAYERS[p]:draw(repMode)
|
||||
end
|
||||
|
||||
--Virtual keys
|
||||
VK.draw()
|
||||
--Virtual keys
|
||||
VK.draw()
|
||||
|
||||
--Attacking & Being attacked
|
||||
if GAME.modeEnv.royaleMode then
|
||||
local P=PLAYERS[1]
|
||||
gc.setLineWidth(5)
|
||||
gc.setColor(.8,1,0,.2)
|
||||
for i=1,#P.atker do
|
||||
local p=P.atker[i]
|
||||
gc.line(p.centerX,p.centerY,P.x+300*P.size,P.y+620*P.size)
|
||||
end
|
||||
if P.atkMode~=4 then
|
||||
if P.atking then
|
||||
_drawAtkPointer(P.atking.centerX,P.atking.centerY)
|
||||
end
|
||||
else
|
||||
for i=1,#P.atker do
|
||||
local p=P.atker[i]
|
||||
_drawAtkPointer(p.centerX,p.centerY)
|
||||
end
|
||||
end
|
||||
end
|
||||
--Attacking & Being attacked
|
||||
if GAME.modeEnv.royaleMode then
|
||||
local P=PLAYERS[1]
|
||||
gc.setLineWidth(5)
|
||||
gc.setColor(.8,1,0,.2)
|
||||
for i=1,#P.atker do
|
||||
local p=P.atker[i]
|
||||
gc.line(p.centerX,p.centerY,P.x+300*P.size,P.y+620*P.size)
|
||||
end
|
||||
if P.atkMode~=4 then
|
||||
if P.atking then
|
||||
_drawAtkPointer(P.atking.centerX,P.atking.centerY)
|
||||
end
|
||||
else
|
||||
for i=1,#P.atker do
|
||||
local p=P.atker[i]
|
||||
_drawAtkPointer(p.centerX,p.centerY)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Mode info
|
||||
gc.setColor(1,1,1,.8)
|
||||
gc.draw(drawableText.modeName,modeTextPos,10)
|
||||
--Mode info
|
||||
gc.setColor(1,1,1,.8)
|
||||
gc.draw(drawableText.modeName,modeTextPos,10)
|
||||
|
||||
--Replaying
|
||||
if replaying or tasMode then
|
||||
setFont(20)
|
||||
gc.setColor(1,1,TIME()%.8>.4 and 1 or 0)
|
||||
mStr(text[replaying and'replaying'or'tasUsing'],770,6)
|
||||
gc.setColor(1,1,1,.8)
|
||||
mStr(("%s %sf"):format(repRateStrings[gameRate],PLAYERS[1].frameRun),770,31)
|
||||
end
|
||||
--Replaying
|
||||
if replaying or tasMode then
|
||||
setFont(20)
|
||||
gc.setColor(1,1,TIME()%.8>.4 and 1 or 0)
|
||||
mStr(text[replaying and'replaying'or'tasUsing'],770,6)
|
||||
gc.setColor(1,1,1,.8)
|
||||
mStr(("%s %sf"):format(repRateStrings[gameRate],PLAYERS[1].frameRun),770,31)
|
||||
end
|
||||
|
||||
--Warning
|
||||
drawWarning()
|
||||
--Warning
|
||||
drawWarning()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="rep0", x=40,y=50,w=60,code=_rep0,fText=TEXTURE.rep.rep0},
|
||||
WIDGET.newKey{name="repP8", x=105,y=50,w=60,code=_repP8,fText=TEXTURE.rep.repP8},
|
||||
WIDGET.newKey{name="repP2", x=170,y=50,w=60,code=_repP2,fText=TEXTURE.rep.repP2},
|
||||
WIDGET.newKey{name="rep1", x=235,y=50,w=60,code=_rep1,fText=TEXTURE.rep.rep1},
|
||||
WIDGET.newKey{name="rep2", x=300,y=50,w=60,code=_rep2,fText=TEXTURE.rep.rep2},
|
||||
WIDGET.newKey{name="rep5", x=365,y=50,w=60,code=_rep5,fText=TEXTURE.rep.rep5},
|
||||
WIDGET.newKey{name="step", x=430,y=50,w=60,code=_step,fText=TEXTURE.rep.step},
|
||||
WIDGET.newKey{name="restart", x=0,y=45,w=60,code=_restart,fText=TEXTURE.game.restart},
|
||||
WIDGET.newKey{name="pause", x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause},
|
||||
WIDGET.newKey{name="rep0", x=40,y=50,w=60,code=_rep0,fText=TEXTURE.rep.rep0},
|
||||
WIDGET.newKey{name="repP8", x=105,y=50,w=60,code=_repP8,fText=TEXTURE.rep.repP8},
|
||||
WIDGET.newKey{name="repP2", x=170,y=50,w=60,code=_repP2,fText=TEXTURE.rep.repP2},
|
||||
WIDGET.newKey{name="rep1", x=235,y=50,w=60,code=_rep1,fText=TEXTURE.rep.rep1},
|
||||
WIDGET.newKey{name="rep2", x=300,y=50,w=60,code=_rep2,fText=TEXTURE.rep.rep2},
|
||||
WIDGET.newKey{name="rep5", x=365,y=50,w=60,code=_rep5,fText=TEXTURE.rep.rep5},
|
||||
WIDGET.newKey{name="step", x=430,y=50,w=60,code=_step,fText=TEXTURE.rep.step},
|
||||
WIDGET.newKey{name="restart",x=0,y=45,w=60,code=_restart,fText=TEXTURE.game.restart},
|
||||
WIDGET.newKey{name="pause", x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,30 +1,30 @@
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('cubes')
|
||||
WIDGET.active.texts:setTexts(STRING.split(require"parts.updateLog","\n"))
|
||||
BG.set('cubes')
|
||||
WIDGET.active.texts:setTexts(STRING.split(require"parts.updateLog","\n"))
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
WHEELMOV(y)
|
||||
WHEELMOV(y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
if key=="up"then
|
||||
WIDGET.active.texts:scroll(-5)
|
||||
elseif key=="down"then
|
||||
WIDGET.active.texts:scroll(5)
|
||||
elseif key=="pageup"then
|
||||
WIDGET.active.texts:scroll(-20)
|
||||
elseif key=="pagedown"then
|
||||
WIDGET.active.texts:scroll(20)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if key=="up"then
|
||||
WIDGET.active.texts:scroll(-5)
|
||||
elseif key=="down"then
|
||||
WIDGET.active.texts:scroll(5)
|
||||
elseif key=="pageup"then
|
||||
WIDGET.active.texts:scroll(-20)
|
||||
elseif key=="pagedown"then
|
||||
WIDGET.active.texts:scroll(20)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newTextBox{name="texts",x=30,y=45,w=1000,h=640,font=20,fix=true},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newTextBox{name="texts",x=30,y=45,w=1000,h=640,font=20,fix=true},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,37 +1,37 @@
|
||||
local langList={
|
||||
"中文",
|
||||
"全中文",
|
||||
"就这?",
|
||||
"English",
|
||||
"Français",
|
||||
"Español",
|
||||
"Português",
|
||||
"?????",
|
||||
"中文",
|
||||
"全中文",
|
||||
"就这?",
|
||||
"English",
|
||||
"Français",
|
||||
"Español",
|
||||
"Português",
|
||||
"?????",
|
||||
}
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneBack()
|
||||
saveSettings()
|
||||
saveSettings()
|
||||
end
|
||||
|
||||
local function _setLang(n)
|
||||
SETTING.lang=n
|
||||
LANG.set(n)
|
||||
TEXT.clear()
|
||||
TEXT.show(langList[n],640,500,100,'appear',.626)
|
||||
collectgarbage()
|
||||
SETTING.lang=n
|
||||
LANG.set(n)
|
||||
TEXT.clear()
|
||||
TEXT.show(langList[n],640,500,100,'appear',.626)
|
||||
collectgarbage()
|
||||
end
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{x=200,y=100,w=200,h=120,fText=langList[1],color='R',font=35,code=function()_setLang(1)end},
|
||||
WIDGET.newButton{x=420,y=100,w=200,h=120,fText=langList[2],color='dR',font=35,code=function()_setLang(2)end},
|
||||
WIDGET.newButton{x=640,y=100,w=200,h=120,fText=langList[3],color='D',font=35,code=function()_setLang(3)end},
|
||||
WIDGET.newButton{x=860,y=100,w=200,h=120,fText=langList[4],color='N',font=35,code=function()_setLang(4)end},
|
||||
WIDGET.newButton{x=1080,y=100,w=200,h=120,fText=langList[5],color='lW',font=35,code=function()_setLang(5)end},
|
||||
WIDGET.newButton{x=200,y=250,w=200,h=120,fText=langList[6],color='O',font=35,code=function()_setLang(6)end},
|
||||
WIDGET.newButton{x=420,y=250,w=200,h=120,fText=langList[7],color='Y',font=35,code=function()_setLang(7)end},
|
||||
WIDGET.newButton{x=640,y=250,w=200,h=120,fText=langList[8],color='dH',font=35,code=function()_setLang(8)end},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{x=200,y=100,w=200,h=120,fText=langList[1],color='R',font=35,code=function()_setLang(1)end},
|
||||
WIDGET.newButton{x=420,y=100,w=200,h=120,fText=langList[2],color='dR',font=35,code=function()_setLang(2)end},
|
||||
WIDGET.newButton{x=640,y=100,w=200,h=120,fText=langList[3],color='D',font=35,code=function()_setLang(3)end},
|
||||
WIDGET.newButton{x=860,y=100,w=200,h=120,fText=langList[4],color='N',font=35,code=function()_setLang(4)end},
|
||||
WIDGET.newButton{x=1080,y=100,w=200,h=120,fText=langList[5],color='lW',font=35,code=function()_setLang(5)end},
|
||||
WIDGET.newButton{x=200,y=250,w=200,h=120,fText=langList[6],color='O',font=35,code=function()_setLang(6)end},
|
||||
WIDGET.newButton{x=420,y=250,w=200,h=120,fText=langList[7],color='Y',font=35,code=function()_setLang(7)end},
|
||||
WIDGET.newButton{x=640,y=250,w=200,h=120,fText=langList[8],color='dH',font=35,code=function()_setLang(8)end},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -12,211 +12,211 @@ local studioLogo--Studio logo text object
|
||||
local logoColor1,logoColor2
|
||||
|
||||
local loadingThread=coroutine.wrap(function()
|
||||
DAILYLAUNCH=freshDate'q'
|
||||
if DAILYLAUNCH then
|
||||
logoColor1=COLOR.S
|
||||
logoColor2=COLOR.lS
|
||||
else
|
||||
local r=math.random()*6.2832
|
||||
logoColor1={COLOR.rainbow(r)}
|
||||
logoColor2={COLOR.rainbow_light(r)}
|
||||
end
|
||||
YIELD()
|
||||
YIELD('loadSFX')SFX.loadAll()
|
||||
YIELD('loadVoice')VOC.loadAll()
|
||||
YIELD('loadFont')for i=1,17 do getFont(15+5*i)end
|
||||
DAILYLAUNCH=freshDate'q'
|
||||
if DAILYLAUNCH then
|
||||
logoColor1=COLOR.S
|
||||
logoColor2=COLOR.lS
|
||||
else
|
||||
local r=math.random()*6.2832
|
||||
logoColor1={COLOR.rainbow(r)}
|
||||
logoColor2={COLOR.rainbow_light(r)}
|
||||
end
|
||||
YIELD()
|
||||
YIELD('loadSFX')SFX.loadAll()
|
||||
YIELD('loadVoice')VOC.loadAll()
|
||||
YIELD('loadFont')for i=1,17 do getFont(15+5*i)end
|
||||
|
||||
YIELD('loadModeIcon')
|
||||
local modeIcons={}
|
||||
modeIcons.marathon=GC.DO{32,32,
|
||||
{'move',3,1},
|
||||
{'fRect',10,4,-2,23},
|
||||
{'fPoly',10,4,24,10,10,16.5},
|
||||
{'fRect',4,24,10,3},
|
||||
}
|
||||
modeIcons.infinite=GC.DO{64,64,
|
||||
{'setLW',4},
|
||||
{'dCirc',32,32,28},
|
||||
{'line',32,32,32,14},
|
||||
{'line',32,32,41,41},
|
||||
{'move',.5,.5},
|
||||
{'fRect',30,7,4,4},
|
||||
{'fRect',7,30,4,4},
|
||||
{'fRect',52,30,4,4},
|
||||
{'fRect',30,52,4,4},
|
||||
}
|
||||
modeIcons.classic=GC.DO{64,64,
|
||||
{'setLW',6},
|
||||
{'dRect',10,24,12,12},
|
||||
{'dRect',26,24,12,12},
|
||||
{'dRect',42,24,12,12},
|
||||
{'dRect',26,40,12,12},
|
||||
}
|
||||
modeIcons.tsd=GC.DO{64,64,
|
||||
{'fRect',7,7,16,16},
|
||||
{'fRect',7,41,16,16},
|
||||
{'fRect',41,41,16,16},
|
||||
{'move',.5,.5},
|
||||
{'setLW',1},
|
||||
{'dPoly',7,24,56,24,56,39,39,39,39,56,24,56,24,39,7,39},
|
||||
}
|
||||
modeIcons.t49=GC.DO{64,64,
|
||||
{'setLW',2},
|
||||
{'dRect',05,05,10,20},{'dRect',49,05,10,20},
|
||||
{'dRect',05,39,10,20},{'dRect',49,39,10,20},
|
||||
{'dRect',20,10,23,43},
|
||||
{'setCL',1,1,1,.7},
|
||||
{'fRect',20,10,23,43},
|
||||
}
|
||||
modeIcons.t99=GC.DO{64,64,
|
||||
{'setLW',2},
|
||||
{'dRect',02,02,6,12},{'dRect',11,02,6,12},
|
||||
{'dRect',02,18,6,12},{'dRect',11,18,6,12},
|
||||
{'dRect',02,34,6,12},{'dRect',11,34,6,12},
|
||||
{'dRect',02,50,6,12},{'dRect',11,50,6,12},
|
||||
{'dRect',47,02,6,12},{'dRect',56,02,6,12},
|
||||
{'dRect',47,18,6,12},{'dRect',56,18,6,12},
|
||||
{'dRect',47,34,6,12},{'dRect',56,34,6,12},
|
||||
{'dRect',47,50,6,12},{'dRect',56,50,6,12},
|
||||
{'dRect',20,10,23,43},
|
||||
{'setCL',1,1,1,.7},
|
||||
{'fRect',20,10,23,43},
|
||||
}
|
||||
YIELD('loadModeIcon')
|
||||
local modeIcons={}
|
||||
modeIcons.marathon=GC.DO{32,32,
|
||||
{'move',3,1},
|
||||
{'fRect',10,4,-2,23},
|
||||
{'fPoly',10,4,24,10,10,16.5},
|
||||
{'fRect',4,24,10,3},
|
||||
}
|
||||
modeIcons.infinite=GC.DO{64,64,
|
||||
{'setLW',4},
|
||||
{'dCirc',32,32,28},
|
||||
{'line',32,32,32,14},
|
||||
{'line',32,32,41,41},
|
||||
{'move',.5,.5},
|
||||
{'fRect',30,7,4,4},
|
||||
{'fRect',7,30,4,4},
|
||||
{'fRect',52,30,4,4},
|
||||
{'fRect',30,52,4,4},
|
||||
}
|
||||
modeIcons.classic=GC.DO{64,64,
|
||||
{'setLW',6},
|
||||
{'dRect',10,24,12,12},
|
||||
{'dRect',26,24,12,12},
|
||||
{'dRect',42,24,12,12},
|
||||
{'dRect',26,40,12,12},
|
||||
}
|
||||
modeIcons.tsd=GC.DO{64,64,
|
||||
{'fRect',7,7,16,16},
|
||||
{'fRect',7,41,16,16},
|
||||
{'fRect',41,41,16,16},
|
||||
{'move',.5,.5},
|
||||
{'setLW',1},
|
||||
{'dPoly',7,24,56,24,56,39,39,39,39,56,24,56,24,39,7,39},
|
||||
}
|
||||
modeIcons.t49=GC.DO{64,64,
|
||||
{'setLW',2},
|
||||
{'dRect',05,05,10,20},{'dRect',49,05,10,20},
|
||||
{'dRect',05,39,10,20},{'dRect',49,39,10,20},
|
||||
{'dRect',20,10,23,43},
|
||||
{'setCL',1,1,1,.7},
|
||||
{'fRect',20,10,23,43},
|
||||
}
|
||||
modeIcons.t99=GC.DO{64,64,
|
||||
{'setLW',2},
|
||||
{'dRect',02,02,6,12},{'dRect',11,02,6,12},
|
||||
{'dRect',02,18,6,12},{'dRect',11,18,6,12},
|
||||
{'dRect',02,34,6,12},{'dRect',11,34,6,12},
|
||||
{'dRect',02,50,6,12},{'dRect',11,50,6,12},
|
||||
{'dRect',47,02,6,12},{'dRect',56,02,6,12},
|
||||
{'dRect',47,18,6,12},{'dRect',56,18,6,12},
|
||||
{'dRect',47,34,6,12},{'dRect',56,34,6,12},
|
||||
{'dRect',47,50,6,12},{'dRect',56,50,6,12},
|
||||
{'dRect',20,10,23,43},
|
||||
{'setCL',1,1,1,.7},
|
||||
{'fRect',20,10,23,43},
|
||||
}
|
||||
|
||||
YIELD('loadMode')
|
||||
for _,M in next,MODES do
|
||||
M.records=FILE.load("record/"..M.name..".rec")or M.score and{}
|
||||
if M.icon then
|
||||
if not modeIcons[M.icon]then
|
||||
modeIcons[M.icon]=gc.newImage("media/image/modeicon/"..M.icon..".png")
|
||||
end
|
||||
M.icon=modeIcons[M.icon]
|
||||
end
|
||||
end
|
||||
if not MODES[STAT.lastPlay]then
|
||||
STAT.lastPlay='sprint_10l'
|
||||
end
|
||||
local editFlag
|
||||
for name,rank in next,RANKS do
|
||||
local M=MODES[name]
|
||||
if type(rank)~='number'then
|
||||
RANKS[name]=nil
|
||||
editFlag=true
|
||||
elseif M and M.unlock and rank>0 then
|
||||
for _,unlockName in next,M.unlock do
|
||||
if not RANKS[unlockName]then
|
||||
RANKS[unlockName]=0
|
||||
editFlag=true
|
||||
end
|
||||
end
|
||||
end
|
||||
if not(M and M.x)then
|
||||
RANKS[name]=nil
|
||||
editFlag=true
|
||||
end
|
||||
end
|
||||
if editFlag then
|
||||
saveProgress()
|
||||
end
|
||||
YIELD('loadMode')
|
||||
for _,M in next,MODES do
|
||||
M.records=FILE.load("record/"..M.name..".rec")or M.score and{}
|
||||
if M.icon then
|
||||
if not modeIcons[M.icon]then
|
||||
modeIcons[M.icon]=gc.newImage("media/image/modeicon/"..M.icon..".png")
|
||||
end
|
||||
M.icon=modeIcons[M.icon]
|
||||
end
|
||||
end
|
||||
if not MODES[STAT.lastPlay]then
|
||||
STAT.lastPlay='sprint_10l'
|
||||
end
|
||||
local editFlag
|
||||
for name,rank in next,RANKS do
|
||||
local M=MODES[name]
|
||||
if type(rank)~='number'then
|
||||
RANKS[name]=nil
|
||||
editFlag=true
|
||||
elseif M and M.unlock and rank>0 then
|
||||
for _,unlockName in next,M.unlock do
|
||||
if not RANKS[unlockName]then
|
||||
RANKS[unlockName]=0
|
||||
editFlag=true
|
||||
end
|
||||
end
|
||||
end
|
||||
if not(M and M.x)then
|
||||
RANKS[name]=nil
|
||||
editFlag=true
|
||||
end
|
||||
end
|
||||
if editFlag then
|
||||
saveProgress()
|
||||
end
|
||||
|
||||
YIELD('loadOther')
|
||||
STAT.run=STAT.run+1
|
||||
YIELD('loadOther')
|
||||
STAT.run=STAT.run+1
|
||||
|
||||
--Connect to server
|
||||
NET.wsconn_app()
|
||||
--Connect to server
|
||||
NET.wsconn_app()
|
||||
|
||||
SFX.play('enter',.8)
|
||||
SFX.play('welcome_sfx')
|
||||
VOC.play('welcome_voc')
|
||||
THEME.fresh()
|
||||
LOADED=true
|
||||
return'finish'
|
||||
SFX.play('enter',.8)
|
||||
SFX.play('welcome_sfx')
|
||||
VOC.play('welcome_voc')
|
||||
THEME.fresh()
|
||||
LOADED=true
|
||||
return'finish'
|
||||
end)
|
||||
|
||||
function scene.sceneInit()
|
||||
studioLogo=gc.newText(getFont(90),"26F Studio")
|
||||
progress=0
|
||||
maxProgress=10
|
||||
t1,t2=0,0--Timer
|
||||
animeType={}for i=1,8 do animeType[i]=rnd(5)end--Random animation type
|
||||
studioLogo=gc.newText(getFont(90),"26F Studio")
|
||||
progress=0
|
||||
maxProgress=10
|
||||
t1,t2=0,0--Timer
|
||||
animeType={}for i=1,8 do animeType[i]=rnd(5)end--Random animation type
|
||||
end
|
||||
function scene.sceneBack()
|
||||
love.event.quit()
|
||||
love.event.quit()
|
||||
end
|
||||
|
||||
function scene.mouseDown()
|
||||
if LOADED then
|
||||
if FIRSTLAUNCH then
|
||||
SCN.push('main')
|
||||
SCN.swapTo('lang')
|
||||
else
|
||||
SCN.swapTo(SETTING.simpMode and'main_simple'or'main')
|
||||
end
|
||||
end
|
||||
if LOADED then
|
||||
if FIRSTLAUNCH then
|
||||
SCN.push('main')
|
||||
SCN.swapTo('lang')
|
||||
else
|
||||
SCN.swapTo(SETTING.simpMode and'main_simple'or'main')
|
||||
end
|
||||
end
|
||||
end
|
||||
scene.touchDown=scene.mouseDown
|
||||
function scene.keyDown(key)
|
||||
if key=="escape"then
|
||||
love.event.quit()
|
||||
else
|
||||
scene.mouseDown()
|
||||
end
|
||||
if key=="escape"then
|
||||
love.event.quit()
|
||||
else
|
||||
scene.mouseDown()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if not LOADED then
|
||||
loading=loadingThread()
|
||||
progress=progress+1
|
||||
else
|
||||
t1,t2=t1+1,t2+1
|
||||
end
|
||||
if not LOADED then
|
||||
loading=loadingThread()
|
||||
progress=progress+1
|
||||
else
|
||||
t1,t2=t1+1,t2+1
|
||||
end
|
||||
end
|
||||
|
||||
local titleTransform={
|
||||
function(t)gc.translate(0,max(50-t,0)^2/25)end,
|
||||
function(t)gc.translate(0,-max(50-t,0)^2/25)end,
|
||||
function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)end,
|
||||
function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)end,
|
||||
function(t)gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)end,
|
||||
function(t)gc.translate(0,max(50-t,0)^2/25)end,
|
||||
function(t)gc.translate(0,-max(50-t,0)^2/25)end,
|
||||
function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)end,
|
||||
function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)end,
|
||||
function(t)gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)end,
|
||||
}
|
||||
local titleColor={COLOR.lP,COLOR.lC,COLOR.lB,COLOR.lO,COLOR.lF,COLOR.lM,COLOR.lG,COLOR.lY}
|
||||
function scene.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
gc.clear(.08,.08,.084)
|
||||
|
||||
local T=(t1+110)%300
|
||||
if T<30 then
|
||||
gc.setLineWidth(4+(30-T)^1.626/62)
|
||||
else
|
||||
gc.setLineWidth(4)
|
||||
end
|
||||
local L=title
|
||||
gc.push('transform')
|
||||
gc.translate(126,100)
|
||||
for i=1,8 do
|
||||
local t=t1-i*15
|
||||
if t>0 then
|
||||
gc.push('transform')
|
||||
titleTransform[animeType[i]](t,i)
|
||||
local dt=(t1+62-5*i)%300
|
||||
if dt<20 then
|
||||
gc.translate(0,math.abs(10-dt)-10)
|
||||
end
|
||||
gc.setColor(titleColor[i][1],titleColor[i][2],titleColor[i][3],min(t*.025,1)*.16)
|
||||
gc.polygon('fill',L[i])
|
||||
gc.setColor(1,1,1,min(t*.025,1))
|
||||
gc.polygon('line',L[i])
|
||||
gc.pop()
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
local T=(t1+110)%300
|
||||
if T<30 then
|
||||
gc.setLineWidth(4+(30-T)^1.626/62)
|
||||
else
|
||||
gc.setLineWidth(4)
|
||||
end
|
||||
local L=title
|
||||
gc.push('transform')
|
||||
gc.translate(126,100)
|
||||
for i=1,8 do
|
||||
local t=t1-i*15
|
||||
if t>0 then
|
||||
gc.push('transform')
|
||||
titleTransform[animeType[i]](t,i)
|
||||
local dt=(t1+62-5*i)%300
|
||||
if dt<20 then
|
||||
gc.translate(0,math.abs(10-dt)-10)
|
||||
end
|
||||
gc.setColor(titleColor[i][1],titleColor[i][2],titleColor[i][3],min(t*.025,1)*.16)
|
||||
gc.polygon('fill',L[i])
|
||||
gc.setColor(1,1,1,min(t*.025,1))
|
||||
gc.polygon('line',L[i])
|
||||
gc.pop()
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
|
||||
gc.setColor(logoColor1[1],logoColor1[2],logoColor1[3],progress/maxProgress)mDraw(studioLogo,640,400)
|
||||
gc.setColor(logoColor2[1],logoColor2[2],logoColor2[3],progress/maxProgress)for dx=-2,2,2 do for dy=-2,2,2 do mDraw(studioLogo,640+dx,400+dy)end end
|
||||
gc.setColor(.2,.2,.2,progress/maxProgress)mDraw(studioLogo,640,400)
|
||||
gc.setColor(logoColor1[1],logoColor1[2],logoColor1[3],progress/maxProgress)mDraw(studioLogo,640,400)
|
||||
gc.setColor(logoColor2[1],logoColor2[2],logoColor2[3],progress/maxProgress)for dx=-2,2,2 do for dy=-2,2,2 do mDraw(studioLogo,640+dx,400+dy)end end
|
||||
gc.setColor(.2,.2,.2,progress/maxProgress)mDraw(studioLogo,640,400)
|
||||
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(30)
|
||||
mStr(text.loadText[loading]or"",640,530)
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(30)
|
||||
mStr(text.loadText[loading]or"",640,530)
|
||||
end
|
||||
|
||||
return scene
|
||||
@@ -4,39 +4,39 @@ local passwordBox=WIDGET.newInputBox{name="password",x=380,y=300,w=620,h=60,secr
|
||||
local savePW=false
|
||||
|
||||
local function _login()
|
||||
local email,password=emailBox:getText(),passwordBox:getText()
|
||||
if not STRING.simpEmailCheck(email)then
|
||||
MES.new('error',text.wrongEmail)return
|
||||
elseif #password==0 then
|
||||
MES.new('error',text.noPassword)return
|
||||
end
|
||||
NET.wsconn_user_pswd(email,password)
|
||||
if savePW then
|
||||
FILE.save({email,password},'conf/account')
|
||||
else
|
||||
love.filesystem.remove('conf/account')
|
||||
end
|
||||
local email,password=emailBox:getText(),passwordBox:getText()
|
||||
if not STRING.simpEmailCheck(email)then
|
||||
MES.new('error',text.wrongEmail)return
|
||||
elseif #password==0 then
|
||||
MES.new('error',text.noPassword)return
|
||||
end
|
||||
NET.wsconn_user_pswd(email,password)
|
||||
if savePW then
|
||||
FILE.save({email,password},'conf/account')
|
||||
else
|
||||
love.filesystem.remove('conf/account')
|
||||
end
|
||||
end
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
local data=FILE.load('conf/account')
|
||||
if data then
|
||||
savePW=true
|
||||
emailBox:setText(data[1])
|
||||
passwordBox:setText(data[2])
|
||||
end
|
||||
local data=FILE.load('conf/account')
|
||||
if data then
|
||||
savePW=true
|
||||
emailBox:setText(data[1])
|
||||
passwordBox:setText(data[2])
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name="register", x=1140, y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('register','swipeR')end},
|
||||
emailBox,
|
||||
passwordBox,
|
||||
WIDGET.newSwitch{name="keepPW", x=900,y=420,disp=function()return savePW end,code=function()savePW=not savePW end},
|
||||
WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=_login},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name="register",x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('register','swipeR')end},
|
||||
emailBox,
|
||||
passwordBox,
|
||||
WIDGET.newSwitch{name="keepPW", x=900, y=420,disp=function()return savePW end,code=function()savePW=not savePW end},
|
||||
WIDGET.newKey{name="login", x=1140,y=540,w=170,h=80,font=40,code=_login},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -9,196 +9,196 @@ local tip=gc.newText(getFont(30),"")
|
||||
local scrollX--Tip scroll position
|
||||
|
||||
local widgetX0={
|
||||
-10,-10,-10,-10,
|
||||
1290,1290,1290,1290,
|
||||
-10,-10,-10,-10,
|
||||
1290,1290,1290,1290,
|
||||
}
|
||||
local enterConsole=coroutine.wrap(function()
|
||||
while true do
|
||||
SFX.play('ren_'..math.random(5,6))YIELD()
|
||||
SFX.play('ren_'..math.random(7,8))YIELD()
|
||||
SFX.play('ren_'..math.random(9,10))YIELD()
|
||||
SFX.play('ren_9')SFX.play('ren_11')SFX.play('ren_mega')
|
||||
SCN.go('app_console')
|
||||
YIELD()
|
||||
end
|
||||
while true do
|
||||
SFX.play('ren_'..math.random(5,6))YIELD()
|
||||
SFX.play('ren_'..math.random(7,8))YIELD()
|
||||
SFX.play('ren_'..math.random(9,10))YIELD()
|
||||
SFX.play('ren_9')SFX.play('ren_11')SFX.play('ren_mega')
|
||||
SCN.go('app_console')
|
||||
YIELD()
|
||||
end
|
||||
end)
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
lastQuitTime=-1e99
|
||||
BG.set()
|
||||
lastQuitTime=-1e99
|
||||
|
||||
--Set tip
|
||||
tip:set(text.getTip())
|
||||
scrollX=tipLength
|
||||
--Set tip
|
||||
tip:set(text.getTip())
|
||||
scrollX=tipLength
|
||||
|
||||
--Set quick-play-button text
|
||||
scene.widgetList[2]:setObject(text.WidgetText.main.qplay..": "..text.modes[STAT.lastPlay][1])
|
||||
--Set quick-play-button text
|
||||
scene.widgetList[2]:setObject(text.WidgetText.main.qplay..": "..text.modes[STAT.lastPlay][1])
|
||||
|
||||
--Create demo player
|
||||
destroyPlayers()
|
||||
GAME.modeEnv=NONE
|
||||
GAME.seed=math.random(2e6)
|
||||
PLY.newDemoPlayer(1)
|
||||
PLAYERS[1]:setPosition(520,140,.8)
|
||||
--Create demo player
|
||||
destroyPlayers()
|
||||
GAME.modeEnv=NONE
|
||||
GAME.seed=math.random(2e6)
|
||||
PLY.newDemoPlayer(1)
|
||||
PLAYERS[1]:setPosition(520,140,.8)
|
||||
end
|
||||
|
||||
function scene.mouseDown(x,y)
|
||||
if x>=400 and x<=880 and y>=10 and y<=110 then
|
||||
enterConsole()
|
||||
end
|
||||
if x>=400 and x<=880 and y>=10 and y<=110 then
|
||||
enterConsole()
|
||||
end
|
||||
end
|
||||
scene.touchDown=scene.mouseDown
|
||||
local function _testButton(n)
|
||||
if NET.getlock('access_and_login')then
|
||||
MES.new('warn',text.wsConnecting)
|
||||
else
|
||||
if WIDGET.isFocus(scene.widgetList[n])then
|
||||
return true
|
||||
else
|
||||
WIDGET.focus(scene.widgetList[n])
|
||||
end
|
||||
end
|
||||
if NET.getlock('access_and_login')then
|
||||
MES.new('warn',text.wsConnecting)
|
||||
else
|
||||
if WIDGET.isFocus(scene.widgetList[n])then
|
||||
return true
|
||||
else
|
||||
WIDGET.focus(scene.widgetList[n])
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="1"then
|
||||
if _testButton(1)then
|
||||
SCN.go('mode')
|
||||
end
|
||||
elseif key=="q"then
|
||||
if _testButton(2)then
|
||||
loadGame(STAT.lastPlay,true)
|
||||
end
|
||||
elseif key=="a"then
|
||||
if _testButton(3)then
|
||||
if WS.status('app')=='running'then
|
||||
NET.tryLogin(false)
|
||||
elseif WS.status('app')=='dead'then
|
||||
NET.wsconn_app()
|
||||
SFX.play('connect')
|
||||
MES.new('info',text.wsConnecting)
|
||||
end
|
||||
end
|
||||
elseif key=="z"then
|
||||
if _testButton(4)then
|
||||
SCN.go('customGame')
|
||||
end
|
||||
elseif key=="-"then
|
||||
if _testButton(5)then
|
||||
SCN.go('setting_game')
|
||||
end
|
||||
elseif key=="p"then
|
||||
if _testButton(6)then
|
||||
SCN.go('stat')
|
||||
end
|
||||
elseif key=="l"then
|
||||
if _testButton(7)then
|
||||
SCN.go('dict')
|
||||
end
|
||||
elseif key==","then
|
||||
if _testButton(8)then
|
||||
SCN.go('replays')
|
||||
end
|
||||
elseif key=="2"then
|
||||
if _testButton(9)then
|
||||
SCN.go('music')
|
||||
end
|
||||
elseif key=="3"then
|
||||
if _testButton(10)then
|
||||
SCN.go('lang')
|
||||
end
|
||||
elseif key=="x"then
|
||||
if _testButton(11)then
|
||||
SCN.go('about')
|
||||
end
|
||||
elseif key=="m"then
|
||||
if _testButton(12)then
|
||||
SCN.go('manual')
|
||||
end
|
||||
elseif key=="c"then
|
||||
enterConsole()
|
||||
elseif key=="escape"then
|
||||
if TIME()-lastQuitTime<1 then
|
||||
VOC.play('bye')
|
||||
SCN.swapTo('quit','slowFade')
|
||||
else
|
||||
lastQuitTime=TIME()
|
||||
MES.new('warn',text.sureQuit)
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="1"then
|
||||
if _testButton(1)then
|
||||
SCN.go('mode')
|
||||
end
|
||||
elseif key=="q"then
|
||||
if _testButton(2)then
|
||||
loadGame(STAT.lastPlay,true)
|
||||
end
|
||||
elseif key=="a"then
|
||||
if _testButton(3)then
|
||||
if WS.status('app')=='running'then
|
||||
NET.tryLogin(false)
|
||||
elseif WS.status('app')=='dead'then
|
||||
NET.wsconn_app()
|
||||
SFX.play('connect')
|
||||
MES.new('info',text.wsConnecting)
|
||||
end
|
||||
end
|
||||
elseif key=="z"then
|
||||
if _testButton(4)then
|
||||
SCN.go('customGame')
|
||||
end
|
||||
elseif key=="-"then
|
||||
if _testButton(5)then
|
||||
SCN.go('setting_game')
|
||||
end
|
||||
elseif key=="p"then
|
||||
if _testButton(6)then
|
||||
SCN.go('stat')
|
||||
end
|
||||
elseif key=="l"then
|
||||
if _testButton(7)then
|
||||
SCN.go('dict')
|
||||
end
|
||||
elseif key==","then
|
||||
if _testButton(8)then
|
||||
SCN.go('replays')
|
||||
end
|
||||
elseif key=="2"then
|
||||
if _testButton(9)then
|
||||
SCN.go('music')
|
||||
end
|
||||
elseif key=="3"then
|
||||
if _testButton(10)then
|
||||
SCN.go('lang')
|
||||
end
|
||||
elseif key=="x"then
|
||||
if _testButton(11)then
|
||||
SCN.go('about')
|
||||
end
|
||||
elseif key=="m"then
|
||||
if _testButton(12)then
|
||||
SCN.go('manual')
|
||||
end
|
||||
elseif key=="c"then
|
||||
enterConsole()
|
||||
elseif key=="escape"then
|
||||
if TIME()-lastQuitTime<1 then
|
||||
VOC.play('bye')
|
||||
SCN.swapTo('quit','slowFade')
|
||||
else
|
||||
lastQuitTime=TIME()
|
||||
MES.new('warn',text.sureQuit)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
PLAYERS[1]:update(dt)
|
||||
scrollX=scrollX-2.6
|
||||
if scrollX<-tip:getWidth()then
|
||||
scrollX=tipLength
|
||||
tip:set(text.getTip())
|
||||
end
|
||||
local L=scene.widgetList
|
||||
for i=1,8 do
|
||||
L[i].x=L[i].x*.9+(widgetX0[i]-400+(WIDGET.isFocus(L[i])and(i<5 and 100 or -100)or 0))*.1
|
||||
end
|
||||
PLAYERS[1]:update(dt)
|
||||
scrollX=scrollX-2.6
|
||||
if scrollX<-tip:getWidth()then
|
||||
scrollX=tipLength
|
||||
tip:set(text.getTip())
|
||||
end
|
||||
local L=scene.widgetList
|
||||
for i=1,8 do
|
||||
L[i].x=L[i].x*.9+(widgetX0[i]-400+(WIDGET.isFocus(L[i])and(i<5 and 100 or -100)or 0))*.1
|
||||
end
|
||||
end
|
||||
|
||||
local function _tipStencil()
|
||||
gc.rectangle('fill',0,0,tipLength,42)
|
||||
gc.rectangle('fill',0,0,tipLength,42)
|
||||
end
|
||||
function scene.draw()
|
||||
--Version
|
||||
setFont(20)
|
||||
gc.setColor(.6,.6,.6)
|
||||
mStr(verName,640,110)
|
||||
--Version
|
||||
setFont(20)
|
||||
gc.setColor(.6,.6,.6)
|
||||
mStr(verName,640,110)
|
||||
|
||||
--Title
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(TEXTURE.title_color,640,60,nil,.43)
|
||||
--Title
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(TEXTURE.title_color,640,60,nil,.43)
|
||||
|
||||
--Tip
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.push('transform')
|
||||
gc.translate(260,650)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',0,0,tipLength,42,3)
|
||||
gc.stencil(_tipStencil)
|
||||
gc.setStencilTest('equal',1)
|
||||
gc.draw(tip,0+scrollX,0)
|
||||
gc.setColor(1,1,1,.2)
|
||||
gc.setStencilTest()
|
||||
gc.pop()
|
||||
--Tip
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.push('transform')
|
||||
gc.translate(260,650)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',0,0,tipLength,42,3)
|
||||
gc.stencil(_tipStencil)
|
||||
gc.setStencilTest('equal',1)
|
||||
gc.draw(tip,0+scrollX,0)
|
||||
gc.setColor(1,1,1,.2)
|
||||
gc.setStencilTest()
|
||||
gc.pop()
|
||||
|
||||
--Player
|
||||
PLAYERS[1]:draw()
|
||||
--Player
|
||||
PLAYERS[1]:draw()
|
||||
|
||||
--Profile
|
||||
drawSelfProfile()
|
||||
--Profile
|
||||
drawSelfProfile()
|
||||
|
||||
--Player count
|
||||
drawOnlinePlayerCount()
|
||||
--Player count
|
||||
drawOnlinePlayerCount()
|
||||
|
||||
--Connecting mark
|
||||
if NET.getlock('access_and_login')then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(10)
|
||||
local t=TIME()*6.26%6.2832
|
||||
gc.arc('line','open',scene.widgetList[3].x+865,450,40,t,t+4.26)
|
||||
end
|
||||
--Connecting mark
|
||||
if NET.getlock('access_and_login')then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(10)
|
||||
local t=TIME()*6.26%6.2832
|
||||
gc.arc('line','open',scene.widgetList[3].x+865,450,40,t,t+4.26)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="offline",x=-1200,y=210,w=800,h=100, color='lR',font=45,align='R',edge=30,code=pressKey"1"},
|
||||
WIDGET.newButton{name="qplay", x=-1200,y=330,w=800,h=100, color='lM',font=40,align='R',edge=30,code=pressKey"q"},
|
||||
WIDGET.newButton{name="online", x=-1200,y=450,w=800,h=100, color='lV',font=45,align='R',edge=30,code=pressKey"a"},
|
||||
WIDGET.newButton{name="custom", x=-1200,y=570,w=800,h=100, color='lS',font=45,align='R',edge=30,code=pressKey"z"},
|
||||
WIDGET.newButton{name="offline",x=-1200,y=210,w=800,h=100,color='lR',font=45,align='R',edge=30,code=pressKey"1"},
|
||||
WIDGET.newButton{name="qplay", x=-1200,y=330,w=800,h=100,color='lM',font=40,align='R',edge=30,code=pressKey"q"},
|
||||
WIDGET.newButton{name="online", x=-1200,y=450,w=800,h=100,color='lV',font=45,align='R',edge=30,code=pressKey"a"},
|
||||
WIDGET.newButton{name="custom", x=-1200,y=570,w=800,h=100,color='lS',font=45,align='R',edge=30,code=pressKey"z"},
|
||||
|
||||
WIDGET.newButton{name="setting",x=2480,y=210,w=800,h=100, color='lO',font=40,align='L',edge=30,code=pressKey"-"},
|
||||
WIDGET.newButton{name="stat", x=2480,y=330,w=800,h=100, color='lL',font=40,align='L',edge=30,code=pressKey"p"},
|
||||
WIDGET.newButton{name="dict", x=2480,y=450,w=800,h=100, color='lG',font=40,align='L',edge=30,code=pressKey"l"},
|
||||
WIDGET.newButton{name="replays",x=2480,y=570,w=800,h=100, color='lC',font=40,align='L',edge=30,code=pressKey","},
|
||||
WIDGET.newButton{name="setting",x=2480,y=210,w=800,h=100, color='lO',font=40,align='L',edge=30,code=pressKey"-"},
|
||||
WIDGET.newButton{name="stat", x=2480,y=330,w=800,h=100, color='lL',font=40,align='L',edge=30,code=pressKey"p"},
|
||||
WIDGET.newButton{name="dict", x=2480,y=450,w=800,h=100, color='lG',font=40,align='L',edge=30,code=pressKey"l"},
|
||||
WIDGET.newButton{name="replays",x=2480,y=570,w=800,h=100, color='lC',font=40,align='L',edge=30,code=pressKey","},
|
||||
|
||||
WIDGET.newButton{name="music", x=120,y=80,w=100, color='lO',code=pressKey"2",fText=TEXTURE.music},
|
||||
WIDGET.newButton{name="lang", x=280,y=80,w=100, color='lN',code=pressKey"3",fText=TEXTURE.language},
|
||||
WIDGET.newButton{name="about", x=-110,y=670,w=600,h=70, color='lB',align='R',edge=30,code=pressKey"x",fText=TEXTURE.info},
|
||||
WIDGET.newButton{name="manual", x=1390,y=670,w=600,h=70, color='lR',align='L',edge=30,code=pressKey"m",fText=TEXTURE.question},
|
||||
WIDGET.newButton{name="music", x=120,y=80,w=100, color='lO',code=pressKey"2",fText=TEXTURE.music},
|
||||
WIDGET.newButton{name="lang", x=280,y=80,w=100, color='lN',code=pressKey"3",fText=TEXTURE.language},
|
||||
WIDGET.newButton{name="about", x=-110,y=670,w=600,h=70, color='lB',align='R',edge=30,code=pressKey"x",fText=TEXTURE.info},
|
||||
WIDGET.newButton{name="manual", x=1390,y=670,w=600,h=70, color='lR',align='L',edge=30,code=pressKey"m",fText=TEXTURE.question},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -5,25 +5,25 @@ local scene={}
|
||||
local tip=gc.newText(getFont(30),"")
|
||||
|
||||
function scene.sceneInit()
|
||||
tip:set(text.getTip())
|
||||
BG.set()
|
||||
tip:set(text.getTip())
|
||||
BG.set()
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(TEXTURE.title_color,640,160)
|
||||
mDraw(tip,640,660)
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(TEXTURE.title_color,640,160)
|
||||
mDraw(tip,640,660)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="system", x=750,y=280,color='Z',align='L',fText=SYSTEM},
|
||||
WIDGET.newText{name="version", x=950,y=280,color='Z',align='L',fText=VERSION.string},
|
||||
WIDGET.newButton{name="sprint", x=260,y=480,w=260,font=50,code=function()loadGame('sprint_40l',true)end},
|
||||
WIDGET.newButton{name="marathon",x=640,y=480,w=260,font=50,code=function()loadGame('marathon_n',true)end},
|
||||
WIDGET.newButton{name="setting",x=1000,y=400,w=120,fText=TEXTURE.setting,code=goScene'setting_game'},
|
||||
WIDGET.newButton{name="lang", x=1000,y=560,w=120,fText=TEXTURE.language,code=goScene'lang'},
|
||||
WIDGET.newButton{name="manual", x=1160,y=400,w=120,fText=TEXTURE.sure,code=goScene'manual'},
|
||||
WIDGET.newButton{name="quit", x=1160,y=560,w=120,fText=TEXTURE.quit,code=function()VOC.play('bye')SCN.swapTo('quit','slowFade')end},
|
||||
WIDGET.newText{name="system", x=750,y=280,color='Z',align='L',fText=SYSTEM},
|
||||
WIDGET.newText{name="version", x=950,y=280,color='Z',align='L',fText=VERSION.string},
|
||||
WIDGET.newButton{name="sprint", x=260,y=480,w=260,font=50,code=function()loadGame('sprint_40l',true)end},
|
||||
WIDGET.newButton{name="marathon",x=640,y=480,w=260,font=50,code=function()loadGame('marathon_n',true)end},
|
||||
WIDGET.newButton{name="setting", x=1000,y=400,w=120,fText=TEXTURE.setting,code=goScene'setting_game'},
|
||||
WIDGET.newButton{name="lang", x=1000,y=560,w=120,fText=TEXTURE.language,code=goScene'lang'},
|
||||
WIDGET.newButton{name="manual", x=1160,y=400,w=120,fText=TEXTURE.sure,code=goScene'manual'},
|
||||
WIDGET.newButton{name="quit", x=1160,y=560,w=120,fText=TEXTURE.quit,code=function()VOC.play('bye')SCN.swapTo('quit','slowFade')end},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,30 +1,30 @@
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('cubes')
|
||||
WIDGET.active.texts:setTexts(require("parts.language.manual_"..({'zh','zh','zh','en','en','en','en','en'})[SETTING.lang]))
|
||||
BG.set('cubes')
|
||||
WIDGET.active.texts:setTexts(require("parts.language.manual_"..({'zh','zh','zh','en','en','en','en','en'})[SETTING.lang]))
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
WHEELMOV(y)
|
||||
WHEELMOV(y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
if key=="up"then
|
||||
WIDGET.active.texts:scroll(-5)
|
||||
elseif key=="down"then
|
||||
WIDGET.active.texts:scroll(5)
|
||||
elseif key=="pageup"then
|
||||
WIDGET.active.texts:scroll(-20)
|
||||
elseif key=="pagedown"then
|
||||
WIDGET.active.texts:scroll(20)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if key=="up"then
|
||||
WIDGET.active.texts:scroll(-5)
|
||||
elseif key=="down"then
|
||||
WIDGET.active.texts:scroll(5)
|
||||
elseif key=="pageup"then
|
||||
WIDGET.active.texts:scroll(-20)
|
||||
elseif key=="pagedown"then
|
||||
WIDGET.active.texts:scroll(20)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newTextBox{name="texts",x=30,y=45,w=1000,h=640,font=15,fix=true},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newTextBox{name="texts",x=30,y=45,w=1000,h=640,font=15,fix=true},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,36 +3,36 @@ local kb=love.keyboard
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local function _modComp(a,b)
|
||||
return a.no<b.no
|
||||
return a.no<b.no
|
||||
end
|
||||
local function _remMod(M)
|
||||
local i=TABLE.find(GAME.mod,M)
|
||||
if i then rem(GAME.mod,i)end
|
||||
local i=TABLE.find(GAME.mod,M)
|
||||
if i then rem(GAME.mod,i)end
|
||||
end
|
||||
local function _toggleMod(M,back)
|
||||
if M.sel==0 then
|
||||
ins(GAME.mod,M)
|
||||
table.sort(GAME.mod,_modComp)
|
||||
end
|
||||
if M.list then
|
||||
if back then
|
||||
M.sel=(M.sel-1)%(#M.list+1)
|
||||
else
|
||||
M.sel=(M.sel+1)%(#M.list+1)
|
||||
end
|
||||
else
|
||||
M.sel=1-M.sel
|
||||
end
|
||||
if M.sel==0 then
|
||||
_remMod(M)
|
||||
end
|
||||
if M.unranked then
|
||||
SFX.play('move',.6)
|
||||
SFX.play('lock')
|
||||
else
|
||||
SFX.play('move')
|
||||
SFX.play('lock',.6)
|
||||
end
|
||||
if M.sel==0 then
|
||||
ins(GAME.mod,M)
|
||||
table.sort(GAME.mod,_modComp)
|
||||
end
|
||||
if M.list then
|
||||
if back then
|
||||
M.sel=(M.sel-1)%(#M.list+1)
|
||||
else
|
||||
M.sel=(M.sel+1)%(#M.list+1)
|
||||
end
|
||||
else
|
||||
M.sel=1-M.sel
|
||||
end
|
||||
if M.sel==0 then
|
||||
_remMod(M)
|
||||
end
|
||||
if M.unranked then
|
||||
SFX.play('move',.6)
|
||||
SFX.play('lock')
|
||||
else
|
||||
SFX.play('move')
|
||||
SFX.play('lock',.6)
|
||||
end
|
||||
end
|
||||
|
||||
local scene={}
|
||||
@@ -40,120 +40,120 @@ local scene={}
|
||||
local selected--Mod selected
|
||||
|
||||
function scene.sceneInit()
|
||||
selected=false
|
||||
BG.set('tunnel')
|
||||
selected=false
|
||||
BG.set('tunnel')
|
||||
end
|
||||
|
||||
function scene.mouseMove(x,y)
|
||||
selected=false
|
||||
for _,M in next,MODOPT do
|
||||
if(x-M.x)^2+(y-M.y)^2<2000 then
|
||||
selected=M
|
||||
break
|
||||
end
|
||||
end
|
||||
selected=false
|
||||
for _,M in next,MODOPT do
|
||||
if(x-M.x)^2+(y-M.y)^2<2000 then
|
||||
selected=M
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.mouseDown(x,y,k)
|
||||
for _,M in next,MODOPT do
|
||||
if(x-M.x)^2+(y-M.y)^2<2000 then
|
||||
_toggleMod(M,k==2 or kb.isDown("lshift","rshift"))
|
||||
break
|
||||
end
|
||||
end
|
||||
for _,M in next,MODOPT do
|
||||
if(x-M.x)^2+(y-M.y)^2<2000 then
|
||||
_toggleMod(M,k==2 or kb.isDown("lshift","rshift"))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.touchMove(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
scene.mouseMove(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
if key=="tab"or key=="delete"then
|
||||
if GAME.mod[1]then
|
||||
while GAME.mod[1]do
|
||||
rem(GAME.mod).sel=0
|
||||
end
|
||||
SFX.play('hold')
|
||||
end
|
||||
elseif #key==1 then
|
||||
for _,M in next,MODOPT do
|
||||
if key==M.key then
|
||||
_toggleMod(M,kb.isDown("lshift","rshift"))
|
||||
selected=M
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if key=="tab"or key=="delete"then
|
||||
if GAME.mod[1]then
|
||||
while GAME.mod[1]do
|
||||
rem(GAME.mod).sel=0
|
||||
end
|
||||
SFX.play('hold')
|
||||
end
|
||||
elseif #key==1 then
|
||||
for _,M in next,MODOPT do
|
||||
if key==M.key then
|
||||
_toggleMod(M,kb.isDown("lshift","rshift"))
|
||||
selected=M
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel==0 then
|
||||
if M.time>0 then
|
||||
M.time=M.time-1
|
||||
end
|
||||
else
|
||||
if M.time<10 then
|
||||
M.time=M.time+1
|
||||
end
|
||||
end
|
||||
end
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel==0 then
|
||||
if M.time>0 then
|
||||
M.time=M.time-1
|
||||
end
|
||||
else
|
||||
if M.time<10 then
|
||||
M.time=M.time+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.draw()
|
||||
setFont(40)
|
||||
gc.setLineWidth(5)
|
||||
for _,M in next,MODOPT do
|
||||
gc.push('transform')
|
||||
gc.translate(M.x,M.y)
|
||||
local t=M.time*.01--t range:0~0.1
|
||||
gc.scale(1+3*t)
|
||||
gc.rotate(t)
|
||||
local rad,side
|
||||
if M.unranked then
|
||||
rad,side=45,5
|
||||
else
|
||||
rad=40
|
||||
end
|
||||
local color=M.color
|
||||
gc.setColor(color[1],color[2],color[3],5*t)
|
||||
gc.circle('fill',0,0,rad,side)
|
||||
setFont(40)
|
||||
gc.setLineWidth(5)
|
||||
for _,M in next,MODOPT do
|
||||
gc.push('transform')
|
||||
gc.translate(M.x,M.y)
|
||||
local t=M.time*.01--t range:0~0.1
|
||||
gc.scale(1+3*t)
|
||||
gc.rotate(t)
|
||||
local rad,side
|
||||
if M.unranked then
|
||||
rad,side=45,5
|
||||
else
|
||||
rad=40
|
||||
end
|
||||
local color=M.color
|
||||
gc.setColor(color[1],color[2],color[3],5*t)
|
||||
gc.circle('fill',0,0,rad,side)
|
||||
|
||||
gc.setColor(color)
|
||||
gc.circle('line',0,0,rad,side)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(M.id,0,-28)
|
||||
if M.sel>0 and M.list then
|
||||
setFont(25)
|
||||
gc.setColor(1,1,1,10*t)
|
||||
mStr(M.list[M.sel],20,8)
|
||||
setFont(40)
|
||||
end
|
||||
gc.setColor(color)
|
||||
gc.circle('line',0,0,rad,side)
|
||||
gc.setColor(COLOR.Z)
|
||||
mStr(M.id,0,-28)
|
||||
if M.sel>0 and M.list then
|
||||
setFont(25)
|
||||
gc.setColor(1,1,1,10*t)
|
||||
mStr(M.list[M.sel],20,8)
|
||||
setFont(40)
|
||||
end
|
||||
|
||||
if M.list then
|
||||
gc.setColor(1,1,1,t*6)
|
||||
gc.arc('line','open',0,0,rad+6,0,(M.sel/#M.list)*6.2832)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
if M.list then
|
||||
gc.setColor(1,1,1,t*6)
|
||||
gc.arc('line','open',0,0,rad+6,0,(M.sel/#M.list)*6.2832)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
gc.setColor(COLOR.Z)
|
||||
if selected then
|
||||
setFont(30)
|
||||
gc.printf(text.modInfo[selected.name],70,540,950)
|
||||
else
|
||||
setFont(25)
|
||||
gc.printf(text.modInstruction,70,540,950)
|
||||
end
|
||||
gc.setColor(COLOR.Z)
|
||||
if selected then
|
||||
setFont(30)
|
||||
gc.printf(text.modInfo[selected.name],70,540,950)
|
||||
else
|
||||
setFont(25)
|
||||
gc.printf(text.modInstruction,70,540,950)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
|
||||
WIDGET.newText{name="unranked", x=1200,y=60,color='Y',font=50,align='R',hideF=function()return scoreValid()end},
|
||||
WIDGET.newButton{name="reset", x=1140,y=540,w=170,h=80,font=25,code=pressKey"tab"},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
|
||||
WIDGET.newText{name="unranked",x=1200,y=60,color='Y',font=50,align='R',hideF=function()return scoreValid()end},
|
||||
WIDGET.newButton{name="reset", x=1140,y=540,w=170,h=80,font=25,code=pressKey"tab"},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -15,13 +15,13 @@ local int,abs=math.floor,math.abs
|
||||
local setFont=setFont
|
||||
|
||||
local mapCam={
|
||||
sel=false,--Selected mode ID
|
||||
xOy=mt.newTransform(0,0,0,1),--Transformation for map display
|
||||
keyCtrl=false,--If controlling with key
|
||||
sel=false,--Selected mode ID
|
||||
xOy=mt.newTransform(0,0,0,1),--Transformation for map display
|
||||
keyCtrl=false,--If controlling with key
|
||||
|
||||
--For auto zooming when enter/leave scene
|
||||
zoomMethod=false,
|
||||
zoomK=false,
|
||||
--For auto zooming when enter/leave scene
|
||||
zoomMethod=false,
|
||||
zoomK=false,
|
||||
}
|
||||
local visibleModes
|
||||
local touchDist
|
||||
@@ -29,310 +29,310 @@ local touchDist
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit(org)
|
||||
BG.set()
|
||||
mapCam.zoomK=org=='main'and 5 or 1
|
||||
visibleModes={}--1=unlocked, 2=locked but visible
|
||||
for name,M in next,MODES do
|
||||
if RANKS[name]and M.x then
|
||||
visibleModes[name]=1
|
||||
if M.unlock then
|
||||
for i=1,#M.unlock do
|
||||
visibleModes[M.unlock[i]]=visibleModes[M.unlock[i]]or 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
BG.set()
|
||||
mapCam.zoomK=org=='main'and 5 or 1
|
||||
visibleModes={}--1=unlocked, 2=locked but visible
|
||||
for name,M in next,MODES do
|
||||
if RANKS[name]and M.x then
|
||||
visibleModes[name]=1
|
||||
if M.unlock then
|
||||
for i=1,#M.unlock do
|
||||
visibleModes[M.unlock[i]]=visibleModes[M.unlock[i]]or 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function _getK()
|
||||
return abs(mapCam.xOy:transformPoint(1,0)-mapCam.xOy:transformPoint(0,0))
|
||||
return abs(mapCam.xOy:transformPoint(1,0)-mapCam.xOy:transformPoint(0,0))
|
||||
end
|
||||
local function _getPos()
|
||||
return mapCam.xOy:inverseTransformPoint(0,0)
|
||||
return mapCam.xOy:inverseTransformPoint(0,0)
|
||||
end
|
||||
|
||||
local function _onModeRaw(x,y)
|
||||
for name,M in next,MODES do
|
||||
if visibleModes[name]and M.x then
|
||||
local s=M.size
|
||||
if M.shape==1 then
|
||||
if x>M.x-s and x<M.x+s and y>M.y-s and y<M.y+s then return name end
|
||||
elseif M.shape==2 then
|
||||
if abs(x-M.x)+abs(y-M.y)<s+12 then return name end
|
||||
elseif M.shape==3 then
|
||||
if(x-M.x)^2+(y-M.y)^2<(s+6)^2 then return name end
|
||||
end
|
||||
end
|
||||
end
|
||||
for name,M in next,MODES do
|
||||
if visibleModes[name]and M.x then
|
||||
local s=M.size
|
||||
if M.shape==1 then
|
||||
if x>M.x-s and x<M.x+s and y>M.y-s and y<M.y+s then return name end
|
||||
elseif M.shape==2 then
|
||||
if abs(x-M.x)+abs(y-M.y)<s+12 then return name end
|
||||
elseif M.shape==3 then
|
||||
if(x-M.x)^2+(y-M.y)^2<(s+6)^2 then return name end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function _moveMap(dx,dy)
|
||||
local k=_getK()
|
||||
local x,y=_getPos()
|
||||
if x>1300 and dx<0 or x<-1500 and dx>0 then dx=0 end
|
||||
if y>420 and dy<0 or y<-1900 and dy>0 then dy=0 end
|
||||
mapCam.xOy:translate(dx/k,dy/k)
|
||||
local k=_getK()
|
||||
local x,y=_getPos()
|
||||
if x>1300 and dx<0 or x<-1500 and dx>0 then dx=0 end
|
||||
if y>420 and dy<0 or y<-1900 and dy>0 then dy=0 end
|
||||
mapCam.xOy:translate(dx/k,dy/k)
|
||||
end
|
||||
function scene.wheelMoved(_,dy)
|
||||
mapCam.keyCtrl=false
|
||||
local k=_getK()
|
||||
k=min(max(k+dy*.1,.3),1.6)/k
|
||||
mapCam.xOy:scale(k)
|
||||
mapCam.keyCtrl=false
|
||||
local k=_getK()
|
||||
k=min(max(k+dy*.1,.3),1.6)/k
|
||||
mapCam.xOy:scale(k)
|
||||
|
||||
local x,y=_getPos()
|
||||
mapCam.xOy:translate(x*(1-k),y*(1-k))
|
||||
local x,y=_getPos()
|
||||
mapCam.xOy:translate(x*(1-k),y*(1-k))
|
||||
end
|
||||
function scene.mouseMove(_,_,dx,dy)
|
||||
if ms.isDown(1)then
|
||||
_moveMap(dx,dy)
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
if ms.isDown(1)then
|
||||
_moveMap(dx,dy)
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
end
|
||||
function scene.mouseClick(x,y)
|
||||
local _=mapCam.sel
|
||||
if not _ or x<920 then
|
||||
x,y=x-640,y-360
|
||||
x,y=mapCam.xOy:inverseTransformPoint(x,y)
|
||||
local SEL=_onModeRaw(x,y)
|
||||
if _~=SEL then
|
||||
if SEL then
|
||||
mapCam.moving=true
|
||||
_=MODES[SEL]
|
||||
mapCam.sel=SEL
|
||||
SFX.play('click')
|
||||
else
|
||||
mapCam.sel=false
|
||||
end
|
||||
elseif _ then
|
||||
scene.keyDown("return")
|
||||
end
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
local _=mapCam.sel
|
||||
if not _ or x<920 then
|
||||
x,y=x-640,y-360
|
||||
x,y=mapCam.xOy:inverseTransformPoint(x,y)
|
||||
local SEL=_onModeRaw(x,y)
|
||||
if _~=SEL then
|
||||
if SEL then
|
||||
mapCam.moving=true
|
||||
_=MODES[SEL]
|
||||
mapCam.sel=SEL
|
||||
SFX.play('click')
|
||||
else
|
||||
mapCam.sel=false
|
||||
end
|
||||
elseif _ then
|
||||
scene.keyDown("return")
|
||||
end
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
end
|
||||
function scene.touchDown()
|
||||
touchDist=false
|
||||
touchDist=false
|
||||
end
|
||||
function scene.touchMove(x,y,dx,dy)
|
||||
local L=tc.getTouches()
|
||||
if not L[2]then
|
||||
_moveMap(dx,dy)
|
||||
elseif not L[3]then
|
||||
x,y=SCR.xOy:inverseTransformPoint(tc.getPosition(L[1]))
|
||||
dx,dy=SCR.xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!!
|
||||
local d=(x-dx)^2+(y-dy)^2
|
||||
if d>100 then
|
||||
d=d^.5
|
||||
if touchDist then
|
||||
scene.wheelMoved(nil,(d-touchDist)*.02)
|
||||
end
|
||||
touchDist=d
|
||||
end
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
local L=tc.getTouches()
|
||||
if not L[2]then
|
||||
_moveMap(dx,dy)
|
||||
elseif not L[3]then
|
||||
x,y=SCR.xOy:inverseTransformPoint(tc.getPosition(L[1]))
|
||||
dx,dy=SCR.xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!!
|
||||
local d=(x-dx)^2+(y-dy)^2
|
||||
if d>100 then
|
||||
d=d^.5
|
||||
if touchDist then
|
||||
scene.wheelMoved(nil,(d-touchDist)*.02)
|
||||
end
|
||||
touchDist=d
|
||||
end
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
end
|
||||
function scene.touchClick(x,y)
|
||||
scene.mouseClick(x,y)
|
||||
scene.mouseClick(x,y)
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="return"then
|
||||
if mapCam.sel then
|
||||
if visibleModes[mapCam.sel]==2 then
|
||||
MES.new('info',text.unlockHint)
|
||||
else
|
||||
mapCam.keyCtrl=false
|
||||
loadGame(mapCam.sel)
|
||||
end
|
||||
end
|
||||
elseif key=="f1"then
|
||||
SCN.go('mod')
|
||||
elseif key=="escape"then
|
||||
if mapCam.sel then
|
||||
mapCam.sel=false
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="return"then
|
||||
if mapCam.sel then
|
||||
if visibleModes[mapCam.sel]==2 then
|
||||
MES.new('info',text.unlockHint)
|
||||
else
|
||||
mapCam.keyCtrl=false
|
||||
loadGame(mapCam.sel)
|
||||
end
|
||||
end
|
||||
elseif key=="f1"then
|
||||
SCN.go('mod')
|
||||
elseif key=="escape"then
|
||||
if mapCam.sel then
|
||||
mapCam.sel=false
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
local dx,dy=0,0
|
||||
local F
|
||||
if not SCN.swapping then
|
||||
if kb.isDown("up", "w")then dy=dy+10 F=true end
|
||||
if kb.isDown("down","s")then dy=dy-10 F=true end
|
||||
if kb.isDown("left","a")then dx=dx+10 F=true end
|
||||
if kb.isDown("right","d")then dx=dx-10 F=true end
|
||||
local js1=joysticks[1]
|
||||
if js1 then
|
||||
local dir=js1:getAxis(1)
|
||||
if dir~="c"then
|
||||
if dir=="u"or dir=="ul"or dir=="ur"then dy=dy+10 F=true end
|
||||
if dir=="d"or dir=="dl"or dir=="dl"then dy=dy-10 F=true end
|
||||
if dir=="l"or dir=="ul"or dir=="dl"then dx=dx+10 F=true end
|
||||
if dir=="r"or dir=="ur"or dir=="dr"then dx=dx-10 F=true end
|
||||
end
|
||||
end
|
||||
end
|
||||
if F then
|
||||
mapCam.keyCtrl=true
|
||||
if kb.isDown("lctrl","rctrl","lalt","ralt")then
|
||||
scene.wheelMoved(nil,(dy-dx)*.026)
|
||||
else
|
||||
_moveMap(dx,dy)
|
||||
local x,y=_getPos()
|
||||
local SEL=_onModeRaw(x,y)
|
||||
if SEL and mapCam.sel~=SEL then
|
||||
mapCam.sel=SEL
|
||||
SFX.play('click')
|
||||
end
|
||||
end
|
||||
end
|
||||
local dx,dy=0,0
|
||||
local F
|
||||
if not SCN.swapping then
|
||||
if kb.isDown("up", "w")then dy=dy+10 F=true end
|
||||
if kb.isDown("down","s")then dy=dy-10 F=true end
|
||||
if kb.isDown("left","a")then dx=dx+10 F=true end
|
||||
if kb.isDown("right","d")then dx=dx-10 F=true end
|
||||
local js1=joysticks[1]
|
||||
if js1 then
|
||||
local dir=js1:getAxis(1)
|
||||
if dir~="c"then
|
||||
if dir=="u"or dir=="ul"or dir=="ur"then dy=dy+10 F=true end
|
||||
if dir=="d"or dir=="dl"or dir=="dl"then dy=dy-10 F=true end
|
||||
if dir=="l"or dir=="ul"or dir=="dl"then dx=dx+10 F=true end
|
||||
if dir=="r"or dir=="ur"or dir=="dr"then dx=dx-10 F=true end
|
||||
end
|
||||
end
|
||||
end
|
||||
if F then
|
||||
mapCam.keyCtrl=true
|
||||
if kb.isDown("lctrl","rctrl","lalt","ralt")then
|
||||
scene.wheelMoved(nil,(dy-dx)*.026)
|
||||
else
|
||||
_moveMap(dx,dy)
|
||||
local x,y=_getPos()
|
||||
local SEL=_onModeRaw(x,y)
|
||||
if SEL and mapCam.sel~=SEL then
|
||||
mapCam.sel=SEL
|
||||
SFX.play('click')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local _=SCN.stat.tar
|
||||
mapCam.zoomMethod=_=="game"and 1 or _=="mode"and 2
|
||||
if mapCam.zoomMethod==1 then
|
||||
_=mapCam.zoomK
|
||||
if _<.8 then _=_*1.05 end
|
||||
if _<1.1 then _=_*1.05 end
|
||||
mapCam.zoomK=_*1.05
|
||||
elseif mapCam.zoomMethod==2 then
|
||||
mapCam.zoomK=mapCam.zoomK^.9
|
||||
end
|
||||
local _=SCN.stat.tar
|
||||
mapCam.zoomMethod=_=="game"and 1 or _=="mode"and 2
|
||||
if mapCam.zoomMethod==1 then
|
||||
_=mapCam.zoomK
|
||||
if _<.8 then _=_*1.05 end
|
||||
if _<1.1 then _=_*1.05 end
|
||||
mapCam.zoomK=_*1.05
|
||||
elseif mapCam.zoomMethod==2 then
|
||||
mapCam.zoomK=mapCam.zoomK^.9
|
||||
end
|
||||
end
|
||||
|
||||
--noRank/D/C/B/A/S
|
||||
local baseRankColor={
|
||||
[0]={0,0,0,.3},
|
||||
{.4,.1,.1,.3},
|
||||
{.4,.35,.3,.3},
|
||||
{.6,.4,.2,.3},
|
||||
{.7,.75,.85,.3},
|
||||
{.85,.8,.3,.3},
|
||||
[0]={0,0,0,.3},
|
||||
{.4,.1,.1,.3},
|
||||
{.4,.35,.3,.3},
|
||||
{.6,.4,.2,.3},
|
||||
{.7,.75,.85,.3},
|
||||
{.85,.8,.3,.3},
|
||||
}
|
||||
local rankColor=rankColor
|
||||
local function _drawModeShape(M,S,drawType)
|
||||
if M.shape==1 then--Rectangle
|
||||
gc_rectangle(drawType,M.x-S,M.y-S,2*S,2*S)
|
||||
elseif M.shape==2 then--Diamond
|
||||
gc_circle(drawType,M.x,M.y,S+12,4)
|
||||
elseif M.shape==3 then--Octagon
|
||||
gc_circle(drawType,M.x,M.y,S+6,8)
|
||||
end
|
||||
if M.shape==1 then--Rectangle
|
||||
gc_rectangle(drawType,M.x-S,M.y-S,2*S,2*S)
|
||||
elseif M.shape==2 then--Diamond
|
||||
gc_circle(drawType,M.x,M.y,S+12,4)
|
||||
elseif M.shape==3 then--Octagon
|
||||
gc_circle(drawType,M.x,M.y,S+6,8)
|
||||
end
|
||||
end
|
||||
function scene.draw()
|
||||
local _
|
||||
gc_push('transform')
|
||||
gc_translate(640,360)
|
||||
gc_rotate((mapCam.zoomK^.6-1))
|
||||
gc_scale(mapCam.zoomK^.7)
|
||||
gc_applyTransform(mapCam.xOy);
|
||||
local _
|
||||
gc_push('transform')
|
||||
gc_translate(640,360)
|
||||
gc_rotate((mapCam.zoomK^.6-1))
|
||||
gc_scale(mapCam.zoomK^.7)
|
||||
gc_applyTransform(mapCam.xOy);
|
||||
|
||||
local R=RANKS
|
||||
local sel=mapCam.sel
|
||||
local R=RANKS
|
||||
local sel=mapCam.sel
|
||||
|
||||
--Lines connecting modes
|
||||
gc_setLineWidth(8)
|
||||
gc_setColor(1,1,1,.2)
|
||||
for name,M in next,MODES do
|
||||
if R[name]and M.unlock and M.x then
|
||||
for _=1,#M.unlock do
|
||||
local m=MODES[M.unlock[_]]
|
||||
gc_line(M.x,M.y,m.x,m.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
--Lines connecting modes
|
||||
gc_setLineWidth(8)
|
||||
gc_setColor(1,1,1,.2)
|
||||
for name,M in next,MODES do
|
||||
if R[name]and M.unlock and M.x then
|
||||
for _=1,#M.unlock do
|
||||
local m=MODES[M.unlock[_]]
|
||||
gc_line(M.x,M.y,m.x,m.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Modes
|
||||
setFont(80)
|
||||
gc_setLineWidth(4)
|
||||
for name,M in next,MODES do
|
||||
local unlocked=visibleModes[name]
|
||||
if unlocked then
|
||||
local rank=R[name]
|
||||
local S=M.size
|
||||
--Modes
|
||||
setFont(80)
|
||||
gc_setLineWidth(4)
|
||||
for name,M in next,MODES do
|
||||
local unlocked=visibleModes[name]
|
||||
if unlocked then
|
||||
local rank=R[name]
|
||||
local S=M.size
|
||||
|
||||
--Draw shapes on map
|
||||
if unlocked==1 then
|
||||
gc_setColor(baseRankColor[rank])
|
||||
_drawModeShape(M,S,'fill')
|
||||
end
|
||||
gc_setColor(1,1,sel==name and 0 or 1,unlocked==1 and .8 or .3)
|
||||
_drawModeShape(M,S,'line')
|
||||
--Draw shapes on map
|
||||
if unlocked==1 then
|
||||
gc_setColor(baseRankColor[rank])
|
||||
_drawModeShape(M,S,'fill')
|
||||
end
|
||||
gc_setColor(1,1,sel==name and 0 or 1,unlocked==1 and .8 or .3)
|
||||
_drawModeShape(M,S,'line')
|
||||
|
||||
--Icon
|
||||
local icon=M.icon
|
||||
if icon then
|
||||
gc_setColor(unlocked==1 and COLOR.lH or COLOR.dH)
|
||||
local length=icon:getWidth()*.5
|
||||
gc_draw(icon,M.x,M.y,nil,S/length,nil,length,length)
|
||||
end
|
||||
--Icon
|
||||
local icon=M.icon
|
||||
if icon then
|
||||
gc_setColor(unlocked==1 and COLOR.lH or COLOR.dH)
|
||||
local length=icon:getWidth()*.5
|
||||
gc_draw(icon,M.x,M.y,nil,S/length,nil,length,length)
|
||||
end
|
||||
|
||||
--Rank
|
||||
if unlocked==1 then
|
||||
name=text.ranks[rank]
|
||||
if name then
|
||||
gc_setColor(0,0,0,.8)
|
||||
mStr(name,M.x+M.size*.7,M.y-50-M.size*.7)
|
||||
gc_setColor(rankColor[rank])
|
||||
mStr(name,M.x+M.size*.7+4,M.y-50-M.size*.7-4)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
gc_pop()
|
||||
--Rank
|
||||
if unlocked==1 then
|
||||
name=text.ranks[rank]
|
||||
if name then
|
||||
gc_setColor(0,0,0,.8)
|
||||
mStr(name,M.x+M.size*.7,M.y-50-M.size*.7)
|
||||
gc_setColor(rankColor[rank])
|
||||
mStr(name,M.x+M.size*.7+4,M.y-50-M.size*.7-4)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
gc_pop()
|
||||
|
||||
--Score board
|
||||
if sel then
|
||||
local M=MODES[sel]
|
||||
gc_setColor(.5,.5,.5,.8)
|
||||
gc_rectangle('fill',920,0,360,720,5)--Info board
|
||||
gc_setColor(M.color)
|
||||
setFont(40)mStr(text.modes[sel][1],1100,5)
|
||||
setFont(30)mStr(text.modes[sel][2],1100,50)
|
||||
gc_setColor(1,1,1)
|
||||
setFont(25)gc_printf(text.modes[sel][3],920,110,360,'center')
|
||||
if M.slowMark then
|
||||
gc_draw(IMG.ctrlSpeedLimit,1230,50,nil,.4)
|
||||
end
|
||||
if M.score then
|
||||
mText(drawableText.highScore,1100,240)
|
||||
gc_setColor(.3,.3,.3,.7)
|
||||
gc_rectangle('fill',940,290,320,280,5)--Highscore board
|
||||
local L=M.records
|
||||
gc_setColor(1,1,1)
|
||||
if visibleModes[sel]==2 then
|
||||
mText(drawableText.modeLocked,1100,370)
|
||||
elseif L[1]then
|
||||
for i=1,#L do
|
||||
local t=M.scoreDisp(L[i])
|
||||
local f=int((30-#t*.4)/5)*5
|
||||
setFont(f)
|
||||
gc_print(t,955,275+25*i+17-f*.7)
|
||||
_=L[i].date
|
||||
if _ then
|
||||
setFont(10)
|
||||
gc_print(_,1155,285+25*i)
|
||||
end
|
||||
end
|
||||
else
|
||||
mText(drawableText.noScore,1100,370)
|
||||
end
|
||||
end
|
||||
end
|
||||
if mapCam.keyCtrl then
|
||||
gc_setColor(1,1,1)
|
||||
gc_setLineWidth(4)
|
||||
gc_translate(640,360)
|
||||
gc_line(-20,0,20,0)
|
||||
gc_line(0,-20,0,20)
|
||||
gc_translate(-640,-360)
|
||||
end
|
||||
--Score board
|
||||
if sel then
|
||||
local M=MODES[sel]
|
||||
gc_setColor(.5,.5,.5,.8)
|
||||
gc_rectangle('fill',920,0,360,720,5)--Info board
|
||||
gc_setColor(M.color)
|
||||
setFont(40)mStr(text.modes[sel][1],1100,5)
|
||||
setFont(30)mStr(text.modes[sel][2],1100,50)
|
||||
gc_setColor(1,1,1)
|
||||
setFont(25)gc_printf(text.modes[sel][3],920,110,360,'center')
|
||||
if M.slowMark then
|
||||
gc_draw(IMG.ctrlSpeedLimit,1230,50,nil,.4)
|
||||
end
|
||||
if M.score then
|
||||
mText(drawableText.highScore,1100,240)
|
||||
gc_setColor(.3,.3,.3,.7)
|
||||
gc_rectangle('fill',940,290,320,280,5)--Highscore board
|
||||
local L=M.records
|
||||
gc_setColor(1,1,1)
|
||||
if visibleModes[sel]==2 then
|
||||
mText(drawableText.modeLocked,1100,370)
|
||||
elseif L[1]then
|
||||
for i=1,#L do
|
||||
local t=M.scoreDisp(L[i])
|
||||
local f=int((30-#t*.4)/5)*5
|
||||
setFont(f)
|
||||
gc_print(t,955,275+25*i+17-f*.7)
|
||||
_=L[i].date
|
||||
if _ then
|
||||
setFont(10)
|
||||
gc_print(_,1155,285+25*i)
|
||||
end
|
||||
end
|
||||
else
|
||||
mText(drawableText.noScore,1100,370)
|
||||
end
|
||||
end
|
||||
end
|
||||
if mapCam.keyCtrl then
|
||||
gc_setColor(1,1,1)
|
||||
gc_setLineWidth(4)
|
||||
gc_translate(640,360)
|
||||
gc_line(-20,0,20,0)
|
||||
gc_line(0,-20,0,20)
|
||||
gc_translate(-640,-360)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="mod", x=140,y=655,w=220,h=80,font=35,code=goScene'mod'},
|
||||
WIDGET.newButton{name="start", x=1040,y=655,w=180,h=80,font=40,code=pressKey"return",hideF=function()return not mapCam.sel end},
|
||||
WIDGET.newButton{name="back", x=1200,y=655,w=120,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="mod", x=140,y=655,w=220,h=80,font=35,code=goScene'mod'},
|
||||
WIDGET.newButton{name="start",x=1040,y=655,w=180,h=80,font=40,code=pressKey"return",hideF=function()return not mapCam.sel end},
|
||||
WIDGET.newButton{name="back", x=1200,y=655,w=120,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -2,20 +2,20 @@ local gc=love.graphics
|
||||
local sin=math.sin
|
||||
|
||||
local author={
|
||||
blank="MrZ (old works)",
|
||||
race="MrZ (old works)",
|
||||
infinite="MrZ (old works)",
|
||||
push="MrZ (old works)",
|
||||
way="MrZ (old works)",
|
||||
reason="MrZ (old works)",
|
||||
cruelty="MrZ (old works)",
|
||||
final="MrZ (old works)",
|
||||
["end"]="MrZ (old works)",
|
||||
battle="Aether & MrZ",
|
||||
empty="ERM",
|
||||
["how feeling"]="????",
|
||||
moonbeam="Beethoven & MrZ",
|
||||
["secret7th remix"]="柒栎流星",
|
||||
blank="MrZ (old works)",
|
||||
race="MrZ (old works)",
|
||||
infinite="MrZ (old works)",
|
||||
push="MrZ (old works)",
|
||||
way="MrZ (old works)",
|
||||
reason="MrZ (old works)",
|
||||
cruelty="MrZ (old works)",
|
||||
final="MrZ (old works)",
|
||||
["end"]="MrZ (old works)",
|
||||
battle="Aether & MrZ",
|
||||
empty="ERM",
|
||||
["how feeling"]="????",
|
||||
moonbeam="Beethoven & MrZ",
|
||||
["secret7th remix"]="柒栎流星",
|
||||
}
|
||||
|
||||
local scene={}
|
||||
@@ -25,86 +25,86 @@ local selected--Music selected
|
||||
local bgmList=BGM.getList()
|
||||
if #bgmList==0 then bgmList={"[NO BGM]"}end
|
||||
function scene.sceneInit()
|
||||
selected=TABLE.find(bgmList,BGM.nowPlay)or 1
|
||||
selected=TABLE.find(bgmList,BGM.nowPlay)or 1
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
WHEELMOV(y)
|
||||
WHEELMOV(y)
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
local S=selected
|
||||
if key=="down"then
|
||||
if S<#bgmList then
|
||||
selected=S+1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
elseif key=="up"then
|
||||
if S>1 then
|
||||
selected=S-1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
elseif not isRep then
|
||||
if key=="return"or key=="space"then
|
||||
if BGM.nowPlay~=bgmList[S]then
|
||||
BGM.play(bgmList[S])
|
||||
if SETTING.bgm>0 then SFX.play('click')end
|
||||
else
|
||||
BGM.stop()
|
||||
end
|
||||
elseif key=="tab"then
|
||||
SCN.swapTo('sound','none')
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
local S=selected
|
||||
if key=="down"then
|
||||
if S<#bgmList then
|
||||
selected=S+1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
elseif key=="up"then
|
||||
if S>1 then
|
||||
selected=S-1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
elseif not isRep then
|
||||
if key=="return"or key=="space"then
|
||||
if BGM.nowPlay~=bgmList[S]then
|
||||
BGM.play(bgmList[S])
|
||||
if SETTING.bgm>0 then SFX.play('click')end
|
||||
else
|
||||
BGM.stop()
|
||||
end
|
||||
elseif key=="tab"then
|
||||
SCN.swapTo('sound','none')
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setColor(COLOR.Z)
|
||||
|
||||
setFont(50)
|
||||
gc.print(bgmList[selected],320,355)
|
||||
setFont(35)
|
||||
if selected>1 then gc.print(bgmList[selected-1],320,350-30)end
|
||||
if selected<#bgmList then gc.print(bgmList[selected+1],320,350+65)end
|
||||
setFont(20)
|
||||
if selected>2 then gc.print(bgmList[selected-2],320,350-50)end
|
||||
if selected<#bgmList-1 then gc.print(bgmList[selected+2],320,350+110)end
|
||||
setFont(50)
|
||||
gc.print(bgmList[selected],320,355)
|
||||
setFont(35)
|
||||
if selected>1 then gc.print(bgmList[selected-1],320,350-30)end
|
||||
if selected<#bgmList then gc.print(bgmList[selected+1],320,350+65)end
|
||||
setFont(20)
|
||||
if selected>2 then gc.print(bgmList[selected-2],320,350-50)end
|
||||
if selected<#bgmList-1 then gc.print(bgmList[selected+2],320,350+110)end
|
||||
|
||||
gc.draw(TEXTURE.title,840,220,nil,.5,nil,580,118)
|
||||
if BGM.nowPlay then
|
||||
local t=TIME()
|
||||
setFont(45)
|
||||
gc.setColor(sin(t*.5)*.2+.8,sin(t*.7)*.2+.8,sin(t)*.2+.8)
|
||||
gc.print(BGM.nowPlay,710,508)
|
||||
setFont(35)
|
||||
gc.setColor(1,sin(t*2.6)*.5+.5,sin(t*2.6)*.5+.5)
|
||||
gc.print(author[BGM.nowPlay]or"MrZ",680,465)
|
||||
gc.draw(TEXTURE.title,840,220,nil,.5,nil,580,118)
|
||||
if BGM.nowPlay then
|
||||
local t=TIME()
|
||||
setFont(45)
|
||||
gc.setColor(sin(t*.5)*.2+.8,sin(t*.7)*.2+.8,sin(t)*.2+.8)
|
||||
gc.print(BGM.nowPlay,710,508)
|
||||
setFont(35)
|
||||
gc.setColor(1,sin(t*2.6)*.5+.5,sin(t*2.6)*.5+.5)
|
||||
gc.print(author[BGM.nowPlay]or"MrZ",680,465)
|
||||
|
||||
local a=-t%2.3/2
|
||||
if a<1 then
|
||||
gc.setColor(1,1,1,a)
|
||||
gc.draw(TEXTURE.title_color,840,220,nil,.5+.062-.062*a,.5+.126-.126*a,580,118)
|
||||
end
|
||||
local a=-t%2.3/2
|
||||
if a<1 then
|
||||
gc.setColor(1,1,1,a)
|
||||
gc.draw(TEXTURE.title_color,840,220,nil,.5+.062-.062*a,.5+.126-.126*a,580,118)
|
||||
end
|
||||
|
||||
gc.setColor(1,1,1,.4)
|
||||
gc.setLineWidth(4)
|
||||
gc.line(500,600,900,600)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.circle('fill',500+400*BGM.playing:tell()/BGM.playing:getDuration(),600,6)
|
||||
end
|
||||
gc.setColor(1,1,1,.4)
|
||||
gc.setLineWidth(4)
|
||||
gc.line(500,600,900,600)
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.circle('fill',500+400*BGM.playing:tell()/BGM.playing:getDuration(),600,6)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=30, y=30,font=80,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',hideF=function()return not BGM.nowPlay end},
|
||||
WIDGET.newSlider{name="bgm", x=760, y=80,w=400,disp=SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
|
||||
WIDGET.newButton{name="up", x=200, y=250,w=120,code=pressKey"up",hideF=function()return selected==1 end,fText=GC.DO{32,32,{'setLW',4},{'line',2,28,16,4,30,28}}},
|
||||
WIDGET.newButton{name="play", x=200, y=390,w=120,code=pressKey"space",fText=GC.DO{64,64,{'fPoly',14+3,10,14+3,54,55+3,32}}},
|
||||
WIDGET.newButton{name="down", x=200, y=530,w=120,code=pressKey"down",hideF=function()return selected==#bgmList end,fText=GC.DO{32,32,{'setLW',4},{'line',2,4,16,28,30,4}}},
|
||||
WIDGET.newButton{name="sound", x=1140, y=540,w=170,h=80,font=40,code=pressKey"tab"},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newText{name="title", x=30,y=30,font=80,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',hideF=function()return not BGM.nowPlay end},
|
||||
WIDGET.newSlider{name="bgm", x=760,y=80,w=400,disp=SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
|
||||
WIDGET.newButton{name="up", x=200,y=250,w=120,code=pressKey"up",hideF=function()return selected==1 end,fText=GC.DO{32,32,{'setLW',4},{'line',2,28,16,4,30,28}}},
|
||||
WIDGET.newButton{name="play", x=200,y=390,w=120,code=pressKey"space",fText=GC.DO{64,64,{'fPoly',14+3,10,14+3,54,55+3,32}}},
|
||||
WIDGET.newButton{name="down", x=200,y=530,w=120,code=pressKey"down",hideF=function()return selected==#bgmList end,fText=GC.DO{32,32,{'setLW',4},{'line',2,4,16,28,30,4}}},
|
||||
WIDGET.newButton{name="sound",x=1140,y=540,w=170,h=80,font=40,code=pressKey"tab"},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -22,323 +22,323 @@ local touchMoveLastFrame=false
|
||||
local newMessageTimer
|
||||
|
||||
local function _hideReadyUI()
|
||||
return
|
||||
playing or
|
||||
NET.roomState.start or
|
||||
NET.getlock('ready')
|
||||
return
|
||||
playing or
|
||||
NET.roomState.start or
|
||||
NET.getlock('ready')
|
||||
end
|
||||
|
||||
local function _setCancel()NET.signal_setMode(0)end
|
||||
local function _setReady()NET.signal_setMode(1)end
|
||||
local function _setSpectate()NET.signal_setMode(2)end
|
||||
local function _gotoSetting()
|
||||
GAME.prevBG=BG.cur
|
||||
SCN.go('setting_game')
|
||||
GAME.prevBG=BG.cur
|
||||
SCN.go('setting_game')
|
||||
end
|
||||
local function _quit()
|
||||
if TIME()-lastBackTime<1 then
|
||||
NET.signal_quit()
|
||||
else
|
||||
lastBackTime=TIME()
|
||||
MES.new('info',text.sureQuit)
|
||||
end
|
||||
if TIME()-lastBackTime<1 then
|
||||
NET.signal_quit()
|
||||
else
|
||||
lastBackTime=TIME()
|
||||
MES.new('info',text.sureQuit)
|
||||
end
|
||||
end
|
||||
local function _switchChat()
|
||||
if inputBox.hide then
|
||||
textBox.hide=false
|
||||
inputBox.hide=false
|
||||
WIDGET.focus(inputBox)
|
||||
else
|
||||
textBox.hide=true
|
||||
inputBox.hide=true
|
||||
WIDGET.unFocus(true)
|
||||
end
|
||||
if inputBox.hide then
|
||||
textBox.hide=false
|
||||
inputBox.hide=false
|
||||
WIDGET.focus(inputBox)
|
||||
else
|
||||
textBox.hide=true
|
||||
inputBox.hide=true
|
||||
WIDGET.unFocus(true)
|
||||
end
|
||||
end
|
||||
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit(org)
|
||||
textBox.hide=true
|
||||
textBox:clear()
|
||||
inputBox.hide=true
|
||||
textBox.hide=true
|
||||
textBox:clear()
|
||||
inputBox.hide=true
|
||||
|
||||
noTouch=not SETTING.VKSwitch
|
||||
playing=false
|
||||
lastUpstreamTime=0
|
||||
upstreamProgress=1
|
||||
newMessageTimer=0
|
||||
noTouch=not SETTING.VKSwitch
|
||||
playing=false
|
||||
lastUpstreamTime=0
|
||||
upstreamProgress=1
|
||||
newMessageTimer=0
|
||||
|
||||
if org=='setting_game'then NET.changeConfig()end
|
||||
if GAME.prevBG then
|
||||
BG.set(GAME.prevBG)
|
||||
GAME.prevBG=false
|
||||
end
|
||||
if NET.specSRID then
|
||||
NET.wsconn_stream(NET.specSRID)
|
||||
NET.specSRID=false
|
||||
end
|
||||
if org=='setting_game'then NET.changeConfig()end
|
||||
if GAME.prevBG then
|
||||
BG.set(GAME.prevBG)
|
||||
GAME.prevBG=false
|
||||
end
|
||||
if NET.specSRID then
|
||||
NET.wsconn_stream(NET.specSRID)
|
||||
NET.specSRID=false
|
||||
end
|
||||
end
|
||||
function scene.sceneBack()
|
||||
GAME.playing=false
|
||||
GAME.playing=false
|
||||
end
|
||||
|
||||
scene.mouseDown=NULL
|
||||
function scene.mouseMove(x,y)netPLY.mouseMove(x,y)end
|
||||
function scene.touchDown(x,y)
|
||||
if not playing then netPLY.mouseMove(x,y)return end
|
||||
if noTouch then return end
|
||||
if not playing then netPLY.mouseMove(x,y)return end
|
||||
if noTouch then return end
|
||||
|
||||
local t=VK.on(x,y)
|
||||
if t then
|
||||
PLAYERS[1]:pressKey(t)
|
||||
VK.touch(t,x,y)
|
||||
end
|
||||
local t=VK.on(x,y)
|
||||
if t then
|
||||
PLAYERS[1]:pressKey(t)
|
||||
VK.touch(t,x,y)
|
||||
end
|
||||
end
|
||||
function scene.touchUp(x,y)
|
||||
if not playing or noTouch then return end
|
||||
local n=VK.on(x,y)
|
||||
if n then
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
if not playing or noTouch then return end
|
||||
local n=VK.on(x,y)
|
||||
if n then
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
end
|
||||
function scene.touchMove()
|
||||
if touchMoveLastFrame or not playing or noTouch then return end
|
||||
touchMoveLastFrame=true
|
||||
if touchMoveLastFrame or not playing or noTouch then return end
|
||||
touchMoveLastFrame=true
|
||||
|
||||
local L=tc.getTouches()
|
||||
for i=#L,1,-1 do
|
||||
L[2*i-1],L[2*i]=SCR.xOy:inverseTransformPoint(tc.getPosition(L[i]))
|
||||
end
|
||||
local keys=VK.keys
|
||||
for n=1,#keys do
|
||||
local B=keys[n]
|
||||
if B.ava then
|
||||
for i=1,#L,2 do
|
||||
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
||||
goto CONTINUE_nextKey
|
||||
end
|
||||
end
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
::CONTINUE_nextKey::
|
||||
end
|
||||
local L=tc.getTouches()
|
||||
for i=#L,1,-1 do
|
||||
L[2*i-1],L[2*i]=SCR.xOy:inverseTransformPoint(tc.getPosition(L[i]))
|
||||
end
|
||||
local keys=VK.keys
|
||||
for n=1,#keys do
|
||||
local B=keys[n]
|
||||
if B.ava then
|
||||
for i=1,#L,2 do
|
||||
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
||||
goto CONTINUE_nextKey
|
||||
end
|
||||
end
|
||||
PLAYERS[1]:releaseKey(n)
|
||||
VK.release(n)
|
||||
end
|
||||
::CONTINUE_nextKey::
|
||||
end
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if key=="escape"then
|
||||
if not inputBox.hide then
|
||||
_switchChat()
|
||||
else
|
||||
_quit()
|
||||
end
|
||||
elseif key=="return"then
|
||||
local mes=STRING.trim(inputBox:getText())
|
||||
if not inputBox.hide and #mes>0 then
|
||||
NET.sendMessage(mes)
|
||||
inputBox:clear()
|
||||
else
|
||||
_switchChat()
|
||||
end
|
||||
elseif not inputBox.hide then
|
||||
WIDGET.focus(inputBox)
|
||||
inputBox:keypress(key)
|
||||
elseif playing then
|
||||
if noKey or isRep then return end
|
||||
local k=keyMap.keyboard[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
end
|
||||
elseif not _hideReadyUI()then
|
||||
if key=="space"then
|
||||
if netPLY.getSelfJoinMode()==0 then
|
||||
(kb.isDown("lctrl","rctrl","lalt","ralt")and _setSpectate or _setReady)()
|
||||
else
|
||||
_setCancel()
|
||||
end
|
||||
elseif key=="s"then
|
||||
_gotoSetting()
|
||||
end
|
||||
end
|
||||
if key=="escape"then
|
||||
if not inputBox.hide then
|
||||
_switchChat()
|
||||
else
|
||||
_quit()
|
||||
end
|
||||
elseif key=="return"then
|
||||
local mes=STRING.trim(inputBox:getText())
|
||||
if not inputBox.hide and #mes>0 then
|
||||
NET.sendMessage(mes)
|
||||
inputBox:clear()
|
||||
else
|
||||
_switchChat()
|
||||
end
|
||||
elseif not inputBox.hide then
|
||||
WIDGET.focus(inputBox)
|
||||
inputBox:keypress(key)
|
||||
elseif playing then
|
||||
if noKey or isRep then return end
|
||||
local k=keyMap.keyboard[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
end
|
||||
elseif not _hideReadyUI()then
|
||||
if key=="space"then
|
||||
if netPLY.getSelfJoinMode()==0 then
|
||||
(kb.isDown("lctrl","rctrl","lalt","ralt")and _setSpectate or _setReady)()
|
||||
else
|
||||
_setCancel()
|
||||
end
|
||||
elseif key=="s"then
|
||||
_gotoSetting()
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyUp(key)
|
||||
if not playing or noKey then return end
|
||||
local k=keyMap.keyboard[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
if not playing or noKey then return end
|
||||
local k=keyMap.keyboard[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
end
|
||||
function scene.gamepadDown(key)
|
||||
if key=="back"then
|
||||
scene.keyDown("escape")
|
||||
else
|
||||
if not playing then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
end
|
||||
end
|
||||
if key=="back"then
|
||||
scene.keyDown("escape")
|
||||
else
|
||||
if not playing then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:pressKey(k)
|
||||
VK.press(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.gamepadUp(key)
|
||||
if not playing then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
if not playing then return end
|
||||
local k=keyMap.joystick[key]
|
||||
if k and k>0 then
|
||||
PLAYERS[1]:releaseKey(k)
|
||||
VK.release(k)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.socketRead(cmd,d)
|
||||
if cmd=='join'then
|
||||
textBox:push{
|
||||
COLOR.lR,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.Y,text.joinRoom,
|
||||
}
|
||||
SFX.play('click')
|
||||
elseif cmd=='leave'then
|
||||
textBox:push{
|
||||
COLOR.lR,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.Y,text.leaveRoom,
|
||||
}
|
||||
elseif cmd=='talk'then
|
||||
newMessageTimer=80
|
||||
textBox:push{
|
||||
COLOR.Z,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.N,d.message or"[_]",
|
||||
}
|
||||
elseif cmd=='go'then
|
||||
if not playing then
|
||||
playing=true
|
||||
lastUpstreamTime=0
|
||||
upstreamProgress=1
|
||||
resetGameData('n',NET.seed)
|
||||
netPLY.mouseMove(0,0)
|
||||
else
|
||||
MES.new('warn',"Redundant [Go]")
|
||||
end
|
||||
elseif cmd=='finish'then
|
||||
playing=false
|
||||
BG.set()
|
||||
end
|
||||
if cmd=='join'then
|
||||
textBox:push{
|
||||
COLOR.lR,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.Y,text.joinRoom,
|
||||
}
|
||||
SFX.play('click')
|
||||
elseif cmd=='leave'then
|
||||
textBox:push{
|
||||
COLOR.lR,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.Y,text.leaveRoom,
|
||||
}
|
||||
elseif cmd=='talk'then
|
||||
newMessageTimer=80
|
||||
textBox:push{
|
||||
COLOR.Z,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.N,d.message or"[_]",
|
||||
}
|
||||
elseif cmd=='go'then
|
||||
if not playing then
|
||||
playing=true
|
||||
lastUpstreamTime=0
|
||||
upstreamProgress=1
|
||||
resetGameData('n',NET.seed)
|
||||
netPLY.mouseMove(0,0)
|
||||
else
|
||||
MES.new('warn',"Redundant [Go]")
|
||||
end
|
||||
elseif cmd=='finish'then
|
||||
playing=false
|
||||
BG.set()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if NET.checkPlayDisconn()then
|
||||
NET.wsclose_stream()
|
||||
SCN.back()
|
||||
return
|
||||
end
|
||||
if playing then
|
||||
local P1=PLAYERS[1]
|
||||
if NET.checkPlayDisconn()then
|
||||
NET.wsclose_stream()
|
||||
SCN.back()
|
||||
return
|
||||
end
|
||||
if playing then
|
||||
local P1=PLAYERS[1]
|
||||
|
||||
touchMoveLastFrame=false
|
||||
VK.update()
|
||||
touchMoveLastFrame=false
|
||||
VK.update()
|
||||
|
||||
--Update players
|
||||
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||
--Update players
|
||||
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||
|
||||
--Warning check
|
||||
checkWarning()
|
||||
--Warning check
|
||||
checkWarning()
|
||||
|
||||
--Upload stream
|
||||
if not NET.spectate and P1.frameRun-lastUpstreamTime>8 then
|
||||
local stream
|
||||
if not GAME.rep[upstreamProgress]then
|
||||
ins(GAME.rep,P1.frameRun)
|
||||
ins(GAME.rep,0)
|
||||
end
|
||||
stream,upstreamProgress=DATA.dumpRecording(GAME.rep,upstreamProgress)
|
||||
if #stream%3==1 then
|
||||
stream=stream.."\0\0"
|
||||
elseif #stream%3==2 then
|
||||
stream=stream.."\0\0\0\0"
|
||||
end
|
||||
NET.uploadRecStream(stream)
|
||||
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
||||
end
|
||||
else
|
||||
netPLY.update()
|
||||
end
|
||||
if newMessageTimer>0 then
|
||||
newMessageTimer=newMessageTimer-1
|
||||
end
|
||||
--Upload stream
|
||||
if not NET.spectate and P1.frameRun-lastUpstreamTime>8 then
|
||||
local stream
|
||||
if not GAME.rep[upstreamProgress]then
|
||||
ins(GAME.rep,P1.frameRun)
|
||||
ins(GAME.rep,0)
|
||||
end
|
||||
stream,upstreamProgress=DATA.dumpRecording(GAME.rep,upstreamProgress)
|
||||
if #stream%3==1 then
|
||||
stream=stream.."\0\0"
|
||||
elseif #stream%3==2 then
|
||||
stream=stream.."\0\0\0\0"
|
||||
end
|
||||
NET.uploadRecStream(stream)
|
||||
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
||||
end
|
||||
else
|
||||
netPLY.update()
|
||||
end
|
||||
if newMessageTimer>0 then
|
||||
newMessageTimer=newMessageTimer-1
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
if playing then
|
||||
--Players
|
||||
for p=1,#PLAYERS do
|
||||
PLAYERS[p]:draw()
|
||||
end
|
||||
if playing then
|
||||
--Players
|
||||
for p=1,#PLAYERS do
|
||||
PLAYERS[p]:draw()
|
||||
end
|
||||
|
||||
--Virtual keys
|
||||
VK.draw()
|
||||
--Virtual keys
|
||||
VK.draw()
|
||||
|
||||
--Warning
|
||||
drawWarning()
|
||||
--Warning
|
||||
drawWarning()
|
||||
|
||||
if NET.spectate then
|
||||
setFont(30)
|
||||
gc_setColor(.2,1,0,.8)
|
||||
gc_print(text.spectating,940,0)
|
||||
end
|
||||
else
|
||||
--Users
|
||||
netPLY.draw()
|
||||
if NET.spectate then
|
||||
setFont(30)
|
||||
gc_setColor(.2,1,0,.8)
|
||||
gc_print(text.spectating,940,0)
|
||||
end
|
||||
else
|
||||
--Users
|
||||
netPLY.draw()
|
||||
|
||||
--Ready & Set mark
|
||||
setFont(50)
|
||||
if NET.roomReadyState=='allReady'then
|
||||
gc_setColor(1,.85,.6,.9)
|
||||
mStr(text.ready,640,15)
|
||||
elseif NET.roomReadyState=='connecting'then
|
||||
gc_setColor(.6,1,.9,.9)
|
||||
mStr(text.connStream,640,15)
|
||||
elseif NET.roomReadyState=='waitConn'then
|
||||
gc_setColor(.6,.95,1,.9)
|
||||
mStr(text.waitStream,640,15)
|
||||
end
|
||||
--Ready & Set mark
|
||||
setFont(50)
|
||||
if NET.roomReadyState=='allReady'then
|
||||
gc_setColor(1,.85,.6,.9)
|
||||
mStr(text.ready,640,15)
|
||||
elseif NET.roomReadyState=='connecting'then
|
||||
gc_setColor(.6,1,.9,.9)
|
||||
mStr(text.connStream,640,15)
|
||||
elseif NET.roomReadyState=='waitConn'then
|
||||
gc_setColor(.6,.95,1,.9)
|
||||
mStr(text.waitStream,640,15)
|
||||
end
|
||||
|
||||
--Room info.
|
||||
gc_setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc_printf(NET.roomState.roomInfo.name,0,685,1270,'right')
|
||||
setFont(40)
|
||||
gc_print(netPLY.getCount().."/"..NET.roomState.capacity,70,655)
|
||||
if NET.roomState.private then gc_draw(IMG.lock,30,668)end
|
||||
if NET.roomState.start then gc_setColor(0,1,0)gc_print(text.started,230,655)end
|
||||
--Room info.
|
||||
gc_setColor(1,1,1)
|
||||
setFont(25)
|
||||
gc_printf(NET.roomState.roomInfo.name,0,685,1270,'right')
|
||||
setFont(40)
|
||||
gc_print(netPLY.getCount().."/"..NET.roomState.capacity,70,655)
|
||||
if NET.roomState.private then gc_draw(IMG.lock,30,668)end
|
||||
if NET.roomState.start then gc_setColor(0,1,0)gc_print(text.started,230,655)end
|
||||
|
||||
--Profile
|
||||
drawSelfProfile()
|
||||
--Profile
|
||||
drawSelfProfile()
|
||||
|
||||
--Player count
|
||||
drawOnlinePlayerCount()
|
||||
end
|
||||
--Player count
|
||||
drawOnlinePlayerCount()
|
||||
end
|
||||
|
||||
--New message
|
||||
if newMessageTimer>0 then
|
||||
setFont(40)
|
||||
gc_setColor(.3,.7,1,(newMessageTimer/60)^2)
|
||||
gc_print("M",430,10)
|
||||
end
|
||||
--New message
|
||||
if newMessageTimer>0 then
|
||||
setFont(40)
|
||||
gc_setColor(.3,.7,1,(newMessageTimer/60)^2)
|
||||
gc_print("M",430,10)
|
||||
end
|
||||
end
|
||||
local function _hideF_ingame()return _hideReadyUI()or netPLY.getSelfReady()end
|
||||
local function _hideF_ingame2()return _hideReadyUI()or not netPLY.getSelfReady()end
|
||||
scene.widgetList={
|
||||
textBox,
|
||||
inputBox,
|
||||
WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90, fText=TEXTURE.setting, code=_gotoSetting,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name="ready", x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name="spectate", x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name="cancel", x=1060,y=560,w=360,h=120,color='lH',font=40, code=_setCancel,hideF=_hideF_ingame2},
|
||||
WIDGET.newKey{name="chat", x=360,y=45,w=60,fText="...",font=35, code=_switchChat},
|
||||
WIDGET.newKey{name="quit", x=860,y=45,w=60,fText=TEXTURE.quit_small, code=_quit},
|
||||
textBox,
|
||||
inputBox,
|
||||
WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90,fText=TEXTURE.setting,code=_gotoSetting,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name="ready", x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name="spectate",x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name="cancel", x=1060,y=560,w=360,h=120,color='lH',font=40, code=_setCancel,hideF=_hideF_ingame2},
|
||||
WIDGET.newKey{name="chat", x=360,y=45,w=60,fText="...",font=35, code=_switchChat},
|
||||
WIDGET.newKey{name="quit", x=860,y=45,w=60,fText=TEXTURE.quit_small, code=_quit},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,21 +3,21 @@ local gc=love.graphics
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('league')
|
||||
BGM.play('exploration')
|
||||
BG.set('league')
|
||||
BGM.play('exploration')
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(100)
|
||||
mStr("Tech League",640,120)
|
||||
drawSelfProfile()
|
||||
drawOnlinePlayerCount()
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(100)
|
||||
mStr("Tech League",640,120)
|
||||
drawSelfProfile()
|
||||
drawOnlinePlayerCount()
|
||||
end
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'},
|
||||
WIDGET.newKey{name="match",x=640,y=500,w=760,h=140,font=60,code=function()MES.new('warn',text.notFinished)end},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'},
|
||||
WIDGET.newKey{name="match",x=640,y=500,w=760,h=140,font=60,code=function()MES.new('warn',text.notFinished)end},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,40 +3,40 @@ local lastLogoutTime
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
lastLogoutTime=-1e99
|
||||
BG.set()
|
||||
lastLogoutTime=-1e99
|
||||
BG.set()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_play()
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
drawSelfProfile()
|
||||
drawOnlinePlayerCount()
|
||||
drawSelfProfile()
|
||||
drawOnlinePlayerCount()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'},
|
||||
WIDGET.newButton{name="league", x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'},
|
||||
WIDGET.newButton{name="ffa", x=640, y=360,w=350,h=120,font=40,color='D',code=function()MES.new('warn',text.notFinished)--[[NET.enterRoom({name="ffa"})]]end},
|
||||
WIDGET.newButton{name="rooms", x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'},
|
||||
WIDGET.newButton{name="logout", x=880, y=40,w=180,h=60,color='dR',
|
||||
code=function()
|
||||
if TIME()-lastLogoutTime<1 then
|
||||
if USER.uid then
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_user()
|
||||
USER.uid=false
|
||||
USER.authToken=false
|
||||
FILE.save(USER,'conf/user')
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
MES.new('info',text.sureQuit)
|
||||
lastLogoutTime=TIME()
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'},
|
||||
WIDGET.newButton{name="league",x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'},
|
||||
WIDGET.newButton{name="ffa", x=640, y=360,w=350,h=120,font=40,color='D',code=function()MES.new('warn',text.notFinished)--[[NET.enterRoom({name="ffa"})]]end},
|
||||
WIDGET.newButton{name="rooms", x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'},
|
||||
WIDGET.newButton{name="logout",x=880, y=40,w=180,h=60,color='dR',
|
||||
code=function()
|
||||
if TIME()-lastLogoutTime<1 then
|
||||
if USER.uid then
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_user()
|
||||
USER.uid=false
|
||||
USER.authToken=false
|
||||
FILE.save(USER,'conf/user')
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
MES.new('info',text.sureQuit)
|
||||
lastLogoutTime=TIME()
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,110 +1,110 @@
|
||||
local ROOMENV=ROOMENV
|
||||
|
||||
local roomName=WIDGET.newText{name="roomName", x=40,y=115,align='L'}
|
||||
local roomNameBox=WIDGET.newInputBox{ x=40,y=160,w=540,h=60}
|
||||
local password=WIDGET.newText{name="password", x=40,y=255,align='L'}
|
||||
local passwordBox=WIDGET.newInputBox{ x=40,y=300,w=540,h=60}
|
||||
local description=WIDGET.newText{name="description",x=650,y=55,align='L'}
|
||||
local descriptionBox=WIDGET.newInputBox { x=650,y=100,w=550,h=160,font=25}
|
||||
local roomName=WIDGET.newText{name="roomName", x=40,y=115,align='L'}
|
||||
local roomNameBox=WIDGET.newInputBox{ x=40,y=160,w=540,h=60}
|
||||
local password=WIDGET.newText{name="password", x=40,y=255,align='L'}
|
||||
local passwordBox=WIDGET.newInputBox{ x=40,y=300,w=540,h=60}
|
||||
local description=WIDGET.newText{name="description", x=650,y=55,align='L'}
|
||||
local descriptionBox=WIDGET.newInputBox { x=650,y=100,w=550,h=160,font=25}
|
||||
|
||||
local sList={
|
||||
visible={"show","easy","slow","medium","fast","none"},
|
||||
freshLimit={0,1,2,4,6,8,10,12,15,30,1e99},
|
||||
life={0,1,2,3,5,10,15,26,42,87,500},
|
||||
pushSpeed={1,2,3,5,15},
|
||||
fieldH={1,2,3,4,6,8,10,15,20,30,50,100},
|
||||
heightLimit={2,3,4,6,8,10,15,20,30,40,70,100,150,200,1e99},
|
||||
bufferLimit={4,6,10,15,20,40,100,1e99},
|
||||
visible={"show","easy","slow","medium","fast","none"},
|
||||
freshLimit={0,1,2,4,6,8,10,12,15,30,1e99},
|
||||
life={0,1,2,3,5,10,15,26,42,87,500},
|
||||
pushSpeed={1,2,3,5,15},
|
||||
fieldH={1,2,3,4,6,8,10,15,20,30,50,100},
|
||||
heightLimit={2,3,4,6,8,10,15,20,30,40,70,100,150,200,1e99},
|
||||
bufferLimit={4,6,10,15,20,40,100,1e99},
|
||||
|
||||
drop={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
drop={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
|
||||
wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
|
||||
}
|
||||
|
||||
local scene={}
|
||||
|
||||
local function _createRoom()
|
||||
local pw=passwordBox.value
|
||||
if pw==""then pw=nil end
|
||||
local roomname=STRING.trim(roomNameBox.value)
|
||||
if #roomname==0 then roomname=(USERS.getUsername(USER.uid)or"Anonymous").."'s room"end
|
||||
NET.createRoom(
|
||||
roomname,
|
||||
descriptionBox.value,
|
||||
ROOMENV.capacity,
|
||||
"normal",
|
||||
ROOMENV,
|
||||
pw
|
||||
)
|
||||
local pw=passwordBox.value
|
||||
if pw==""then pw=nil end
|
||||
local roomname=STRING.trim(roomNameBox.value)
|
||||
if #roomname==0 then roomname=(USERS.getUsername(USER.uid)or"Anonymous").."'s room"end
|
||||
NET.createRoom(
|
||||
roomname,
|
||||
descriptionBox.value,
|
||||
ROOMENV.capacity,
|
||||
"normal",
|
||||
ROOMENV,
|
||||
pw
|
||||
)
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
sure=0
|
||||
destroyPlayers()
|
||||
BG.set(ROOMENV.bg)
|
||||
BGM.play(ROOMENV.bgm)
|
||||
sure=0
|
||||
destroyPlayers()
|
||||
BG.set(ROOMENV.bg)
|
||||
BGM.play(ROOMENV.bgm)
|
||||
end
|
||||
function scene.sceneBack()
|
||||
BGM.play()
|
||||
BGM.play()
|
||||
end
|
||||
|
||||
function scene.keyDown(key)
|
||||
if key=="return"then
|
||||
_createRoom()
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
if key=="return"then
|
||||
_createRoom()
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetScrollHeight=400
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title",x=40,y=15,font=70,align='L'},
|
||||
WIDGET.newText{name="title",x=40,y=15,font=70,align='L'},
|
||||
|
||||
--Room name/password/description
|
||||
roomName,
|
||||
roomNameBox,
|
||||
password,
|
||||
passwordBox,
|
||||
description,
|
||||
descriptionBox,
|
||||
--Room name/password/description
|
||||
roomName,
|
||||
roomNameBox,
|
||||
password,
|
||||
passwordBox,
|
||||
description,
|
||||
descriptionBox,
|
||||
|
||||
--Selectors
|
||||
WIDGET.newSelector{name="life", x=170,y=410,w=260,color='R',list=sList.life, disp=ROOMval("life"), code=ROOMsto("life")},
|
||||
WIDGET.newSelector{name="pushSpeed", x=170,y=520,w=260,color='V',list=sList.pushSpeed, disp=ROOMval("pushSpeed"), code=ROOMsto("pushSpeed")},
|
||||
WIDGET.newSelector{name="garbageSpeed", x=170,y=600,w=260,color='V',list=sList.pushSpeed, disp=ROOMval("garbageSpeed"),code=ROOMsto("garbageSpeed")},
|
||||
WIDGET.newSelector{name="visible", x=170,y=710,w=260,color='lB',list=sList.visible, disp=ROOMval("visible"), code=ROOMsto("visible")},
|
||||
WIDGET.newSelector{name="freshLimit", x=170,y=790,w=260,color='lB',list=sList.freshLimit, disp=ROOMval("freshLimit"), code=ROOMsto("freshLimit")},
|
||||
--Selectors
|
||||
WIDGET.newSelector{name="life", x=170,y=410,w=260,color='R',list=sList.life, disp=ROOMval("life"), code=ROOMsto("life")},
|
||||
WIDGET.newSelector{name="pushSpeed", x=170,y=520,w=260,color='V',list=sList.pushSpeed, disp=ROOMval("pushSpeed"), code=ROOMsto("pushSpeed")},
|
||||
WIDGET.newSelector{name="garbageSpeed", x=170,y=600,w=260,color='V',list=sList.pushSpeed, disp=ROOMval("garbageSpeed"), code=ROOMsto("garbageSpeed")},
|
||||
WIDGET.newSelector{name="visible", x=170,y=710,w=260,color='lB',list=sList.visible, disp=ROOMval("visible"), code=ROOMsto("visible")},
|
||||
WIDGET.newSelector{name="freshLimit", x=170,y=790,w=260,color='lB',list=sList.freshLimit, disp=ROOMval("freshLimit"), code=ROOMsto("freshLimit")},
|
||||
|
||||
WIDGET.newSelector{name="fieldH", x=450,y=600,w=260,color='N',list=sList.fieldH, disp=ROOMval("fieldH"), code=ROOMsto("fieldH")},
|
||||
WIDGET.newSelector{name="heightLimit", x=450,y=710,w=260,color='S',list=sList.heightLimit, disp=ROOMval("heightLimit"),code=ROOMsto("heightLimit")},
|
||||
WIDGET.newSelector{name="bufferLimit", x=450,y=790,w=260,color='B',list=sList.bufferLimit, disp=ROOMval("bufferLimit"),code=ROOMsto("bufferLimit")},
|
||||
WIDGET.newSelector{name="fieldH", x=450,y=600,w=260,color='N',list=sList.fieldH, disp=ROOMval("fieldH"), code=ROOMsto("fieldH")},
|
||||
WIDGET.newSelector{name="heightLimit", x=450,y=710,w=260,color='S',list=sList.heightLimit, disp=ROOMval("heightLimit"), code=ROOMsto("heightLimit")},
|
||||
WIDGET.newSelector{name="bufferLimit", x=450,y=790,w=260,color='B',list=sList.bufferLimit, disp=ROOMval("bufferLimit"), code=ROOMsto("bufferLimit")},
|
||||
|
||||
WIDGET.newSelector{name="drop",x=730,y=330,w=260,color='O',list=sList.drop,disp=ROOMval("drop"),code=ROOMsto("drop")},
|
||||
WIDGET.newSelector{name="lock",x=730,y=410,w=260,color='O',list=sList.lock,disp=ROOMval("lock"),code=ROOMsto("lock")},
|
||||
WIDGET.newSelector{name="wait",x=730,y=520,w=260,color='G',list=sList.wait,disp=ROOMval("wait"),code=ROOMsto("wait")},
|
||||
WIDGET.newSelector{name="fall",x=730,y=600,w=260,color='G',list=sList.fall,disp=ROOMval("fall"),code=ROOMsto("fall")},
|
||||
WIDGET.newSelector{name="drop", x=730,y=330,w=260,color='O',list=sList.drop,disp=ROOMval("drop"),code=ROOMsto("drop")},
|
||||
WIDGET.newSelector{name="lock", x=730,y=410,w=260,color='O',list=sList.lock,disp=ROOMval("lock"),code=ROOMsto("lock")},
|
||||
WIDGET.newSelector{name="wait", x=730,y=520,w=260,color='G',list=sList.wait,disp=ROOMval("wait"),code=ROOMsto("wait")},
|
||||
WIDGET.newSelector{name="fall", x=730,y=600,w=260,color='G',list=sList.fall,disp=ROOMval("fall"),code=ROOMsto("fall")},
|
||||
|
||||
--Capacity & Create & Back
|
||||
WIDGET.newSelector{name="capacity", x=1070,y=330,w=310,color='lY',list={2,3,4,5,7,10,17,31,49,99},disp=ROOMval("capacity"),code=ROOMsto("capacity")},
|
||||
WIDGET.newButton{name="create", x=1070,y=480,w=310,h=140,color='lN',font=40,code=pressKey"return"},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
--Capacity & Create & Back
|
||||
WIDGET.newSelector{name="capacity", x=1070,y=330,w=310,color='lY',list={2,3,4,5,7,10,17,31,49,99},disp=ROOMval("capacity"),code=ROOMsto("capacity")},
|
||||
WIDGET.newButton{name="create", x=1070,y=480,w=310,h=140,color='lN',font=40,code=pressKey"return"},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
|
||||
--Special rules
|
||||
WIDGET.newSwitch{name="ospin", x=830, y=750,disp=ROOMval("ospin"), code=ROOMrev("ospin")},
|
||||
WIDGET.newSwitch{name="fineKill", x=830, y=840,disp=ROOMval("fineKill"), code=ROOMrev("fineKill")},
|
||||
WIDGET.newSwitch{name="b2bKill", x=830, y=930,disp=ROOMval("b2bKill"), code=ROOMrev("b2bKill")},
|
||||
WIDGET.newSwitch{name="easyFresh", x=1170, y=750,disp=ROOMval("easyFresh"),code=ROOMrev("easyFresh")},
|
||||
WIDGET.newSwitch{name="deepDrop", x=1170, y=840,disp=ROOMval("deepDrop"), code=ROOMrev("deepDrop")},
|
||||
WIDGET.newSwitch{name="bone", x=1170, y=930,disp=ROOMval("bone"), code=ROOMrev("bone")},
|
||||
--Special rules
|
||||
WIDGET.newSwitch{name="ospin", x=830, y=750,disp=ROOMval("ospin"), code=ROOMrev("ospin")},
|
||||
WIDGET.newSwitch{name="fineKill", x=830, y=840,disp=ROOMval("fineKill"), code=ROOMrev("fineKill")},
|
||||
WIDGET.newSwitch{name="b2bKill", x=830, y=930,disp=ROOMval("b2bKill"), code=ROOMrev("b2bKill")},
|
||||
WIDGET.newSwitch{name="easyFresh", x=1170,y=750,disp=ROOMval("easyFresh"),code=ROOMrev("easyFresh")},
|
||||
WIDGET.newSwitch{name="deepDrop", x=1170,y=840,disp=ROOMval("deepDrop"), code=ROOMrev("deepDrop")},
|
||||
WIDGET.newSwitch{name="bone", x=1170,y=930,disp=ROOMval("bone"), code=ROOMrev("bone")},
|
||||
|
||||
--Next & Hold
|
||||
WIDGET.newSlider{name="nextCount", x=120,y=940,w=200,unit=6, disp=ROOMval("nextCount"),code=ROOMsto("nextCount")},
|
||||
WIDGET.newSlider{name="holdCount", x=120,y=1030,w=200,unit=6, disp=ROOMval("holdCount"),code=ROOMsto("holdCount")},
|
||||
WIDGET.newSwitch{name="infHold", x=560,y=940, disp=ROOMval("infHold"),code=ROOMrev("infHold"),hideF=function()return ROOMENV.holdCount==0 end},
|
||||
WIDGET.newSwitch{name="phyHold", x=560,y=1030, disp=ROOMval("phyHold"),code=ROOMrev("phyHold"),hideF=function()return ROOMENV.holdCount==0 end},
|
||||
--Next & Hold
|
||||
WIDGET.newSlider{name="nextCount", x=120,y=940,w=200,unit=6, disp=ROOMval("nextCount"),code=ROOMsto("nextCount")},
|
||||
WIDGET.newSlider{name="holdCount", x=120,y=1030,w=200,unit=6, disp=ROOMval("holdCount"),code=ROOMsto("holdCount")},
|
||||
WIDGET.newSwitch{name="infHold", x=560,y=940, disp=ROOMval("infHold"),code=ROOMrev("infHold"),hideF=function()return ROOMENV.holdCount==0 end},
|
||||
WIDGET.newSwitch{name="phyHold", x=560,y=1030, disp=ROOMval("phyHold"),code=ROOMrev("phyHold"),hideF=function()return ROOMENV.holdCount==0 end},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -10,145 +10,145 @@ local NET=NET
|
||||
local fetchTimer
|
||||
|
||||
local roomList=WIDGET.newListBox{name="roomList",x=50,y=50,w=800,h=440,lineH=40,drawF=function(item,id,ifSel)
|
||||
setFont(35)
|
||||
if ifSel then
|
||||
gc_setColor(1,1,1,.3)
|
||||
gc_rectangle('fill',0,0,800,40)
|
||||
end
|
||||
gc_setColor(1,1,1)
|
||||
if item.private then gc_draw(IMG.lock,10,5)end
|
||||
gc_print(item.count.."/"..item.capacity,670,-4)
|
||||
setFont(35)
|
||||
if ifSel then
|
||||
gc_setColor(1,1,1,.3)
|
||||
gc_rectangle('fill',0,0,800,40)
|
||||
end
|
||||
gc_setColor(1,1,1)
|
||||
if item.private then gc_draw(IMG.lock,10,5)end
|
||||
gc_print(item.count.."/"..item.capacity,670,-4)
|
||||
|
||||
gc_setColor(.9,.9,1)
|
||||
gc_print(id,45,-4)
|
||||
gc_setColor(.9,.9,1)
|
||||
gc_print(id,45,-4)
|
||||
|
||||
if item.start then
|
||||
gc_setColor(.1,.5,.2)
|
||||
else
|
||||
gc_setColor(1,1,.7)
|
||||
end
|
||||
gc_print(item.roomInfo.name,200,-4)
|
||||
if item.start then
|
||||
gc_setColor(.1,.5,.2)
|
||||
else
|
||||
gc_setColor(1,1,.7)
|
||||
end
|
||||
gc_print(item.roomInfo.name,200,-4)
|
||||
end}
|
||||
local function _hidePW()
|
||||
local R=roomList:getSel()
|
||||
return not R or not R.private
|
||||
local R=roomList:getSel()
|
||||
return not R or not R.private
|
||||
end
|
||||
local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secret=true,hideF=_hidePW}
|
||||
|
||||
--[[roomList[n]={
|
||||
rid="qwerty",
|
||||
roomInfo={
|
||||
name="MrZ's room",
|
||||
type="classic",
|
||||
version=1409,
|
||||
},
|
||||
private=false,
|
||||
start=false,
|
||||
count=4,
|
||||
capacity=5,
|
||||
rid="qwerty",
|
||||
roomInfo={
|
||||
name="MrZ's room",
|
||||
type="classic",
|
||||
version=1409,
|
||||
},
|
||||
private=false,
|
||||
start=false,
|
||||
count=4,
|
||||
capacity=5,
|
||||
}]]
|
||||
local function _fetchRoom()
|
||||
fetchTimer=10
|
||||
NET.fetchRoom()
|
||||
fetchTimer=10
|
||||
NET.fetchRoom()
|
||||
end
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
_fetchRoom()
|
||||
BG.set()
|
||||
_fetchRoom()
|
||||
end
|
||||
|
||||
function scene.keyDown(key)
|
||||
if NET.getlock('enterRoom')then return end
|
||||
if WIDGET.sel~=passwordBox then
|
||||
if key=="r"then
|
||||
if fetchTimer<=7 then
|
||||
_fetchRoom()
|
||||
end
|
||||
elseif key=="s"then
|
||||
SCN.go('setting_game')
|
||||
elseif key=="n"then
|
||||
SCN.go('net_newRoom')
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif roomList:getLen()>0 and key=="return"then
|
||||
local R=roomList:getSel()
|
||||
if NET.getlock('fetchRoom')or not R then return end
|
||||
if R.roomInfo.version==VERSION.room then
|
||||
NET.enterRoom(R,passwordBox.value)
|
||||
else
|
||||
MES.new('error',text.versionNotMatch)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
if NET.getlock('enterRoom')then return end
|
||||
if WIDGET.sel~=passwordBox then
|
||||
if key=="r"then
|
||||
if fetchTimer<=7 then
|
||||
_fetchRoom()
|
||||
end
|
||||
elseif key=="s"then
|
||||
SCN.go('setting_game')
|
||||
elseif key=="n"then
|
||||
SCN.go('net_newRoom')
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif roomList:getLen()>0 and key=="return"then
|
||||
local R=roomList:getSel()
|
||||
if NET.getlock('fetchRoom')or not R then return end
|
||||
if R.roomInfo.version==VERSION.room then
|
||||
NET.enterRoom(R,passwordBox.value)
|
||||
else
|
||||
MES.new('error',text.versionNotMatch)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if not NET.getlock('fetchRoom')and _hidePW()then
|
||||
fetchTimer=fetchTimer-dt
|
||||
if fetchTimer<=0 then
|
||||
_fetchRoom()
|
||||
end
|
||||
end
|
||||
if not NET.getlock('fetchRoom')and _hidePW()then
|
||||
fetchTimer=fetchTimer-dt
|
||||
if fetchTimer<=0 then
|
||||
_fetchRoom()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Fetching timer
|
||||
gc_setColor(1,1,1,.12)
|
||||
gc_arc('fill','pie',250,630,40,-1.5708,-1.5708-.6283*fetchTimer)
|
||||
--Fetching timer
|
||||
gc_setColor(1,1,1,.12)
|
||||
gc_arc('fill','pie',250,630,40,-1.5708,-1.5708-.6283*fetchTimer)
|
||||
|
||||
--Joining mark
|
||||
if NET.getlock('enterRoom')then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(15)
|
||||
local t=TIME()*6.26%6.2832
|
||||
gc.arc('line','open',640,360,80,t,t+4.26)
|
||||
end
|
||||
--Joining mark
|
||||
if NET.getlock('enterRoom')then
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(15)
|
||||
local t=TIME()*6.26%6.2832
|
||||
gc.arc('line','open',640,360,80,t,t+4.26)
|
||||
end
|
||||
|
||||
--Room list
|
||||
local R=roomList:getSel()
|
||||
if R then
|
||||
gc_translate(870,220)
|
||||
gc_setColor(1,1,1)
|
||||
gc_setLineWidth(3)
|
||||
gc_rectangle('line',0,0,385,335)
|
||||
setFont(25)
|
||||
gc_print(R.roomInfo.type,10,25)
|
||||
gc_setColor(1,1,.7)
|
||||
gc_printf(R.roomInfo.name,10,0,365)
|
||||
setFont(20)
|
||||
gc_setColor(COLOR.lH)
|
||||
gc_printf(R.roomInfo.description or"[No description]",10,55,365)
|
||||
if R.start then
|
||||
gc_setColor(COLOR.lA)
|
||||
gc_print(text.started,10,300)
|
||||
end
|
||||
gc_setColor(COLOR.lN)
|
||||
gc_printf(R.roomInfo.version,10,300,365,'right')
|
||||
gc_translate(-870,-220)
|
||||
end
|
||||
--Room list
|
||||
local R=roomList:getSel()
|
||||
if R then
|
||||
gc_translate(870,220)
|
||||
gc_setColor(1,1,1)
|
||||
gc_setLineWidth(3)
|
||||
gc_rectangle('line',0,0,385,335)
|
||||
setFont(25)
|
||||
gc_print(R.roomInfo.type,10,25)
|
||||
gc_setColor(1,1,.7)
|
||||
gc_printf(R.roomInfo.name,10,0,365)
|
||||
setFont(20)
|
||||
gc_setColor(COLOR.lH)
|
||||
gc_printf(R.roomInfo.description or"[No description]",10,55,365)
|
||||
if R.start then
|
||||
gc_setColor(COLOR.lA)
|
||||
gc_print(text.started,10,300)
|
||||
end
|
||||
gc_setColor(COLOR.lN)
|
||||
gc_printf(R.roomInfo.version,10,300,365,'right')
|
||||
gc_translate(-870,-220)
|
||||
end
|
||||
|
||||
--Profile
|
||||
drawSelfProfile()
|
||||
--Profile
|
||||
drawSelfProfile()
|
||||
|
||||
--Player count
|
||||
drawOnlinePlayerCount()
|
||||
--Player count
|
||||
drawOnlinePlayerCount()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
roomList,
|
||||
passwordBox,
|
||||
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s"},
|
||||
WIDGET.newText{name="refreshing",x=450,y=240,font=45,hideF=function()return not NET.getlock('fetchRoom')end},
|
||||
WIDGET.newText{name="noRoom", x=450,y=245,font=40,hideF=function()return roomList:getLen()>0 or NET.getlock('fetchRoom')end},
|
||||
WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function()return fetchTimer>7 end},
|
||||
WIDGET.newKey{name="new", x=510,y=630,w=260,h=120,code=pressKey"n"},
|
||||
WIDGET.newKey{name="join", x=780,y=630,w=140,h=120,code=pressKey"return",hideF=function()return roomList:getLen()==0 or NET.getlock('enterRoom')end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},
|
||||
roomList,
|
||||
passwordBox,
|
||||
WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90,fText=TEXTURE.setting,code=pressKey"s"},
|
||||
WIDGET.newText{name="refreshing",x=450,y=240,font=45,hideF=function()return not NET.getlock('fetchRoom')end},
|
||||
WIDGET.newText{name="noRoom", x=450,y=245,font=40,hideF=function()return roomList:getLen()>0 or NET.getlock('fetchRoom')end},
|
||||
WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function()return fetchTimer>7 end},
|
||||
WIDGET.newKey{name="new", x=510,y=630,w=260,h=120,code=pressKey"n"},
|
||||
WIDGET.newKey{name="join", x=780,y=630,w=140,h=120,code=pressKey"return",hideF=function()return roomList:getLen()==0 or NET.getlock('enterRoom')end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -5,14 +5,14 @@ local GAME,SCR=GAME,SCR
|
||||
local setFont,mStr=setFont,mStr
|
||||
|
||||
local fnsRankColor={
|
||||
Z=COLOR.lY,
|
||||
S=COLOR.lH,
|
||||
A=COLOR.N,
|
||||
B=COLOR.lG,
|
||||
C=COLOR.M,
|
||||
D=COLOR.dG,
|
||||
E=COLOR.R,
|
||||
F=COLOR.dR,
|
||||
Z=COLOR.lY,
|
||||
S=COLOR.lH,
|
||||
A=COLOR.N,
|
||||
B=COLOR.lG,
|
||||
C=COLOR.M,
|
||||
D=COLOR.dG,
|
||||
E=COLOR.R,
|
||||
F=COLOR.dR,
|
||||
}
|
||||
|
||||
local scene={}
|
||||
@@ -29,156 +29,156 @@ local trophy--Current trophy
|
||||
local trophyColor--Current trophy color
|
||||
|
||||
function scene.sceneInit(org)
|
||||
page=0
|
||||
if org:find("setting")then
|
||||
TEXT.show(text.needRestart,640,410,50,'fly',.6)
|
||||
end
|
||||
local P=PLAYERS[1]
|
||||
local S=P.stat
|
||||
page=0
|
||||
if org:find("setting")then
|
||||
TEXT.show(text.needRestart,640,410,50,'fly',.6)
|
||||
end
|
||||
local P=PLAYERS[1]
|
||||
local S=P.stat
|
||||
|
||||
timer1=org=='game'and 0 or 50
|
||||
timer2=timer1
|
||||
timer1=org=='game'and 0 or 50
|
||||
timer2=timer1
|
||||
|
||||
local frameLostRate=(S.frame/S.time/60-1)*100
|
||||
form={
|
||||
{COLOR.Z,STRING.time(S.time),COLOR[frameLostRate>10 and'R'or frameLostRate>3 and'Y'or'H'],(" (%.2f%%)"):format(frameLostRate)},
|
||||
("%d/%d/%d"):format(S.key,S.rotate,S.hold),
|
||||
("%d %.2fPPS"):format(S.piece,S.piece/S.time),
|
||||
("%d(%d) %.2fLPM"):format(S.row,S.dig,S.row/S.time*60),
|
||||
("%d(%d) %.2fAPM"):format(S.atk,S.digatk,S.atk/S.time*60),
|
||||
("%d(%d-%d)"):format(S.pend,S.recv,S.recv-S.pend),
|
||||
("%d/%d/%d/%d"):format(S.clears[1],S.clears[2],S.clears[3],S.clears[4]),
|
||||
("(%d)/%d/%d/%d"):format(S.spins[1],S.spins[2],S.spins[3],S.spins[4]),
|
||||
("%d/%d ; %d/%d"):format(S.b2b,S.b3b,S.pc,S.hpc),
|
||||
("%d/%dx/%.2f%%"):format(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}
|
||||
local frameLostRate=(S.frame/S.time/60-1)*100
|
||||
form={
|
||||
{COLOR.Z,STRING.time(S.time),COLOR[frameLostRate>10 and'R'or frameLostRate>3 and'Y'or'H'],(" (%.2f%%)"):format(frameLostRate)},
|
||||
("%d/%d/%d"):format(S.key,S.rotate,S.hold),
|
||||
("%d %.2fPPS"):format(S.piece,S.piece/S.time),
|
||||
("%d(%d) %.2fLPM"):format(S.row,S.dig,S.row/S.time*60),
|
||||
("%d(%d) %.2fAPM"):format(S.atk,S.digatk,S.atk/S.time*60),
|
||||
("%d(%d-%d)"):format(S.pend,S.recv,S.recv-S.pend),
|
||||
("%d/%d/%d/%d"):format(S.clears[1],S.clears[2],S.clears[3],S.clears[4]),
|
||||
("(%d)/%d/%d/%d"):format(S.spins[1],S.spins[2],S.spins[3],S.spins[4]),
|
||||
("%d/%d ; %d/%d"):format(S.b2b,S.b3b,S.pc,S.hpc),
|
||||
("%d/%dx/%.2f%%"):format(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}
|
||||
|
||||
--Normalize Values
|
||||
for i=1,6 do
|
||||
val[i]=val[i]*radar[i]if val[i]>1.26 then val[i]=1.26+log(val[i]-.26)end
|
||||
end
|
||||
--Normalize Values
|
||||
for i=1,6 do
|
||||
val[i]=val[i]*radar[i]if val[i]>1.26 then val[i]=1.26+log(val[i]-.26)end
|
||||
end
|
||||
|
||||
for i=1,6 do
|
||||
radar[i]=("%.2f%s"):format(radar[i],text.radarData[i])
|
||||
end
|
||||
local f=1
|
||||
for i=1,6 do
|
||||
if val[i]>.5 then f=2 end
|
||||
if val[i]>1 then f=3 break end
|
||||
end
|
||||
if f==1 then chartColor,f={.4,.9,.5},1.25 --Vegetable
|
||||
elseif f==2 then chartColor,f={.4,.7,.9},1 --Normal
|
||||
elseif f==3 then chartColor,f={1,.3,.3},.626 --Diao
|
||||
end
|
||||
standard={
|
||||
120*.5*f, 120*3^.5*.5*f,
|
||||
120*-.5*f, 120*3^.5*.5*f,
|
||||
120*-1*f, 120*0*f,
|
||||
120*-.5*f, 120*-3^.5*.5*f,
|
||||
120*.5*f, 120*-3^.5*.5*f,
|
||||
120*1*f, 120*0*f,
|
||||
}
|
||||
for i=1,6 do
|
||||
radar[i]=("%.2f%s"):format(radar[i],text.radarData[i])
|
||||
end
|
||||
local f=1
|
||||
for i=1,6 do
|
||||
if val[i]>.5 then f=2 end
|
||||
if val[i]>1 then f=3 break end
|
||||
end
|
||||
if f==1 then chartColor,f={.4,.9,.5},1.25--Vegetable
|
||||
elseif f==2 then chartColor,f={.4,.7,.9},1 --Normal
|
||||
elseif f==3 then chartColor,f={1,.3,.3},.626 --Diao
|
||||
end
|
||||
standard={
|
||||
120*.5*f, 120*3^.5*.5*f,
|
||||
120*-.5*f,120*3^.5*.5*f,
|
||||
120*-1*f, 120*0*f,
|
||||
120*-.5*f,120*-3^.5*.5*f,
|
||||
120*.5*f, 120*-3^.5*.5*f,
|
||||
120*1*f, 120*0*f,
|
||||
}
|
||||
|
||||
for i=6,1,-1 do
|
||||
val[2*i-1],val[2*i]=val[i]*standard[2*i-1],val[i]*standard[2*i]
|
||||
end
|
||||
for i=6,1,-1 do
|
||||
val[2*i-1],val[2*i]=val[i]*standard[2*i-1],val[i]*standard[2*i]
|
||||
end
|
||||
|
||||
if P.result=='win'and P.stat.piece>4 then
|
||||
local acc=P.stat.finesseRate*.2/P.stat.piece
|
||||
rank=
|
||||
acc==1. and"Z"or
|
||||
acc>.97 and"S"or
|
||||
acc>.94 and"A"or
|
||||
acc>.87 and"B"or
|
||||
acc>.70 and"C"or
|
||||
acc>.50 and"D"or
|
||||
acc>.30 and"E"or
|
||||
"F"
|
||||
if acc==1 then
|
||||
trophy=text.finesse_ap
|
||||
trophyColor=COLOR.Y
|
||||
elseif P.stat.maxFinesseCombo==P.stat.piece then
|
||||
trophy=text.finesse_fc
|
||||
trophyColor=COLOR.lC
|
||||
else
|
||||
trophy=nil
|
||||
end
|
||||
else
|
||||
rank,trophy=nil
|
||||
end
|
||||
if GAME.prevBG then
|
||||
BG.set(GAME.prevBG)
|
||||
GAME.prevBG=false
|
||||
end
|
||||
if P.result=='win'and P.stat.piece>4 then
|
||||
local acc=P.stat.finesseRate*.2/P.stat.piece
|
||||
rank=
|
||||
acc==1. and"Z"or
|
||||
acc>.97 and"S"or
|
||||
acc>.94 and"A"or
|
||||
acc>.87 and"B"or
|
||||
acc>.70 and"C"or
|
||||
acc>.50 and"D"or
|
||||
acc>.30 and"E"or
|
||||
"F"
|
||||
if acc==1 then
|
||||
trophy=text.finesse_ap
|
||||
trophyColor=COLOR.Y
|
||||
elseif P.stat.maxFinesseCombo==P.stat.piece then
|
||||
trophy=text.finesse_fc
|
||||
trophyColor=COLOR.lC
|
||||
else
|
||||
trophy=nil
|
||||
end
|
||||
else
|
||||
rank,trophy=nil
|
||||
end
|
||||
if GAME.prevBG then
|
||||
BG.set(GAME.prevBG)
|
||||
GAME.prevBG=false
|
||||
end
|
||||
end
|
||||
function scene.sceneBack()
|
||||
trySave()
|
||||
trySave()
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="q"then
|
||||
SCN.back()
|
||||
GAME.playing=false
|
||||
elseif key=="escape"then
|
||||
SCN.swapTo(GAME.result and'game'or'depause','none')
|
||||
elseif key=="s"then
|
||||
if not GAME.fromRepMenu then
|
||||
GAME.prevBG=BG.cur
|
||||
SCN.go('setting_sound')
|
||||
end
|
||||
elseif key=="r"then
|
||||
if not GAME.fromRepMenu then
|
||||
resetGameData()
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
elseif key=="p"then
|
||||
if(GAME.result or GAME.replaying)and #PLAYERS==1 then
|
||||
resetGameData('r')
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
elseif key=="o"then
|
||||
if(GAME.result or GAME.replaying)and #PLAYERS==1 and not GAME.saved then
|
||||
if DATA.saveReplay()then
|
||||
GAME.saved=true
|
||||
SFX.play('connected')
|
||||
end
|
||||
end
|
||||
elseif key=="tab"or key=="Stab"then
|
||||
if love.keyboard.isDown("lshift","rshift")or key=="Stab"then
|
||||
page=(page-1)%2
|
||||
else
|
||||
page=(page+1)%2
|
||||
end
|
||||
timer2=0
|
||||
elseif key=="t"then
|
||||
if SETTING.allowTAS and not(GAME.result or GAME.replaying)then
|
||||
GAME.tasUsed=true
|
||||
SFX.play('ren_mega')
|
||||
SFX.play('clear_3')
|
||||
SYSFX.newShade(1.2,555,200,620,380,.6,.6,.6)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="q"then
|
||||
SCN.back()
|
||||
GAME.playing=false
|
||||
elseif key=="escape"then
|
||||
SCN.swapTo(GAME.result and'game'or'depause','none')
|
||||
elseif key=="s"then
|
||||
if not GAME.fromRepMenu then
|
||||
GAME.prevBG=BG.cur
|
||||
SCN.go('setting_sound')
|
||||
end
|
||||
elseif key=="r"then
|
||||
if not GAME.fromRepMenu then
|
||||
resetGameData()
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
elseif key=="p"then
|
||||
if(GAME.result or GAME.replaying)and #PLAYERS==1 then
|
||||
resetGameData('r')
|
||||
SCN.swapTo('game','none')
|
||||
end
|
||||
elseif key=="o"then
|
||||
if(GAME.result or GAME.replaying)and #PLAYERS==1 and not GAME.saved then
|
||||
if DATA.saveReplay()then
|
||||
GAME.saved=true
|
||||
SFX.play('connected')
|
||||
end
|
||||
end
|
||||
elseif key=="tab"or key=="Stab"then
|
||||
if love.keyboard.isDown("lshift","rshift")or key=="Stab"then
|
||||
page=(page-1)%2
|
||||
else
|
||||
page=(page+1)%2
|
||||
end
|
||||
timer2=0
|
||||
elseif key=="t"then
|
||||
if SETTING.allowTAS and not(GAME.result or GAME.replaying)then
|
||||
GAME.tasUsed=true
|
||||
SFX.play('ren_mega')
|
||||
SFX.play('clear_3')
|
||||
SYSFX.newShade(1.2,555,200,620,380,.6,.6,.6)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if not(GAME.result or GAME.replaying)then
|
||||
GAME.pauseTime=GAME.pauseTime+dt
|
||||
end
|
||||
if timer1<50 then timer1=timer1+1 end
|
||||
if timer2<25 then timer2=timer2+1 end
|
||||
if not(GAME.result or GAME.replaying)then
|
||||
GAME.pauseTime=GAME.pauseTime+dt
|
||||
end
|
||||
if timer1<50 then timer1=timer1+1 end
|
||||
if timer2<25 then timer2=timer2+1 end
|
||||
end
|
||||
|
||||
local hexList={1,0,.5,1.732*.5,-.5,1.732*.5}
|
||||
@@ -186,191 +186,191 @@ 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 T=timer1*.02
|
||||
local T2=timer2*.04
|
||||
if T<1 or GAME.result then SCN.scenes.game.draw()end
|
||||
local T=timer1*.02
|
||||
local T2=timer2*.04
|
||||
if T<1 or GAME.result then SCN.scenes.game.draw()end
|
||||
|
||||
--Dark BG
|
||||
local _=T
|
||||
if GAME.result then _=_*.76 end
|
||||
gc.setColor(.12,.12,.12,_)
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
--Dark BG
|
||||
local _=T
|
||||
if GAME.result then _=_*.76 end
|
||||
gc.setColor(.12,.12,.12,_)
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
|
||||
gc.setColor(.97,.97,.97,T)
|
||||
gc.setColor(.97,.97,.97,T)
|
||||
|
||||
--Result Text
|
||||
mDraw(GAME.result and drawableText[GAME.result]or drawableText.pause,640,70-10*(5-timer1*.1)^1.5)
|
||||
--Result Text
|
||||
mDraw(GAME.result and drawableText[GAME.result]or drawableText.pause,640,70-10*(5-timer1*.1)^1.5)
|
||||
|
||||
--Mode Info (outside)
|
||||
gc.draw(drawableText.modeName,745-drawableText.modeName:getWidth(),143)
|
||||
--Mode Info (outside)
|
||||
gc.draw(drawableText.modeName,745-drawableText.modeName:getWidth(),143)
|
||||
|
||||
--Level rank
|
||||
if GAME.rank>0 then
|
||||
gc.push('transform')
|
||||
gc.translate(1050,5)
|
||||
local str=text.ranks[GAME.rank]
|
||||
setFont(80)
|
||||
gc.setColor(0,0,0,T*.7)
|
||||
gc.print(str,-5,-4,nil,1.5)
|
||||
local L=rankColor[GAME.rank]
|
||||
gc.setColor(L[1],L[2],L[3],T)
|
||||
gc.print(str,0,0,nil,1.5)
|
||||
gc.pop()
|
||||
end
|
||||
--Level rank
|
||||
if GAME.rank>0 then
|
||||
gc.push('transform')
|
||||
gc.translate(1050,5)
|
||||
local str=text.ranks[GAME.rank]
|
||||
setFont(80)
|
||||
gc.setColor(0,0,0,T*.7)
|
||||
gc.print(str,-5,-4,nil,1.5)
|
||||
local L=rankColor[GAME.rank]
|
||||
gc.setColor(L[1],L[2],L[3],T)
|
||||
gc.print(str,0,0,nil,1.5)
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
if GAME.tasUsed then
|
||||
gc.push('transform')
|
||||
gc.translate(560,205)
|
||||
gc.scale(2.6)
|
||||
setFont(100)
|
||||
gc.setColor(.97,.97,.97,T*.08)
|
||||
gc.print("TAS",50,-23,.3)
|
||||
gc.pop()
|
||||
end
|
||||
if GAME.tasUsed then
|
||||
gc.push('transform')
|
||||
gc.translate(560,205)
|
||||
gc.scale(2.6)
|
||||
setFont(100)
|
||||
gc.setColor(.97,.97,.97,T*.08)
|
||||
gc.print("TAS",50,-23,.3)
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
--Big info frame
|
||||
if PLAYERS[1].frameRun>180 then
|
||||
gc.push('transform')
|
||||
gc.translate(560,205)
|
||||
gc.setLineWidth(2)
|
||||
--Big info frame
|
||||
if PLAYERS[1].frameRun>180 then
|
||||
gc.push('transform')
|
||||
gc.translate(560,205)
|
||||
gc.setLineWidth(2)
|
||||
|
||||
--Pause Info (outside)
|
||||
setFont(25)
|
||||
if GAME.pauseCount>0 then
|
||||
gc.setColor(.97,.97,.97,T*.06)
|
||||
gc.rectangle('fill',-5,390,620,36,8)
|
||||
gc.setColor(.97,.97,.97,T)
|
||||
gc.rectangle('line',-5,390,620,36,8)
|
||||
mStr(("%s:[%d] %.2fs"):format(text.pauseCount,GAME.pauseCount,GAME.pauseTime),305,389)
|
||||
end
|
||||
--Pause Info (outside)
|
||||
setFont(25)
|
||||
if GAME.pauseCount>0 then
|
||||
gc.setColor(.97,.97,.97,T*.06)
|
||||
gc.rectangle('fill',-5,390,620,36,8)
|
||||
gc.setColor(.97,.97,.97,T)
|
||||
gc.rectangle('line',-5,390,620,36,8)
|
||||
mStr(("%s:[%d] %.2fs"):format(text.pauseCount,GAME.pauseCount,GAME.pauseTime),305,389)
|
||||
end
|
||||
|
||||
--Pages
|
||||
if page==0 then
|
||||
--Frame
|
||||
gc.setColor(.97,.97,.97,T2*.06)
|
||||
gc.rectangle('fill',-5,-5,620,380,8)
|
||||
gc.setColor(.97,.97,.97,T2)
|
||||
gc.rectangle('line',-5,-5,620,380,8)
|
||||
--Pages
|
||||
if page==0 then
|
||||
--Frame
|
||||
gc.setColor(.97,.97,.97,T2*.06)
|
||||
gc.rectangle('fill',-5,-5,620,380,8)
|
||||
gc.setColor(.97,.97,.97,T2)
|
||||
gc.rectangle('line',-5,-5,620,380,8)
|
||||
|
||||
--Game statistics
|
||||
gc.push('transform')
|
||||
gc.scale(.85)
|
||||
gc.setLineWidth(2)
|
||||
--Game statistics
|
||||
gc.push('transform')
|
||||
gc.scale(.85)
|
||||
gc.setLineWidth(2)
|
||||
|
||||
--Stats
|
||||
_=form
|
||||
setFont(30)
|
||||
gc.setColor(.97,.97,.97,T2)
|
||||
for i=1,10 do
|
||||
gc.print(text.pauseStat[i],5,43*(i-1)+2)
|
||||
gc.printf(_[i],210,43*(i-1)+2,500,'right')
|
||||
end
|
||||
--Stats
|
||||
_=form
|
||||
setFont(30)
|
||||
gc.setColor(.97,.97,.97,T2)
|
||||
for i=1,10 do
|
||||
gc.print(text.pauseStat[i],5,43*(i-1)+2)
|
||||
gc.printf(_[i],210,43*(i-1)+2,500,'right')
|
||||
end
|
||||
|
||||
--Finesse rank & trophy
|
||||
if rank then
|
||||
setFont(40)
|
||||
local c=fnsRankColor[rank]
|
||||
gc.setColor(c[1],c[2],c[3],T2)
|
||||
gc.print(rank,405,383)
|
||||
if trophy then
|
||||
setFont(20)
|
||||
gc.setColor(trophyColor[1],trophyColor[2],trophyColor[3],T2*2-1)
|
||||
gc.printf(trophy,95-120*(1-T2^.5),398,300,'right')
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
elseif page==1 then
|
||||
--Radar Chart
|
||||
gc.setLineWidth(1)
|
||||
gc.push('transform')
|
||||
gc.translate(310,185)
|
||||
--Finesse rank & trophy
|
||||
if rank then
|
||||
setFont(40)
|
||||
local c=fnsRankColor[rank]
|
||||
gc.setColor(c[1],c[2],c[3],T2)
|
||||
gc.print(rank,405,383)
|
||||
if trophy then
|
||||
setFont(20)
|
||||
gc.setColor(trophyColor[1],trophyColor[2],trophyColor[3],T2*2-1)
|
||||
gc.printf(trophy,95-120*(1-T2^.5),398,300,'right')
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
elseif page==1 then
|
||||
--Radar Chart
|
||||
gc.setLineWidth(1)
|
||||
gc.push('transform')
|
||||
gc.translate(310,185)
|
||||
|
||||
--Polygon
|
||||
gc.push('transform')
|
||||
gc.scale((3-2*T2)*T2)
|
||||
gc.setColor(.97,.97,.97,T2*(.5+.3*sin(TIME()*6.26)))
|
||||
GC.regularPolygon('line',0,0,120,6,8)
|
||||
gc.setColor(chartColor[1],chartColor[2],chartColor[3],T2*.626)
|
||||
for i=1,9,2 do
|
||||
gc.polygon('fill',0,0,val[i],val[i+1],val[i+2],val[i+3])
|
||||
end
|
||||
gc.polygon('fill',0,0,val[11],val[12],val[1],val[2])
|
||||
gc.setColor(.97,.97,.97,T2)
|
||||
for i=1,9,2 do
|
||||
gc.line(val[i],val[i+1],val[i+2],val[i+3])
|
||||
end
|
||||
gc.line(val[11],val[12],val[1],val[2])
|
||||
gc.pop()
|
||||
--Polygon
|
||||
gc.push('transform')
|
||||
gc.scale((3-2*T2)*T2)
|
||||
gc.setColor(.97,.97,.97,T2*(.5+.3*sin(TIME()*6.26)))
|
||||
GC.regularPolygon('line',0,0,120,6,8)
|
||||
gc.setColor(chartColor[1],chartColor[2],chartColor[3],T2*.626)
|
||||
for i=1,9,2 do
|
||||
gc.polygon('fill',0,0,val[i],val[i+1],val[i+2],val[i+3])
|
||||
end
|
||||
gc.polygon('fill',0,0,val[11],val[12],val[1],val[2])
|
||||
gc.setColor(.97,.97,.97,T2)
|
||||
for i=1,9,2 do
|
||||
gc.line(val[i],val[i+1],val[i+2],val[i+3])
|
||||
end
|
||||
gc.line(val[11],val[12],val[1],val[2])
|
||||
gc.pop()
|
||||
|
||||
--Texts
|
||||
local C
|
||||
_=TIME()%6.2832
|
||||
if _>3.142 then
|
||||
gc.setColor(.97,.97,.97,-T2*sin(_))
|
||||
setFont(35)
|
||||
C,_=text.radar,textPos
|
||||
else
|
||||
gc.setColor(.97,.97,.97,T2*sin(_))
|
||||
setFont(20)
|
||||
C,_=radar,dataPos
|
||||
end
|
||||
for i=1,6 do
|
||||
mStr(C[i],_[2*i-1],_[2*i])
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
--Texts
|
||||
local C
|
||||
_=TIME()%6.2832
|
||||
if _>3.142 then
|
||||
gc.setColor(.97,.97,.97,-T2*sin(_))
|
||||
setFont(35)
|
||||
C,_=text.radar,textPos
|
||||
else
|
||||
gc.setColor(.97,.97,.97,T2*sin(_))
|
||||
setFont(20)
|
||||
C,_=radar,dataPos
|
||||
end
|
||||
for i=1,6 do
|
||||
mStr(C[i],_[2*i-1],_[2*i])
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
--Mods
|
||||
gc.push('transform')
|
||||
gc.translate(131,600)
|
||||
gc.scale(.65)
|
||||
if #GAME.mod>0 then
|
||||
gc.setLineWidth(2)
|
||||
if scoreValid()then
|
||||
gc.setColor(.7,.7,.7,T)
|
||||
gc.rectangle('line',-5,-5,500,150,8)
|
||||
gc.setColor(.7,.7,.7,T*.05)
|
||||
gc.rectangle('fill',-5,-5,500,150,8)
|
||||
else
|
||||
gc.setColor(.8,0,0,T)
|
||||
gc.rectangle('line',-5,-5,500,150,8)
|
||||
gc.setColor(1,0,0,T*.05)
|
||||
gc.rectangle('fill',-5,-5,500,150,8)
|
||||
end
|
||||
setFont(35)
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel>0 then
|
||||
_=M.color
|
||||
gc.setColor(_[1],_[2],_[3],T)
|
||||
mStr(M.id,35+M.no%8*60,math.floor(M.no/8)*45)
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
--Mods
|
||||
gc.push('transform')
|
||||
gc.translate(131,600)
|
||||
gc.scale(.65)
|
||||
if #GAME.mod>0 then
|
||||
gc.setLineWidth(2)
|
||||
if scoreValid()then
|
||||
gc.setColor(.7,.7,.7,T)
|
||||
gc.rectangle('line',-5,-5,500,150,8)
|
||||
gc.setColor(.7,.7,.7,T*.05)
|
||||
gc.rectangle('fill',-5,-5,500,150,8)
|
||||
else
|
||||
gc.setColor(.8,0,0,T)
|
||||
gc.rectangle('line',-5,-5,500,150,8)
|
||||
gc.setColor(1,0,0,T*.05)
|
||||
gc.rectangle('fill',-5,-5,500,150,8)
|
||||
end
|
||||
setFont(35)
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel>0 then
|
||||
_=M.color
|
||||
gc.setColor(_[1],_[2],_[3],T)
|
||||
mStr(M.id,35+M.no%8*60,math.floor(M.no/8)*45)
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="resume", x=290,y=240,w=300,h=70,code=pressKey"escape"},
|
||||
WIDGET.newKey{name="restart", x=290,y=340,w=300,h=70,code=pressKey"r",hideF=function()return GAME.fromRepMenu end},
|
||||
WIDGET.newKey{name="setting", x=290,y=440,w=300,h=70,code=pressKey"s",hideF=function()return GAME.fromRepMenu end},
|
||||
WIDGET.newKey{name="quit", x=290,y=540,w=300,h=70,code=pressKey"q"},
|
||||
WIDGET.newKey{name="tas", x=290,y=620,w=240,h=50,code=pressKey"t",hideF=function()return not SETTING.allowTAS or GAME.tasUsed or GAME.result or GAME.replaying end},
|
||||
WIDGET.newKey{name="page_prev", x=500,y=390,w=70,code=pressKey"tab",noFrame=true,
|
||||
fText=GC.DO{70,70,{'setLW',2}, {'dRPol',33,35,32,3,6,3.142},{'dRPol',45,35,32,3,6,3.142}},
|
||||
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRPol',33,35,32,3,6,3.142},{'fRPol',45,35,32,3,6,3.142}}}},
|
||||
hideF=function()return PLAYERS[1].frameRun<=180 end,
|
||||
},
|
||||
WIDGET.newKey{name="page_next", x=1230,y=390,w=70,code=pressKey"Stab",noFrame=true,
|
||||
fText=GC.DO{70,70,{'setLW',2}, {'dRPol',37,35,32,3,6},{'dRPol',25,35,32,3,6}},
|
||||
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRPol',37,35,32,3,6},{'fRPol',25,35,32,3,6}}}},
|
||||
hideF=function()return PLAYERS[1].frameRun<=180 end,
|
||||
},
|
||||
WIDGET.newKey{name="replay", x=865,y=165,w=200,h=40,font=25,code=pressKey"p",hideF=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end},
|
||||
WIDGET.newKey{name="save", x=1075,y=165,w=200,h=40,font=25,code=pressKey"o",hideF=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 or GAME.saved end},
|
||||
WIDGET.newKey{name="resume", x=290,y=240,w=300,h=70,code=pressKey"escape"},
|
||||
WIDGET.newKey{name="restart", x=290,y=340,w=300,h=70,code=pressKey"r",hideF=function()return GAME.fromRepMenu end},
|
||||
WIDGET.newKey{name="setting", x=290,y=440,w=300,h=70,code=pressKey"s",hideF=function()return GAME.fromRepMenu end},
|
||||
WIDGET.newKey{name="quit", x=290,y=540,w=300,h=70,code=pressKey"q"},
|
||||
WIDGET.newKey{name="tas", x=290,y=620,w=240,h=50,code=pressKey"t",hideF=function()return not SETTING.allowTAS or GAME.tasUsed or GAME.result or GAME.replaying end},
|
||||
WIDGET.newKey{name="page_prev",x=500,y=390,w=70,code=pressKey"tab",noFrame=true,
|
||||
fText=GC.DO{70,70,{'setLW',2}, {'dRPol',33,35,32,3,6,3.142},{'dRPol',45,35,32,3,6,3.142}},
|
||||
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRPol',33,35,32,3,6,3.142},{'fRPol',45,35,32,3,6,3.142}}}},
|
||||
hideF=function()return PLAYERS[1].frameRun<=180 end,
|
||||
},
|
||||
WIDGET.newKey{name="page_next",x=1230,y=390,w=70,code=pressKey"Stab",noFrame=true,
|
||||
fText=GC.DO{70,70,{'setLW',2}, {'dRPol',37,35,32,3,6},{'dRPol',25,35,32,3,6}},
|
||||
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRPol',37,35,32,3,6},{'fRPol',25,35,32,3,6}}}},
|
||||
hideF=function()return PLAYERS[1].frameRun<=180 end,
|
||||
},
|
||||
WIDGET.newKey{name="replay", x=865,y=165,w=200,h=40,font=25,code=pressKey"p",hideF=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end},
|
||||
WIDGET.newKey{name="save", x=1075,y=165,w=200,h=40,font=25,code=pressKey"o",hideF=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 or GAME.saved end},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,12 +1,12 @@
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
if math.random()>.0000626 then
|
||||
love.timer.sleep(.26)
|
||||
love.event.quit()
|
||||
else
|
||||
error("So lucky! 0.00626% to get this!! You can quit the game now.")
|
||||
end
|
||||
if math.random()>.0000626 then
|
||||
love.timer.sleep(.26)
|
||||
love.event.quit()
|
||||
else
|
||||
error("So lucky! 0.00626% to get this!! You can quit the game now.")
|
||||
end
|
||||
end
|
||||
|
||||
return scene
|
||||
@@ -1,34 +1,34 @@
|
||||
local scene={}
|
||||
|
||||
local function _register()
|
||||
local username= WIDGET.active.username:getText()
|
||||
local email= WIDGET.active.email:getText()
|
||||
local password= WIDGET.active.password:getText()
|
||||
local password2=WIDGET.active.password2:getText()
|
||||
if #username==0 then
|
||||
MES.new('error',text.noUsername)return
|
||||
elseif not STRING.simpEmailCheck(email)then
|
||||
MES.new('error',text.wrongEmail)return
|
||||
elseif #password==0 or #password2==0 then
|
||||
MES.new('error',text.noPassword)return
|
||||
elseif password~=password2 then
|
||||
MES.new('error',text.diffPassword)return
|
||||
end
|
||||
NET.register(username,email,password)
|
||||
local username= WIDGET.active.username:getText()
|
||||
local email= WIDGET.active.email:getText()
|
||||
local password= WIDGET.active.password:getText()
|
||||
local password2=WIDGET.active.password2:getText()
|
||||
if #username==0 then
|
||||
MES.new('error',text.noUsername)return
|
||||
elseif not STRING.simpEmailCheck(email)then
|
||||
MES.new('error',text.wrongEmail)return
|
||||
elseif #password==0 or #password2==0 then
|
||||
MES.new('error',text.noPassword)return
|
||||
elseif password~=password2 then
|
||||
MES.new('error',text.diffPassword)return
|
||||
end
|
||||
NET.register(username,email,password)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name="login", x=1140, y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('login','swipeL')end},
|
||||
WIDGET.newInputBox{name="username", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z_]"},
|
||||
WIDGET.newInputBox{name="email", x=380, y=300,w=626,h=60},
|
||||
WIDGET.newInputBox{name="password", x=380, y=400,w=626,h=60,secret=true,regex="[ -~]"},
|
||||
WIDGET.newInputBox{name="password2",x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"},
|
||||
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newButton{name="login", x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('login','swipeL')end},
|
||||
WIDGET.newInputBox{name="username", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z_]"},
|
||||
WIDGET.newInputBox{name="email", x=380, y=300,w=626,h=60},
|
||||
WIDGET.newInputBox{name="password", x=380, y=400,w=626,h=60,secret=true,regex="[ -~]"},
|
||||
WIDGET.newInputBox{name="password2",x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"},
|
||||
|
||||
WIDGET.newKey{name="register", x=640, y=640,w=300,h=80,font=40,code=_register,hideF=function()return NET.getlock('register')end},
|
||||
WIDGET.newText{name="registering", x=640, y=605,font=50,hideF=function()return not NET.getlock('register')end},
|
||||
WIDGET.newKey{name="register", x=640, y=640,w=300,h=80,font=40,code=_register,hideF=function()return NET.getlock('register')end},
|
||||
WIDGET.newText{name="registering", x=640, y=605,font=50,hideF=function()return not NET.getlock('register')end},
|
||||
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -7,34 +7,34 @@ local kb=love.keyboard
|
||||
local setFont=setFont
|
||||
|
||||
local listBox=WIDGET.newListBox{name="list",x=50,y=50,w=1200,h=520,lineH=40,drawF=function(rep,id,ifSel)
|
||||
if ifSel then
|
||||
gc_setColor(1,1,1,.3)
|
||||
gc_rectangle('fill',0,0,1200,40)
|
||||
end
|
||||
if ifSel then
|
||||
gc_setColor(1,1,1,.3)
|
||||
gc_rectangle('fill',0,0,1200,40)
|
||||
end
|
||||
|
||||
setFont(30)
|
||||
gc_setColor(.8,.8,.8)
|
||||
gc_print(id,10,-2)
|
||||
if rep.tasUsed then
|
||||
gc_setColor(COLOR.R)
|
||||
gc_print("TAS",680,-2)
|
||||
end
|
||||
setFont(30)
|
||||
gc_setColor(.8,.8,.8)
|
||||
gc_print(id,10,-2)
|
||||
if rep.tasUsed then
|
||||
gc_setColor(COLOR.R)
|
||||
gc_print("TAS",680,-2)
|
||||
end
|
||||
|
||||
if rep.available then
|
||||
gc_setColor(.9,.9,1)
|
||||
local modeName=text.modes[rep.mode]
|
||||
gc_print(modeName and modeName[1].." "..modeName[2]or rep.mode,310,-2)
|
||||
setFont(20)
|
||||
gc_setColor(1,1,.8)
|
||||
gc_print(rep.date,80,6)
|
||||
gc_setColor(1,.4,.4,.6)
|
||||
gc_printf(rep.version,0,6,1190,'right')
|
||||
gc_setColor(COLOR.Z)
|
||||
gc_printf(rep.player,0,6,960,'right')
|
||||
else
|
||||
gc_setColor(.6,.6,.6)
|
||||
gc_print(rep.fileName,80,-2)
|
||||
end
|
||||
if rep.available then
|
||||
gc_setColor(.9,.9,1)
|
||||
local modeName=text.modes[rep.mode]
|
||||
gc_print(modeName and modeName[1].." "..modeName[2]or rep.mode,310,-2)
|
||||
setFont(20)
|
||||
gc_setColor(1,1,.8)
|
||||
gc_print(rep.date,80,6)
|
||||
gc_setColor(1,.4,.4,.6)
|
||||
gc_printf(rep.version,0,6,1190,'right')
|
||||
gc_setColor(COLOR.Z)
|
||||
gc_printf(rep.player,0,6,960,'right')
|
||||
else
|
||||
gc_setColor(.6,.6,.6)
|
||||
gc_print(rep.fileName,80,-2)
|
||||
end
|
||||
end}
|
||||
|
||||
local scene={}
|
||||
@@ -42,124 +42,124 @@ local scene={}
|
||||
local sure
|
||||
|
||||
local function _playRep(fileName)
|
||||
local rep=DATA.parseReplay(fileName,true)
|
||||
if not rep.available then
|
||||
MES.new('error',text.replayBroken)
|
||||
elseif MODES[rep.mode]then
|
||||
GAME.seed=rep.seed
|
||||
GAME.setting=rep.setting
|
||||
TABLE.cut(GAME.mod)
|
||||
for i=1,#MODOPT do MODOPT[i].sel=0 end
|
||||
for _,m in next,rep.mod do
|
||||
MODOPT[m[1]+1].sel=m[2]
|
||||
table.insert(GAME.mod,MODOPT[m[1]+1])
|
||||
end
|
||||
GAME.rep={}
|
||||
DATA.pumpRecording(rep.data,GAME.rep)
|
||||
local rep=DATA.parseReplay(fileName,true)
|
||||
if not rep.available then
|
||||
MES.new('error',text.replayBroken)
|
||||
elseif MODES[rep.mode]then
|
||||
GAME.seed=rep.seed
|
||||
GAME.setting=rep.setting
|
||||
TABLE.cut(GAME.mod)
|
||||
for i=1,#MODOPT do MODOPT[i].sel=0 end
|
||||
for _,m in next,rep.mod do
|
||||
MODOPT[m[1]+1].sel=m[2]
|
||||
table.insert(GAME.mod,MODOPT[m[1]+1])
|
||||
end
|
||||
GAME.rep={}
|
||||
DATA.pumpRecording(rep.data,GAME.rep)
|
||||
|
||||
loadGame(rep.mode,true)
|
||||
resetGameData('r')
|
||||
PLAYERS[1].username=rep.player
|
||||
GAME.init=false
|
||||
GAME.saved=true
|
||||
GAME.fromRepMenu=true
|
||||
GAME.tasUsed=rep.tasUsed
|
||||
else
|
||||
MES.new('error',("No mode id: [%s]"):format(rep.mode))
|
||||
end
|
||||
loadGame(rep.mode,true)
|
||||
resetGameData('r')
|
||||
PLAYERS[1].username=rep.player
|
||||
GAME.init=false
|
||||
GAME.saved=true
|
||||
GAME.fromRepMenu=true
|
||||
GAME.tasUsed=rep.tasUsed
|
||||
else
|
||||
MES.new('error',("No mode id: [%s]"):format(rep.mode))
|
||||
end
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
sure=0
|
||||
listBox:setList(REPLAY)
|
||||
local hide=listBox:getLen()==0
|
||||
for i=3,5 do
|
||||
scene.widgetList[i].hide=hide
|
||||
end
|
||||
sure=0
|
||||
listBox:setList(REPLAY)
|
||||
local hide=listBox:getLen()==0
|
||||
for i=3,5 do
|
||||
scene.widgetList[i].hide=hide
|
||||
end
|
||||
end
|
||||
|
||||
function scene.keyDown(key)
|
||||
if key=="return"then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
_playRep(rep.fileName)
|
||||
end
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
if rep.available and rep.fileName then
|
||||
local repStr=FILE.load(rep.fileName)
|
||||
if repStr then
|
||||
love.system.setClipboardText(love.data.encode('string','base64',repStr))
|
||||
MES.new('info',text.exportSuccess)
|
||||
else
|
||||
MES.new('error',text.replayBroken)
|
||||
end
|
||||
else
|
||||
MES.new('error',text.replayBroken)
|
||||
end
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local repStr=love.system.getClipboardText()
|
||||
local res,fileData=pcall(love.data.decode,'string','base64',repStr)
|
||||
if res then
|
||||
local fileName=os.date("replay/%Y_%m_%d_%H%M%S_import.rep")
|
||||
local rep=DATA.parseReplayData(fileName,fileData,false)
|
||||
if rep.available then
|
||||
if FILE.save(fileData,fileName,'d')then
|
||||
table.insert(REPLAY,1,rep)
|
||||
MES.new('info',text.importSuccess)
|
||||
end
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="delete"then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
if sure>.3 then
|
||||
sure=0
|
||||
listBox:remove()
|
||||
love.filesystem.remove(rep.fileName)
|
||||
for i=1,#REPLAY do
|
||||
if REPLAY[i].fileName==rep.fileName then
|
||||
table.remove(REPLAY,i)
|
||||
break
|
||||
end
|
||||
end
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
if key=="return"then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
_playRep(rep.fileName)
|
||||
end
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
if rep.available and rep.fileName then
|
||||
local repStr=FILE.load(rep.fileName)
|
||||
if repStr then
|
||||
love.system.setClipboardText(love.data.encode('string','base64',repStr))
|
||||
MES.new('info',text.exportSuccess)
|
||||
else
|
||||
MES.new('error',text.replayBroken)
|
||||
end
|
||||
else
|
||||
MES.new('error',text.replayBroken)
|
||||
end
|
||||
end
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local repStr=love.system.getClipboardText()
|
||||
local res,fileData=pcall(love.data.decode,'string','base64',repStr)
|
||||
if res then
|
||||
local fileName=os.date("replay/%Y_%m_%d_%H%M%S_import.rep")
|
||||
local rep=DATA.parseReplayData(fileName,fileData,false)
|
||||
if rep.available then
|
||||
if FILE.save(fileData,fileName,'d')then
|
||||
table.insert(REPLAY,1,rep)
|
||||
MES.new('info',text.importSuccess)
|
||||
end
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
elseif key=="delete"then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
if sure>.3 then
|
||||
sure=0
|
||||
listBox:remove()
|
||||
love.filesystem.remove(rep.fileName)
|
||||
for i=1,#REPLAY do
|
||||
if REPLAY[i].fileName==rep.fileName then
|
||||
table.remove(REPLAY,i)
|
||||
break
|
||||
end
|
||||
end
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
end
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then sure=sure-dt end
|
||||
if sure>0 then sure=sure-dt end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Confirm delete
|
||||
if sure>0 then
|
||||
gc_setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,930,640,nil,.9)
|
||||
end
|
||||
--Confirm delete
|
||||
if sure>0 then
|
||||
gc_setColor(1,1,1,sure)
|
||||
mDraw(TEXTURE.sure,930,640,nil,.9)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
listBox,
|
||||
WIDGET.newButton{name="export",x=200,y=640,w=70,color='lG',code=pressKey"cC",fText=GC.DO{50,50,{'fRect',8,44,34,4},{'fRect',22,17,6,23},{'fPoly',25,5,10,20,40,20}}},
|
||||
WIDGET.newButton{name="import",x=300,y=640,w=70,color='lN',code=pressKey"cV",fText=GC.DO{50,50,{'fRect',8,44,34,4},{'fRect',22,5,6,23},{'fPoly',25,40,10,25,40,25}}},
|
||||
WIDGET.newButton{name="play",x=700,y=640,w=170,h=80,color='lY',code=pressKey"return",fText=GC.DO{50,50,{'fPoly',10,0,49,24,10,49}}},
|
||||
WIDGET.newButton{name="delete",x=850,y=640,w=80,h=80,color='lR',code=pressKey"delete",fText=GC.DO{50,50,{'setLW',8},{'line',5,5,45,45},{'line',5,45,45,5}}},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
listBox,
|
||||
WIDGET.newButton{name="export",x=200,y=640,w=70,color='lG',code=pressKey"cC",fText=GC.DO{50,50,{'fRect',8,44,34,4},{'fRect',22,17,6,23},{'fPoly',25,5,10,20,40,20}}},
|
||||
WIDGET.newButton{name="import",x=300,y=640,w=70,color='lN',code=pressKey"cV",fText=GC.DO{50,50,{'fRect',8,44,34,4},{'fRect',22,5,6,23},{'fPoly',25,40,10,25,40,25}}},
|
||||
WIDGET.newButton{name="play", x=700,y=640,w=170,h=80,color='lY',code=pressKey"return",fText=GC.DO{50,50,{'fPoly',10,0,49,24,10,49}}},
|
||||
WIDGET.newButton{name="delete",x=850,y=640,w=80,h=80,color='lR',code=pressKey"delete",fText=GC.DO{50,50,{'setLW',8},{'line',5,5,45,45},{'line',5,45,45,5}}},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,88 +1,88 @@
|
||||
local scene={}
|
||||
|
||||
local function _dumpCB(T)
|
||||
love.system.setClipboardText(STRING.packText(TABLE.dump(T)))
|
||||
MES.new('check',text.exportSuccess)
|
||||
love.system.setClipboardText(STRING.packText(TABLE.dump(T)))
|
||||
MES.new('check',text.exportSuccess)
|
||||
end
|
||||
local function _parseCB()
|
||||
local _
|
||||
local s=love.system.getClipboardText()
|
||||
local _
|
||||
local s=love.system.getClipboardText()
|
||||
|
||||
--Decode
|
||||
s=STRING.unpackText(s)
|
||||
if not s then MES.new('error',text.dataCorrupted)return end
|
||||
--Decode
|
||||
s=STRING.unpackText(s)
|
||||
if not s then MES.new('error',text.dataCorrupted)return end
|
||||
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
setfenv(s,NONE)
|
||||
return s()
|
||||
end
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
setfenv(s,NONE)
|
||||
return s()
|
||||
end
|
||||
end
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="export", x=55,y=45,color='lY',align='L',font=50},
|
||||
WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS)end},
|
||||
WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT)end},
|
||||
WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING)end},
|
||||
WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_org)end},
|
||||
WIDGET.newText{name="export", x=55,y=45,color='lY',align='L',font=50},
|
||||
WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS)end},
|
||||
WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT)end},
|
||||
WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING)end},
|
||||
WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_org)end},
|
||||
|
||||
WIDGET.newText{name="import", x=55,y=265,color='lR',align='L',font=50},
|
||||
WIDGET.newButton{name="unlock", x=190,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.cover(D,RANKS)
|
||||
for k,v in next,oldModeNameTable do
|
||||
if RANKS[k]then
|
||||
RANKS[v]=RANKS[k]
|
||||
RANKS[k]=nil
|
||||
end
|
||||
end
|
||||
saveProgress()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="data", x=490,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D and D.version==STAT.version then
|
||||
TABLE.update(D,STAT)
|
||||
saveStats()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="setting", x=790,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.update(D,SETTING)
|
||||
applySettings()
|
||||
saveSettings()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="vk", x=1090,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
FILE.save(VK_org,'conf/virtualkey')
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newText{name="import", x=55,y=265,color='lR',align='L',font=50},
|
||||
WIDGET.newButton{name="unlock", x=190,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.cover(D,RANKS)
|
||||
for k,v in next,oldModeNameTable do
|
||||
if RANKS[k]then
|
||||
RANKS[v]=RANKS[k]
|
||||
RANKS[k]=nil
|
||||
end
|
||||
end
|
||||
saveProgress()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="data", x=490,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D and D.version==STAT.version then
|
||||
TABLE.update(D,STAT)
|
||||
saveStats()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="setting", x=790,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.update(D,SETTING)
|
||||
applySettings()
|
||||
saveSettings()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="vk", x=1090,y=390,w=280,h=100,color='lR',
|
||||
code=function()
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
FILE.save(VK_org,'conf/virtualkey')
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
MES.new('error',text.dataCorrupted)
|
||||
end
|
||||
end},
|
||||
|
||||
WIDGET.newText{name="couldSave", x=55,y=485,color='lB',align='L',font=50},
|
||||
WIDGET.newText{name="notLogin", x=55,y=550,color='dB',align='L',font=30,hideF=function()return WS.status('user')=='running'end},
|
||||
WIDGET.newButton{name="upload", x=190,y=610,w=280,h=90,color='lB',font=25,code=NET.uploadSave,hideF=function()return WS.status('user')~='running'end},
|
||||
WIDGET.newButton{name="download", x=490,y=610,w=280,h=90,color='lB',font=25,code=NET.downloadSave,hideF=function()return WS.status('user')~='running'end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newText{name="couldSave", x=55,y=485,color='lB',align='L',font=50},
|
||||
WIDGET.newText{name="notLogin", x=55,y=550,color='dB',align='L',font=30,hideF=function()return WS.status('user')=='running'end},
|
||||
WIDGET.newButton{name="upload", x=190,y=610,w=280,h=90,color='lB',font=25,code=NET.uploadSave,hideF=function()return WS.status('user')~='running'end},
|
||||
WIDGET.newButton{name="download", x=490,y=610,w=280,h=90,color='lB',font=25,code=NET.downloadSave,hideF=function()return WS.status('user')~='running'end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -6,101 +6,101 @@ local das,arr
|
||||
local pos,dir,wait
|
||||
|
||||
function scene.sceneInit()
|
||||
das,arr=SETTING.das,SETTING.arr
|
||||
pos,dir,wait=0,1,30
|
||||
BG.set('bg1')
|
||||
das,arr=SETTING.das,SETTING.arr
|
||||
pos,dir,wait=0,1,30
|
||||
BG.set('bg1')
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if wait>0 then
|
||||
wait=wait-1
|
||||
if wait==0 then
|
||||
pos=pos+(das==0 and 2 or 1)*dir
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
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
|
||||
pos=pos+dir
|
||||
end
|
||||
end
|
||||
else
|
||||
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 pos%8==0 then
|
||||
dir=-dir
|
||||
wait=26
|
||||
das=SETTING.das
|
||||
end
|
||||
end
|
||||
if wait>0 then
|
||||
wait=wait-1
|
||||
if wait==0 then
|
||||
pos=pos+(das==0 and 2 or 1)*dir
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
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
|
||||
pos=pos+dir
|
||||
end
|
||||
end
|
||||
else
|
||||
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 pos%8==0 then
|
||||
dir=-dir
|
||||
wait=26
|
||||
das=SETTING.das
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.translate(550,600)
|
||||
gc.translate(550,600)
|
||||
|
||||
--Testing grid line
|
||||
gc.setLineWidth(4)
|
||||
gc.setColor(1,1,1,.4)
|
||||
gc.line(0,0,400,0)
|
||||
gc.line(0,40,400,40)
|
||||
gc.line(0,80,400,80)
|
||||
for x=40,360,40 do
|
||||
gc.line(x,-10,x,90)
|
||||
end
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.line(0,-10,0,90)
|
||||
gc.line(400,-10,400,90)
|
||||
--Testing grid line
|
||||
gc.setLineWidth(4)
|
||||
gc.setColor(1,1,1,.4)
|
||||
gc.line(0,0,400,0)
|
||||
gc.line(0,40,400,40)
|
||||
gc.line(0,80,400,80)
|
||||
for x=40,360,40 do
|
||||
gc.line(x,-10,x,90)
|
||||
end
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.line(0,-10,0,90)
|
||||
gc.line(400,-10,400,90)
|
||||
|
||||
--O mino animation
|
||||
gc.setColor(1,1,1)
|
||||
local O=SKIN.lib[SETTING.skinSet][SETTING.skin[6]]
|
||||
gc.draw(O,40*pos,0,nil,40/30)
|
||||
gc.draw(O,40*pos,40,nil,40/30)
|
||||
gc.draw(O,40*pos+40,0,nil,40/30)
|
||||
gc.draw(O,40*pos+40,40,nil,40/30)
|
||||
gc.translate(-550,-600)
|
||||
--O mino animation
|
||||
gc.setColor(1,1,1)
|
||||
local O=SKIN.lib[SETTING.skinSet][SETTING.skin[6]]
|
||||
gc.draw(O,40*pos,0,nil,40/30)
|
||||
gc.draw(O,40*pos,40,nil,40/30)
|
||||
gc.draw(O,40*pos+40,0,nil,40/30)
|
||||
gc.draw(O,40*pos+40,40,nil,40/30)
|
||||
gc.translate(-550,-600)
|
||||
end
|
||||
|
||||
local function _sliderShow(S)
|
||||
S=S.disp()
|
||||
return S.."F "..math.floor(S*16.67).."ms"
|
||||
S=S.disp()
|
||||
return S.."F "..math.floor(S*16.67).."ms"
|
||||
end
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newText{name="preview", x=520, y=610,font=40,align='R'},
|
||||
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
|
||||
WIDGET.newText{name="preview", x=520, y=610,font=40,align='R'},
|
||||
|
||||
WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=_sliderShow,code=SETsto("das")},
|
||||
WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=_sliderShow,code=SETsto("arr")},
|
||||
WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"),show=_sliderShow,code=SETsto("sddas")},
|
||||
WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"),show=_sliderShow,code=SETsto("sdarr")},
|
||||
WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"),show=_sliderShow,code=SETsto("dascut")},
|
||||
WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=_sliderShow,code=SETsto("dropcut")},
|
||||
WIDGET.newSwitch{name="ihs", x=1100, y=260, disp=SETval("ihs"), code=SETrev("ihs")},
|
||||
WIDGET.newSwitch{name="irs", x=1100, y=330, disp=SETval("irs"), code=SETrev("irs")},
|
||||
WIDGET.newSwitch{name="ims", x=1100, y=400, disp=SETval("ims"), code=SETrev("ims")},
|
||||
WIDGET.newButton{name="reset", x=160, y=640,w=200,h=100,color='lR',font=40,
|
||||
code=function()
|
||||
local _=SETTING
|
||||
_.das,_.arr,_.dascut=10,2,0
|
||||
_.sddas,_.sdarr=0,2
|
||||
_.ihs,_.irs,_.ims=false,false,false
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=_sliderShow,code=SETsto("das")},
|
||||
WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=_sliderShow,code=SETsto("arr")},
|
||||
WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"), show=_sliderShow,code=SETsto("sddas")},
|
||||
WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"), show=_sliderShow,code=SETsto("sdarr")},
|
||||
WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"), show=_sliderShow,code=SETsto("dascut")},
|
||||
WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=_sliderShow,code=SETsto("dropcut")},
|
||||
WIDGET.newSwitch{name="ihs", x=1100, y=260, disp=SETval("ihs"), code=SETrev("ihs")},
|
||||
WIDGET.newSwitch{name="irs", x=1100, y=330, disp=SETval("irs"), code=SETrev("irs")},
|
||||
WIDGET.newSwitch{name="ims", x=1100, y=400, disp=SETval("ims"), code=SETrev("ims")},
|
||||
WIDGET.newButton{name="reset", x=160, y=640,w=200,h=100,color='lR',font=40,
|
||||
code=function()
|
||||
local _=SETTING
|
||||
_.das,_.arr,_.dascut=10,2,0
|
||||
_.sddas,_.sdarr=0,2
|
||||
_.ihs,_.irs,_.ims=false,false,false
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,61 +3,61 @@ local gc=love.graphics
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
BG.set()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
saveSettings()
|
||||
saveSettings()
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.push('transform')
|
||||
gc.translate(410,540-WIDGET.scrollPos)
|
||||
gc.push('transform')
|
||||
gc.translate(410,540-WIDGET.scrollPos)
|
||||
|
||||
--Draw mino
|
||||
local t=TIME()
|
||||
local b=math.floor(t*2)%16+1
|
||||
gc.setShader(SHADER.blockSatur)
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(SKIN.lib[SETTING.skinSet][b],0,0,t%6.2832,2)
|
||||
gc.setColor(1,1,1,t*2%1)
|
||||
mDraw(SKIN.lib[SETTING.skinSet][b%16+1],0,0,t%6.2832,2)
|
||||
gc.setShader()
|
||||
--Draw mino
|
||||
local t=TIME()
|
||||
local b=math.floor(t*2)%16+1
|
||||
gc.setShader(SHADER.blockSatur)
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(SKIN.lib[SETTING.skinSet][b],0,0,t%6.2832,2)
|
||||
gc.setColor(1,1,1,t*2%1)
|
||||
mDraw(SKIN.lib[SETTING.skinSet][b%16+1],0,0,t%6.2832,2)
|
||||
gc.setShader()
|
||||
|
||||
--Draw center
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(RSlist[SETTING.RS].centerTex,0,0,0,1.2)
|
||||
--Draw center
|
||||
gc.setColor(1,1,1)
|
||||
mDraw(RSlist[SETTING.RS].centerTex,0,0,0,1.2)
|
||||
|
||||
gc.pop()
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
scene.widgetScrollHeight=200
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=640,y=15,font=80},
|
||||
WIDGET.newText{name="title", x=640,y=15,font=80},
|
||||
|
||||
WIDGET.newButton{name="graphic", x=200, y=80, w=240,h=80, color='lC',font=35,code=swapScene('setting_video','swipeR')},
|
||||
WIDGET.newButton{name="sound", x=1080, y=80, w=240,h=80, color='lC',font=35,code=swapScene('setting_sound','swipeL')},
|
||||
WIDGET.newButton{name="graphic", x=200, y=80, w=240,h=80,color='lC',font=35,code=swapScene('setting_video','swipeR')},
|
||||
WIDGET.newButton{name="sound", x=1080, y=80, w=240,h=80,color='lC',font=35,code=swapScene('setting_sound','swipeL')},
|
||||
|
||||
WIDGET.newButton{name="ctrl", x=290, y=220, w=320,h=80, color='lY',font=35,code=goScene'setting_control'},
|
||||
WIDGET.newButton{name="key", x=640, y=220, w=320,h=80, color='lG',font=35,code=goScene'setting_key'},
|
||||
WIDGET.newButton{name="touch", x=990, y=220, w=320,h=80, color='lB',font=35,code=goScene'setting_touch'},
|
||||
WIDGET.newSlider{name="reTime", x=330, y=320, w=300,unit=10,disp=SETval("reTime"),code=SETsto("reTime"),show=function(S)return(.5+S.disp()*.25).."s"end},
|
||||
WIDGET.newSelector{name="RS", x=300, y=420, w=300,color='S',list={'TRS','SRS','SRS_plus','SRS_X','BiRS','ARS_Z','ASC','ASC_plus','C2','C2_sym','Classic','Classic_plus','None','None_plus'},disp=SETval("RS"),code=SETsto("RS")},
|
||||
WIDGET.newButton{name="layout", x=250, y=540, w=200,h=70,font=35, code=goScene'setting_skin'},
|
||||
WIDGET.newSwitch{name="autoPause", x=1060, y=320, disp=SETval("autoPause"), code=SETrev("autoPause")},
|
||||
WIDGET.newSelector{name="menuPos", x=980, y=420, w=300,color='O',list={'left','middle','right'},disp=SETval("menuPos"),code=SETsto("menuPos")},
|
||||
WIDGET.newSwitch{name="swap", x=1060, y=520, disp=SETval("swap"), code=SETrev("swap")},
|
||||
WIDGET.newSwitch{name="autoSave", x=600, y=800, disp=SETval("autoSave"), code=SETrev("autoSave")},
|
||||
WIDGET.newSwitch{name="simpMode", x=1060, y=800, disp=SETval("simpMode"),
|
||||
code=function()
|
||||
SETTING.simpMode=not SETTING.simpMode
|
||||
for i=1,#SCN.stack,2 do
|
||||
if SCN.stack[i]=='main'or SCN.stack[i]=='main_simple'then
|
||||
SCN.stack[i]=SETTING.simpMode and'main_simple'or'main'
|
||||
break
|
||||
end
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="ctrl", x=290, y=220, w=320,h=80,color='lY',font=35,code=goScene'setting_control'},
|
||||
WIDGET.newButton{name="key", x=640, y=220, w=320,h=80,color='lG',font=35,code=goScene'setting_key'},
|
||||
WIDGET.newButton{name="touch", x=990, y=220, w=320,h=80,color='lB',font=35,code=goScene'setting_touch'},
|
||||
WIDGET.newSlider{name="reTime", x=330, y=320, w=300,unit=10,disp=SETval("reTime"),code=SETsto("reTime"),show=function(S)return(.5+S.disp()*.25).."s"end},
|
||||
WIDGET.newSelector{name="RS", x=300, y=420, w=300,color='S',list={'TRS','SRS','SRS_plus','SRS_X','BiRS','ARS_Z','ASC','ASC_plus','C2','C2_sym','Classic','Classic_plus','None','None_plus'},disp=SETval("RS"),code=SETsto("RS")},
|
||||
WIDGET.newButton{name="layout", x=250, y=540, w=200,h=70,font=35, code=goScene'setting_skin'},
|
||||
WIDGET.newSwitch{name="autoPause", x=1060, y=320, disp=SETval("autoPause"),code=SETrev("autoPause")},
|
||||
WIDGET.newSelector{name="menuPos", x=980, y=420, w=300,color='O',list={'left','middle','right'},disp=SETval("menuPos"),code=SETsto("menuPos")},
|
||||
WIDGET.newSwitch{name="swap", x=1060, y=520, disp=SETval("swap"), code=SETrev("swap")},
|
||||
WIDGET.newSwitch{name="autoSave", x=600, y=800, disp=SETval("autoSave"), code=SETrev("autoSave")},
|
||||
WIDGET.newSwitch{name="simpMode", x=1060, y=800, disp=SETval("simpMode"),
|
||||
code=function()
|
||||
SETTING.simpMode=not SETTING.simpMode
|
||||
for i=1,#SCN.stack,2 do
|
||||
if SCN.stack[i]=='main'or SCN.stack[i]=='main_simple'then
|
||||
SCN.stack[i]=SETTING.simpMode and'main_simple'or'main'
|
||||
break
|
||||
end
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -8,139 +8,139 @@ local selected--if waiting for key
|
||||
local keyList
|
||||
|
||||
local function _freshKeyList()
|
||||
keyList={}for i=0,20 do keyList[i]={}end
|
||||
for k,v in next,keyMap.keyboard do
|
||||
ins(keyList[v],{COLOR.lB,k})
|
||||
end
|
||||
for k,v in next,keyMap.joystick do
|
||||
ins(keyList[v],{COLOR.lR,k})
|
||||
end
|
||||
keyList={}for i=0,20 do keyList[i]={}end
|
||||
for k,v in next,keyMap.keyboard do
|
||||
ins(keyList[v],{COLOR.lB,k})
|
||||
end
|
||||
for k,v in next,keyMap.joystick do
|
||||
ins(keyList[v],{COLOR.lR,k})
|
||||
end
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
selected=false
|
||||
_freshKeyList()
|
||||
BG.set('none')
|
||||
selected=false
|
||||
_freshKeyList()
|
||||
BG.set('none')
|
||||
end
|
||||
function scene.sceneBack()
|
||||
FILE.save(keyMap,'conf/key')
|
||||
FILE.save(keyMap,'conf/key')
|
||||
end
|
||||
|
||||
local forbbidenKeys={
|
||||
["\\"]=true,
|
||||
["return"]=true,
|
||||
["\\"]=true,
|
||||
["return"]=true,
|
||||
}
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
if selected then
|
||||
for k,v in next,keyMap.keyboard do
|
||||
if v==selected then
|
||||
keyMap.keyboard[k]=nil
|
||||
end
|
||||
end
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('finesseError',.5)
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif selected then
|
||||
if not forbbidenKeys[key]then
|
||||
keyMap.keyboard[key]=selected
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('reach',.5)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
if selected then
|
||||
for k,v in next,keyMap.keyboard do
|
||||
if v==selected then
|
||||
keyMap.keyboard[k]=nil
|
||||
end
|
||||
end
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('finesseError',.5)
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif selected then
|
||||
if not forbbidenKeys[key]then
|
||||
keyMap.keyboard[key]=selected
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('reach',.5)
|
||||
end
|
||||
else
|
||||
WIDGET.keyPressed(key)
|
||||
end
|
||||
end
|
||||
function scene.gamepadDown(key)
|
||||
if key=="back"then
|
||||
if selected then
|
||||
for k,v in next,keyMap.joystick do
|
||||
if v==selected then
|
||||
keyMap.joystick[k]=nil
|
||||
end
|
||||
end
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('finesseError',.5)
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif selected then
|
||||
keyMap.joystick[key]=selected
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('reach',.5)
|
||||
else
|
||||
WIDGET.gamepadPressed(key)
|
||||
end
|
||||
if key=="back"then
|
||||
if selected then
|
||||
for k,v in next,keyMap.joystick do
|
||||
if v==selected then
|
||||
keyMap.joystick[k]=nil
|
||||
end
|
||||
end
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('finesseError',.5)
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif selected then
|
||||
keyMap.joystick[key]=selected
|
||||
_freshKeyList()
|
||||
selected=false
|
||||
SFX.play('reach',.5)
|
||||
else
|
||||
WIDGET.gamepadPressed(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(15)
|
||||
gc.setColor(COLOR.Z)
|
||||
setFont(15)
|
||||
gc.setColor(COLOR.Z)
|
||||
|
||||
for i=0,20 do
|
||||
for j=1,#keyList[i]do
|
||||
local key=keyList[i][j]
|
||||
local font=#key[2]==1 and 40 or #key[2]<6 and 30 or 15
|
||||
setFont(font)
|
||||
mStr(key,
|
||||
(i>10 and 940 or 210)+100*j,
|
||||
i>10 and 60*(i-10)-23-font*.7 or
|
||||
i>0 and 60*i-23-font*.7 or
|
||||
667-font*.7
|
||||
)
|
||||
end
|
||||
end
|
||||
for i=0,20 do
|
||||
for j=1,#keyList[i]do
|
||||
local key=keyList[i][j]
|
||||
local font=#key[2]==1 and 40 or #key[2]<6 and 30 or 15
|
||||
setFont(font)
|
||||
mStr(key,
|
||||
(i>10 and 940 or 210)+100*j,
|
||||
i>10 and 60*(i-10)-23-font*.7 or
|
||||
i>0 and 60*i-23-font*.7 or
|
||||
667-font*.7
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
if selected then
|
||||
gc.setColor(COLOR[TIME()%.26<.13 and'R'or'Y'])
|
||||
local x,y=selected>10 and 910 or 270, selected>10 and 60*(selected-10)-50 or selected>0 and 60*selected-50 or 630
|
||||
setFont(40)gc.print("=",x,y)
|
||||
setFont(10)gc.print("esc?",x,y+40)
|
||||
end
|
||||
if selected then
|
||||
gc.setColor(COLOR[TIME()%.26<.13 and'R'or'Y'])
|
||||
local x,y=selected>10 and 910 or 270, selected>10 and 60*(selected-10)-50 or selected>0 and 60*selected-50 or 630
|
||||
setFont(40)gc.print("=",x,y)
|
||||
setFont(10)gc.print("esc?",x,y+40)
|
||||
end
|
||||
end
|
||||
|
||||
local function _setSel(i)
|
||||
if selected==i then
|
||||
selected=false
|
||||
SFX.play('rotate',.5)
|
||||
else
|
||||
selected=i
|
||||
SFX.play('lock',.5)
|
||||
end
|
||||
if selected==i then
|
||||
selected=false
|
||||
SFX.play('rotate',.5)
|
||||
else
|
||||
selected=i
|
||||
SFX.play('lock',.5)
|
||||
end
|
||||
end
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="a1",x=160,y=40,w=200,h=60,code=function()_setSel(1)end},
|
||||
WIDGET.newKey{name="a2",x=160,y=100,w=200,h=60,code=function()_setSel(2)end},
|
||||
WIDGET.newKey{name="a3",x=160,y=160,w=200,h=60,code=function()_setSel(3)end},
|
||||
WIDGET.newKey{name="a4",x=160,y=220,w=200,h=60,code=function()_setSel(4)end},
|
||||
WIDGET.newKey{name="a5",x=160,y=280,w=200,h=60,code=function()_setSel(5)end},
|
||||
WIDGET.newKey{name="a6",x=160,y=340,w=200,h=60,code=function()_setSel(6)end},
|
||||
WIDGET.newKey{name="a7",x=160,y=400,w=200,h=60,code=function()_setSel(7)end},
|
||||
WIDGET.newKey{name="a8",x=160,y=460,w=200,h=60,code=function()_setSel(8)end},
|
||||
WIDGET.newKey{name="a9",x=160,y=520,w=200,h=60,code=function()_setSel(9)end},
|
||||
WIDGET.newKey{name="a10",x=160,y=580,w=200,h=60,code=function()_setSel(10)end},
|
||||
WIDGET.newKey{name="a1",x=160,y=40,w=200,h=60,code=function()_setSel(1)end},
|
||||
WIDGET.newKey{name="a2",x=160,y=100,w=200,h=60,code=function()_setSel(2)end},
|
||||
WIDGET.newKey{name="a3",x=160,y=160,w=200,h=60,code=function()_setSel(3)end},
|
||||
WIDGET.newKey{name="a4",x=160,y=220,w=200,h=60,code=function()_setSel(4)end},
|
||||
WIDGET.newKey{name="a5",x=160,y=280,w=200,h=60,code=function()_setSel(5)end},
|
||||
WIDGET.newKey{name="a6",x=160,y=340,w=200,h=60,code=function()_setSel(6)end},
|
||||
WIDGET.newKey{name="a7",x=160,y=400,w=200,h=60,code=function()_setSel(7)end},
|
||||
WIDGET.newKey{name="a8",x=160,y=460,w=200,h=60,code=function()_setSel(8)end},
|
||||
WIDGET.newKey{name="a9",x=160,y=520,w=200,h=60,code=function()_setSel(9)end},
|
||||
WIDGET.newKey{name="a10",x=160,y=580,w=200,h=60,code=function()_setSel(10)end},
|
||||
|
||||
WIDGET.newKey{name="a11",x=800,y=40,w=200,h=60,code=function()_setSel(11)end},
|
||||
WIDGET.newKey{name="a12",x=800,y=100,w=200,h=60,code=function()_setSel(12)end},
|
||||
WIDGET.newKey{name="a13",x=800,y=160,w=200,h=60,code=function()_setSel(13)end},
|
||||
WIDGET.newKey{name="a14",x=800,y=220,w=200,h=60,code=function()_setSel(14)end},
|
||||
WIDGET.newKey{name="a15",x=800,y=280,w=200,h=60,code=function()_setSel(15)end},
|
||||
WIDGET.newKey{name="a16",x=800,y=340,w=200,h=60,code=function()_setSel(16)end},
|
||||
WIDGET.newKey{name="a17",x=800,y=400,w=200,h=60,code=function()_setSel(17)end},
|
||||
WIDGET.newKey{name="a18",x=800,y=460,w=200,h=60,code=function()_setSel(18)end},
|
||||
WIDGET.newKey{name="a19",x=800,y=520,w=200,h=60,code=function()_setSel(19)end},
|
||||
WIDGET.newKey{name="a20",x=800,y=580,w=200,h=60,code=function()_setSel(20)end},
|
||||
WIDGET.newKey{name="a11",x=800,y=40,w=200,h=60,code=function()_setSel(11)end},
|
||||
WIDGET.newKey{name="a12",x=800,y=100,w=200,h=60,code=function()_setSel(12)end},
|
||||
WIDGET.newKey{name="a13",x=800,y=160,w=200,h=60,code=function()_setSel(13)end},
|
||||
WIDGET.newKey{name="a14",x=800,y=220,w=200,h=60,code=function()_setSel(14)end},
|
||||
WIDGET.newKey{name="a15",x=800,y=280,w=200,h=60,code=function()_setSel(15)end},
|
||||
WIDGET.newKey{name="a16",x=800,y=340,w=200,h=60,code=function()_setSel(16)end},
|
||||
WIDGET.newKey{name="a17",x=800,y=400,w=200,h=60,code=function()_setSel(17)end},
|
||||
WIDGET.newKey{name="a18",x=800,y=460,w=200,h=60,code=function()_setSel(18)end},
|
||||
WIDGET.newKey{name="a19",x=800,y=520,w=200,h=60,code=function()_setSel(19)end},
|
||||
WIDGET.newKey{name="a20",x=800,y=580,w=200,h=60,code=function()_setSel(20)end},
|
||||
|
||||
WIDGET.newKey{name="restart",x=160,y=670,w=200,h=60,code=function()_setSel(0)end},
|
||||
WIDGET.newKey{name="restart",x=160,y=670,w=200,h=60,code=function()_setSel(0)end},
|
||||
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=190,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=190,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -9,106 +9,106 @@ local minoRot0={}
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
selRS=RSlist[SETTING.RS]
|
||||
for i=1,7 do
|
||||
minoRot0[i]=SETTING.face[i]*1.57
|
||||
minoRot[i]=minoRot0[i]
|
||||
end
|
||||
BG.set()
|
||||
selRS=RSlist[SETTING.RS]
|
||||
for i=1,7 do
|
||||
minoRot0[i]=SETTING.face[i]*1.57
|
||||
minoRot[i]=minoRot0[i]
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
for i=1,7 do
|
||||
minoRot[i]=minoRot[i]*.8+minoRot0[i]*.2
|
||||
end
|
||||
for i=1,7 do
|
||||
minoRot[i]=minoRot[i]*.8+minoRot0[i]*.2
|
||||
end
|
||||
end
|
||||
function scene.draw()
|
||||
local t=TIME()
|
||||
gc.setColor(1,1,1)
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
for n=1,7 do
|
||||
gc.push('transform')
|
||||
gc.translate(-10+140*n,330)
|
||||
gc.rotate(minoRot[n]+sin(t*3-n*.5)*.08)
|
||||
local color=SETTING.skin[n]
|
||||
local B=BLOCKS[n][0]
|
||||
local x,y=-45-selRS.centerPos[n][0][2]*30,15+selRS.centerPos[n][0][1]*30
|
||||
local col=#B[1]
|
||||
for i=1,#B do for j=1,col do
|
||||
if B[i][j]then
|
||||
gc.draw(texture[color],x+30*j,y-30*i)
|
||||
end
|
||||
end end
|
||||
if selRS.centerDisp[n]then
|
||||
mDraw(selRS.centerTex)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
for i=1,5 do
|
||||
gc.draw(texture[19+i],570+60*i,610+sin(2.6*t-i)*5,nil,2)
|
||||
end
|
||||
gc.draw(texture[17],930,610+sin(2.6*t-6)*5,nil,2)
|
||||
local t=TIME()
|
||||
gc.setColor(1,1,1)
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
for n=1,7 do
|
||||
gc.push('transform')
|
||||
gc.translate(-10+140*n,330)
|
||||
gc.rotate(minoRot[n]+sin(t*3-n*.5)*.08)
|
||||
local color=SETTING.skin[n]
|
||||
local B=BLOCKS[n][0]
|
||||
local x,y=-45-selRS.centerPos[n][0][2]*30,15+selRS.centerPos[n][0][1]*30
|
||||
local col=#B[1]
|
||||
for i=1,#B do for j=1,col do
|
||||
if B[i][j]then
|
||||
gc.draw(texture[color],x+30*j,y-30*i)
|
||||
end
|
||||
end end
|
||||
if selRS.centerDisp[n]then
|
||||
mDraw(selRS.centerTex)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
for i=1,5 do
|
||||
gc.draw(texture[19+i],570+60*i,610+sin(2.6*t-i)*5,nil,2)
|
||||
end
|
||||
gc.draw(texture[17],930,610+sin(2.6*t-6)*5,nil,2)
|
||||
end
|
||||
|
||||
local function _prevSkin(i)
|
||||
SETTING.skin[i]=(SETTING.skin[i]-2)%16+1
|
||||
SETTING.skin[i]=(SETTING.skin[i]-2)%16+1
|
||||
end
|
||||
local function _nextSkin(i)
|
||||
SETTING.skin[i]=SETTING.skin[i]%16+1
|
||||
SETTING.skin[i]=SETTING.skin[i]%16+1
|
||||
end
|
||||
local function _nextDir(i)
|
||||
SETTING.face[i]=(SETTING.face[i]+1)%4
|
||||
minoRot0[i]=minoRot0[i]+1.5707963
|
||||
if minoRot0[5]>62 and not GAME.playing then
|
||||
loadGame('marathon_bfmax',true)
|
||||
end
|
||||
SFX.play('rotate')
|
||||
SETTING.face[i]=(SETTING.face[i]+1)%4
|
||||
minoRot0[i]=minoRot0[i]+1.5707963
|
||||
if minoRot0[5]>62 and not GAME.playing then
|
||||
loadGame('marathon_bfmax',true)
|
||||
end
|
||||
SFX.play('rotate')
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
|
||||
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
|
||||
|
||||
WIDGET.newSelector{name="skinSet",x=780,y=100,w=320,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')},
|
||||
WIDGET.newButton{name="prev1", x=130,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(1)end},
|
||||
WIDGET.newButton{name="prev2", x=270,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(2)end},
|
||||
WIDGET.newButton{name="prev3", x=410,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(3)end},
|
||||
WIDGET.newButton{name="prev4", x=550,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(4)end},
|
||||
WIDGET.newButton{name="prev5", x=690,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(5)end},
|
||||
WIDGET.newButton{name="prev6", x=830,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(6)end},
|
||||
WIDGET.newButton{name="prev7", x=970,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(7)end},
|
||||
WIDGET.newSelector{name="skinSet",x=780,y=100,w=320,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')},
|
||||
WIDGET.newButton{name="prev1", x=130,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(1)end},
|
||||
WIDGET.newButton{name="prev2", x=270,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(2)end},
|
||||
WIDGET.newButton{name="prev3", x=410,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(3)end},
|
||||
WIDGET.newButton{name="prev4", x=550,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(4)end},
|
||||
WIDGET.newButton{name="prev5", x=690,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(5)end},
|
||||
WIDGET.newButton{name="prev6", x=830,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(6)end},
|
||||
WIDGET.newButton{name="prev7", x=970,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(7)end},
|
||||
|
||||
WIDGET.newButton{name="next1", x=130,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(1)end},
|
||||
WIDGET.newButton{name="next2", x=270,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(2)end},
|
||||
WIDGET.newButton{name="next3", x=410,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(3)end},
|
||||
WIDGET.newButton{name="next4", x=550,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(4)end},
|
||||
WIDGET.newButton{name="next5", x=690,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(5)end},
|
||||
WIDGET.newButton{name="next6", x=830,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(6)end},
|
||||
WIDGET.newButton{name="next7", x=970,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(7)end},
|
||||
WIDGET.newButton{name="next1", x=130,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(1)end},
|
||||
WIDGET.newButton{name="next2", x=270,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(2)end},
|
||||
WIDGET.newButton{name="next3", x=410,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(3)end},
|
||||
WIDGET.newButton{name="next4", x=550,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(4)end},
|
||||
WIDGET.newButton{name="next5", x=690,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(5)end},
|
||||
WIDGET.newButton{name="next6", x=830,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(6)end},
|
||||
WIDGET.newButton{name="next7", x=970,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(7)end},
|
||||
|
||||
WIDGET.newButton{name="spin1", x=130,y=540,w=80,h=65,code=function()_nextDir(1)end},
|
||||
WIDGET.newButton{name="spin2", x=270,y=540,w=80,h=65,code=function()_nextDir(2)end},
|
||||
WIDGET.newButton{name="spin3", x=410,y=540,w=80,h=65,code=function()_nextDir(3)end},
|
||||
WIDGET.newButton{name="spin4", x=550,y=540,w=80,h=65,code=function()_nextDir(4)end},
|
||||
WIDGET.newButton{name="spin5", x=690,y=540,w=80,h=65,code=function()_nextDir(5)end},
|
||||
WIDGET.newButton{name="spin6", x=825,y=540,w=80,h=65,code=function()_nextDir(6)end},
|
||||
WIDGET.newButton{name="spin7", x=970,y=540,w=80,h=65,code=function()_nextDir(7)end},
|
||||
WIDGET.newButton{name="spin1", x=130,y=540,w=80,h=65,code=function()_nextDir(1)end},
|
||||
WIDGET.newButton{name="spin2", x=270,y=540,w=80,h=65,code=function()_nextDir(2)end},
|
||||
WIDGET.newButton{name="spin3", x=410,y=540,w=80,h=65,code=function()_nextDir(3)end},
|
||||
WIDGET.newButton{name="spin4", x=550,y=540,w=80,h=65,code=function()_nextDir(4)end},
|
||||
WIDGET.newButton{name="spin5", x=690,y=540,w=80,h=65,code=function()_nextDir(5)end},
|
||||
WIDGET.newButton{name="spin6", x=825,y=540,w=80,h=65,code=function()_nextDir(6)end},
|
||||
WIDGET.newButton{name="spin7", x=970,y=540,w=80,h=65,code=function()_nextDir(7)end},
|
||||
|
||||
WIDGET.newButton{name="skinR", x=200,y=640,w=220,h=80,color='lV',font=35,
|
||||
code=function()
|
||||
SETTING.skin={1,7,11,3,14,4,9,1,7,2,6,10,2,13,5,9,15,10,11,3,10,2,16,8,4,10,13,2,8}
|
||||
SFX.play('rotate')
|
||||
end},
|
||||
WIDGET.newButton{name="faceR", x=480,y=640,w=220,h=80,color='lR',font=35,
|
||||
code=function()
|
||||
for i=1,29 do
|
||||
SETTING.face[i]=0
|
||||
end
|
||||
for i=1,7 do
|
||||
minoRot0[i]=(int(minoRot0[i]/6.2831853)+(minoRot0[i]%6.2831853>4 and 1 or 0))*6.2831853
|
||||
end
|
||||
SFX.play('hold')
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="skinR", x=200,y=640,w=220,h=80,color='lV',font=35,
|
||||
code=function()
|
||||
SETTING.skin={1,7,11,3,14,4,9,1,7,2,6,10,2,13,5,9,15,10,11,3,10,2,16,8,4,10,13,2,8}
|
||||
SFX.play('rotate')
|
||||
end},
|
||||
WIDGET.newButton{name="faceR", x=480,y=640,w=220,h=80,color='lR',font=35,
|
||||
code=function()
|
||||
for i=1,29 do
|
||||
SETTING.face[i]=0
|
||||
end
|
||||
for i=1,7 do
|
||||
minoRot0[i]=(int(minoRot0[i]/6.2831853)+(minoRot0[i]%6.2831853>4 and 1 or 0))*6.2831853
|
||||
end
|
||||
SFX.play('hold')
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -11,93 +11,93 @@ local jump--Animation timer(10 to 0)
|
||||
local cv=SETTING.cv
|
||||
|
||||
function scene.sceneInit()
|
||||
last,jump=0,0
|
||||
cv=SETTING.cv
|
||||
WIDGET.active.cv:reset()
|
||||
BG.set()
|
||||
last,jump=0,0
|
||||
cv=SETTING.cv
|
||||
WIDGET.active.cv:reset()
|
||||
BG.set()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
saveSettings()
|
||||
saveSettings()
|
||||
end
|
||||
|
||||
function scene.mouseDown(x,y)
|
||||
if x>780 and x<980 and y>470 and jump==0 then
|
||||
jump=10
|
||||
local t=TIME()-last
|
||||
if t>1 then
|
||||
if t>2.6 and t<3 and not GAME.playing then
|
||||
loadGame('sprintSmooth',true)
|
||||
else
|
||||
VOC.play(
|
||||
(t<1.5 or t>15)and"doubt"or
|
||||
rnd()<.8 and"happy"or
|
||||
"egg"
|
||||
)
|
||||
last=TIME()
|
||||
end
|
||||
end
|
||||
end
|
||||
if x>780 and x<980 and y>470 and jump==0 then
|
||||
jump=10
|
||||
local t=TIME()-last
|
||||
if t>1 then
|
||||
if t>2.6 and t<3 and not GAME.playing then
|
||||
loadGame('sprintSmooth',true)
|
||||
else
|
||||
VOC.play(
|
||||
(t<1.5 or t>15)and"doubt"or
|
||||
rnd()<.8 and"happy"or
|
||||
"egg"
|
||||
)
|
||||
last=TIME()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
if jump>0 then jump=jump-1 end
|
||||
if jump>0 then jump=jump-1 end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(1,1,1)
|
||||
local t=TIME()
|
||||
local x,y=800,340+10*sin(t*.5)+(jump-10)*jump*.3
|
||||
gc.translate(x,y)
|
||||
if cv=="miya"then
|
||||
gc.draw(IMG.miyaCH)
|
||||
gc.setColor(1,1,1,.7)
|
||||
gc.draw(IMG.miyaF1,4,47+4*sin(t*.9))
|
||||
gc.draw(IMG.miyaF2,42,107+5*sin(t))
|
||||
gc.draw(IMG.miyaF3,93,126+3*sin(t*.7))
|
||||
gc.draw(IMG.miyaF4,129,98+3*sin(t*.5))
|
||||
elseif cv=="naki"then
|
||||
gc.draw(IMG.nakiCH,-30)
|
||||
elseif cv=="xiaoya"then
|
||||
gc.draw(IMG.xiaoyaCH,-30)
|
||||
end
|
||||
gc.translate(-x,-y)
|
||||
gc.setColor(1,1,1)
|
||||
local t=TIME()
|
||||
local x,y=800,340+10*sin(t*.5)+(jump-10)*jump*.3
|
||||
gc.translate(x,y)
|
||||
if cv=="miya"then
|
||||
gc.draw(IMG.miyaCH)
|
||||
gc.setColor(1,1,1,.7)
|
||||
gc.draw(IMG.miyaF1,4,47+4*sin(t*.9))
|
||||
gc.draw(IMG.miyaF2,42,107+5*sin(t))
|
||||
gc.draw(IMG.miyaF3,93,126+3*sin(t*.7))
|
||||
gc.draw(IMG.miyaF4,129,98+3*sin(t*.5))
|
||||
elseif cv=="naki"then
|
||||
gc.draw(IMG.nakiCH,-30)
|
||||
elseif cv=="xiaoya"then
|
||||
gc.draw(IMG.xiaoyaCH,-30)
|
||||
end
|
||||
gc.translate(-x,-y)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=640,y=15,font=80},
|
||||
WIDGET.newText{name="title", x=640, y=15,font=80},
|
||||
|
||||
WIDGET.newButton{name="game", x=200, y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_game','swipeR')},
|
||||
WIDGET.newButton{name="graphic",x=1080, y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_video','swipeL')},
|
||||
WIDGET.newButton{name="game", x=200, y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_game','swipeR')},
|
||||
WIDGET.newButton{name="graphic",x=1080,y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_video','swipeL')},
|
||||
|
||||
WIDGET.newSlider{name="bgm", x=300, y=190,w=420,color='lG',disp=SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
|
||||
WIDGET.newSlider{name="sfx", x=300, y=260,w=420,color='lC',change=function()SFX.play('blip_1')end,disp=SETval("sfx"),code=SETsto("sfx")},
|
||||
WIDGET.newSlider{name="stereo", x=300, y=330,w=420,color='lC',change=function()SFX.play('move',1,-1)SFX.play('lock',1,1)end,disp=SETval("stereo"),code=SETsto("stereo"),hideF=function()return SETTING.sx==0 end},
|
||||
WIDGET.newSlider{name="spawn", x=300, y=400,w=420,color='lC',change=function()SFX.fplay('spawn_'..math.random(7),SETTING.sfx_spawn)end,disp=SETval("sfx_spawn"),code=SETsto("sfx_spawn")},
|
||||
WIDGET.newSlider{name="warn", x=300, y=470,w=420,color='lC',change=function()SFX.fplay('warning',SETTING.sfx_warn)end,disp=SETval("sfx_warn"),code=SETsto("sfx_warn")},
|
||||
WIDGET.newSlider{name="vib", x=300, y=540,w=420,color='lN',unit=10,change=function()VIB(2)end,disp=SETval("vib"),code=SETsto("vib")},
|
||||
WIDGET.newSlider{name="voc", x=300, y=610,w=420,color='lN',change=function()VOC.play('test')end,disp=SETval("voc"),code=SETsto("voc")},
|
||||
WIDGET.newSlider{name="bgm", x=300, y=190,w=420,color='lG',disp=SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
|
||||
WIDGET.newSlider{name="sfx", x=300, y=260,w=420,color='lC',change=function()SFX.play('blip_1')end,disp=SETval("sfx"),code=SETsto("sfx")},
|
||||
WIDGET.newSlider{name="stereo", x=300, y=330,w=420,color='lC',change=function()SFX.play('move',1,-1)SFX.play('lock',1,1)end,disp=SETval("stereo"),code=SETsto("stereo"),hideF=function()return SETTING.sx==0 end},
|
||||
WIDGET.newSlider{name="spawn", x=300, y=400,w=420,color='lC',change=function()SFX.fplay('spawn_'..math.random(7),SETTING.sfx_spawn)end,disp=SETval("sfx_spawn"),code=SETsto("sfx_spawn")},
|
||||
WIDGET.newSlider{name="warn", x=300, y=470,w=420,color='lC',change=function()SFX.fplay('warning',SETTING.sfx_warn)end,disp=SETval("sfx_warn"),code=SETsto("sfx_warn")},
|
||||
WIDGET.newSlider{name="vib", x=300, y=540,w=420,color='lN',unit=10,change=function()VIB(2)end,disp=SETval("vib"),code=SETsto("vib")},
|
||||
WIDGET.newSlider{name="voc", x=300, y=610,w=420,color='lN',change=function()VOC.play('test')end,disp=SETval("voc"),code=SETsto("voc")},
|
||||
|
||||
WIDGET.newKey{name="mute", x=1160, y=180,w=80,color='lR',fText=TEXTURE.mute,
|
||||
code=function()
|
||||
if SETTING.sfx+SETTING.sfx_spawn+SETTING.sfx_warn+SETTING.bgm+SETTING.vib+SETTING.voc==0 then
|
||||
if not soundBeforeMute then soundBeforeMute={1,0,.4,.7,0,0}end
|
||||
SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc=unpack(soundBeforeMute)
|
||||
soundBeforeMute=false
|
||||
else
|
||||
soundBeforeMute={
|
||||
SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc}
|
||||
SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc=0,0,0,0,0,0
|
||||
end
|
||||
BGM.freshVolume()
|
||||
end},
|
||||
WIDGET.newSwitch{name="fine", x=1150, y=270,disp=SETval("fine"),code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6)end end},
|
||||
WIDGET.newKey{name="mute", x=1160,y=180,w=80,color='lR',fText=TEXTURE.mute,
|
||||
code=function()
|
||||
if SETTING.sfx+SETTING.sfx_spawn+SETTING.sfx_warn+SETTING.bgm+SETTING.vib+SETTING.voc==0 then
|
||||
if not soundBeforeMute then soundBeforeMute={1,0,.4,.7,0,0}end
|
||||
SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc=unpack(soundBeforeMute)
|
||||
soundBeforeMute=false
|
||||
else
|
||||
soundBeforeMute={
|
||||
SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc}
|
||||
SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc=0,0,0,0,0,0
|
||||
end
|
||||
BGM.freshVolume()
|
||||
end},
|
||||
WIDGET.newSwitch{name="fine", x=1150,y=270,disp=SETval("fine"),code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6)end end},
|
||||
|
||||
WIDGET.newSelector{name="cv", x=1100, y=380,w=200,list={'miya','naki','xiaoya'},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,hideF=function()return SETTING.cv==cv end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newSelector{name="cv", x=1100,y=380,w=200,list={'miya','naki','xiaoya'},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,hideF=function()return SETTING.cv==cv end},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -9,128 +9,128 @@ local snapUnit=1
|
||||
local selected--Button selected
|
||||
|
||||
local function _save1()
|
||||
FILE.save(VK_org,'conf/vkSave1')
|
||||
FILE.save(VK_org,'conf/vkSave1')
|
||||
end
|
||||
local function _load1()
|
||||
local D=FILE.load('conf/vkSave1')
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
else
|
||||
MES.new('error',text.noFile)
|
||||
end
|
||||
local D=FILE.load('conf/vkSave1')
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
else
|
||||
MES.new('error',text.noFile)
|
||||
end
|
||||
end
|
||||
local function _save2()
|
||||
FILE.save(VK_org,'conf/vkSave2')
|
||||
FILE.save(VK_org,'conf/vkSave2')
|
||||
end
|
||||
local function _load2()
|
||||
local D=FILE.load('conf/vkSave2')
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
else
|
||||
MES.new('error',text.noFile)
|
||||
end
|
||||
local D=FILE.load('conf/vkSave2')
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
else
|
||||
MES.new('error',text.noFile)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('rainbow')
|
||||
defaultSetSelect=1
|
||||
selected=false
|
||||
BG.set('rainbow')
|
||||
defaultSetSelect=1
|
||||
selected=false
|
||||
end
|
||||
function scene.sceneBack()
|
||||
FILE.save(VK_org,'conf/virtualkey')
|
||||
FILE.save(VK_org,'conf/virtualkey')
|
||||
end
|
||||
|
||||
local function _onVK_org(x,y)
|
||||
local dist,nearest=1e10
|
||||
for K=1,#VK_org do
|
||||
local B=VK_org[K]
|
||||
if B.ava then
|
||||
local d1=(x-B.x)^2+(y-B.y)^2
|
||||
if d1<B.r^2 then
|
||||
if d1<dist then
|
||||
nearest,dist=K,d1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nearest
|
||||
local dist,nearest=1e10
|
||||
for K=1,#VK_org do
|
||||
local B=VK_org[K]
|
||||
if B.ava then
|
||||
local d1=(x-B.x)^2+(y-B.y)^2
|
||||
if d1<B.r^2 then
|
||||
if d1<dist then
|
||||
nearest,dist=K,d1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nearest
|
||||
end
|
||||
function scene.mouseDown(x,y,k)
|
||||
if k==1 then scene.touchDown(x,y)end
|
||||
if k==1 then scene.touchDown(x,y)end
|
||||
end
|
||||
function scene.mouseUp()
|
||||
scene.touchUp()
|
||||
scene.touchUp()
|
||||
end
|
||||
function scene.mouseMove(_,_,dx,dy)
|
||||
if ms.isDown(1)then
|
||||
scene.touchMove(nil,nil,dx,dy)
|
||||
end
|
||||
if ms.isDown(1)then
|
||||
scene.touchMove(nil,nil,dx,dy)
|
||||
end
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
selected=_onVK_org(x,y)or selected
|
||||
selected=_onVK_org(x,y)or selected
|
||||
end
|
||||
function scene.touchUp()
|
||||
if selected then
|
||||
local B=VK_org[selected]
|
||||
B.x,B.y=int(B.x/snapUnit+.5)*snapUnit,int(B.y/snapUnit+.5)*snapUnit
|
||||
end
|
||||
if selected then
|
||||
local B=VK_org[selected]
|
||||
B.x,B.y=int(B.x/snapUnit+.5)*snapUnit,int(B.y/snapUnit+.5)*snapUnit
|
||||
end
|
||||
end
|
||||
function scene.touchMove(_,_,dx,dy)
|
||||
if selected and not WIDGET.isFocus()then
|
||||
local B=VK_org[selected]
|
||||
B.x,B.y=B.x+dx,B.y+dy
|
||||
end
|
||||
if selected and not WIDGET.isFocus()then
|
||||
local B=VK_org[selected]
|
||||
B.x,B.y=B.x+dx,B.y+dy
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(3)
|
||||
gc.rectangle('line',490,65,300,610)
|
||||
VK.preview(selected)
|
||||
local x1,y1=SCR.xOy:inverseTransformPoint(0,0)
|
||||
local x2,y2=SCR.xOy:inverseTransformPoint(SCR.w,SCR.h)
|
||||
if snapUnit>=10 then
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1,sin(TIME()*4)*.1+.1)
|
||||
for i=x1,x2+snapUnit,snapUnit do
|
||||
local x=i-i%snapUnit
|
||||
gc.line(x,y1,x,y2)
|
||||
end
|
||||
for i=y1,y2+snapUnit,snapUnit do
|
||||
local y=i-i%snapUnit
|
||||
gc.line(x1,y,x2,y)
|
||||
end
|
||||
end
|
||||
gc.setColor(COLOR.Z)
|
||||
gc.setLineWidth(3)
|
||||
gc.rectangle('line',490,65,300,610)
|
||||
VK.preview(selected)
|
||||
local x1,y1=SCR.xOy:inverseTransformPoint(0,0)
|
||||
local x2,y2=SCR.xOy:inverseTransformPoint(SCR.w,SCR.h)
|
||||
if snapUnit>=10 then
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1,sin(TIME()*4)*.1+.1)
|
||||
for i=x1,x2+snapUnit,snapUnit do
|
||||
local x=i-i%snapUnit
|
||||
gc.line(x,y1,x,y2)
|
||||
end
|
||||
for i=y1,y2+snapUnit,snapUnit do
|
||||
local y=i-i%snapUnit
|
||||
gc.line(x1,y,x2,y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="default",x=530,y=90,w=200,h=80,font=35,
|
||||
code=function()
|
||||
VK.changeSet(defaultSetSelect)
|
||||
MES.new('check',"==[ "..defaultSetSelect.." ]==")
|
||||
defaultSetSelect=defaultSetSelect%5+1
|
||||
selected=false
|
||||
end},
|
||||
WIDGET.newSelector{name="snap", x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
|
||||
WIDGET.newButton{name="option", x=530,y=190,w=200,h=80,fText=TEXTURE.more,code=function()SCN.go('setting_touchSwitch')end},
|
||||
WIDGET.newButton{name="back", x=750,y=190,w=200,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=_save1},
|
||||
WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=_load1},
|
||||
WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=_save2},
|
||||
WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=_load2},
|
||||
WIDGET.newSlider{name="size", x=440,y=370,w=460,unit=19,font=40,show="vkSize",
|
||||
disp=function()
|
||||
return VK_org[selected].r/10-1
|
||||
end,
|
||||
code=function(v)
|
||||
if selected then
|
||||
VK_org[selected].r=(v+1)*10
|
||||
end
|
||||
end,
|
||||
hideF=function()
|
||||
return not selected
|
||||
end},
|
||||
WIDGET.newKey{name="shape",x=640,y=600,w=200,h=80,code=function()SETTING.VKSkin=VK.nextShape()end},
|
||||
WIDGET.newButton{name="default",x=530,y=90,w=200,h=80,font=35,
|
||||
code=function()
|
||||
VK.changeSet(defaultSetSelect)
|
||||
MES.new('check',"==[ "..defaultSetSelect.." ]==")
|
||||
defaultSetSelect=defaultSetSelect%5+1
|
||||
selected=false
|
||||
end},
|
||||
WIDGET.newSelector{name="snap", x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
|
||||
WIDGET.newButton{name="option", x=530,y=190,w=200,h=80,fText=TEXTURE.more,code=function()SCN.go('setting_touchSwitch')end},
|
||||
WIDGET.newButton{name="back", x=750,y=190,w=200,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=_save1},
|
||||
WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=_load1},
|
||||
WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=_save2},
|
||||
WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=_load2},
|
||||
WIDGET.newSlider{name="size", x=440,y=370,w=460,unit=19,font=40,show="vkSize",
|
||||
disp=function()
|
||||
return VK_org[selected].r/10-1
|
||||
end,
|
||||
code=function(v)
|
||||
if selected then
|
||||
VK_org[selected].r=(v+1)*10
|
||||
end
|
||||
end,
|
||||
hideF=function()
|
||||
return not selected
|
||||
end},
|
||||
WIDGET.newKey{name="shape", x=640,y=600,w=200,h=80,code=function()SETTING.VKSkin=VK.nextShape()end},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -1,17 +1,17 @@
|
||||
local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set('matrix')
|
||||
BG.set('matrix')
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
if SETTING.VKSwitch and SETTING.VKTrack then
|
||||
love.graphics.setColor(1,1,1)
|
||||
setFont(30)
|
||||
mStr(text.VKTchW,140+500*SETTING.VKTchW,800-WIDGET.scrollPos)
|
||||
mStr(text.VKOrgW,140+500*SETTING.VKTchW+500*SETTING.VKCurW,870-WIDGET.scrollPos)
|
||||
mStr(text.VKCurW,640+500*SETTING.VKCurW,950-WIDGET.scrollPos)
|
||||
end
|
||||
if SETTING.VKSwitch and SETTING.VKTrack then
|
||||
love.graphics.setColor(1,1,1)
|
||||
setFont(30)
|
||||
mStr(text.VKTchW,140+500*SETTING.VKTchW,800-WIDGET.scrollPos)
|
||||
mStr(text.VKOrgW,140+500*SETTING.VKTchW+500*SETTING.VKCurW,870-WIDGET.scrollPos)
|
||||
mStr(text.VKCurW,640+500*SETTING.VKCurW,950-WIDGET.scrollPos)
|
||||
end
|
||||
end
|
||||
|
||||
local function _VKAdisp(n)return function()return VK_org[n].ava end end
|
||||
@@ -21,41 +21,41 @@ local function _notTrack()return not(SETTING.VKSwitch and SETTING.VKTrack)end
|
||||
|
||||
scene.widgetScrollHeight=340
|
||||
scene.widgetList={
|
||||
WIDGET.newSwitch{name="b1", x=280, y=80, disp=_VKAdisp(1),code=_VKAcode(1)},
|
||||
WIDGET.newSwitch{name="b2", x=280, y=140, disp=_VKAdisp(2),code=_VKAcode(2)},
|
||||
WIDGET.newSwitch{name="b3", x=280, y=200, disp=_VKAdisp(3),code=_VKAcode(3)},
|
||||
WIDGET.newSwitch{name="b4", x=280, y=260, disp=_VKAdisp(4),code=_VKAcode(4)},
|
||||
WIDGET.newSwitch{name="b5", x=280, y=320, disp=_VKAdisp(5),code=_VKAcode(5)},
|
||||
WIDGET.newSwitch{name="b6", x=280, y=380, disp=_VKAdisp(6),code=_VKAcode(6)},
|
||||
WIDGET.newSwitch{name="b7", x=280, y=440, disp=_VKAdisp(7),code=_VKAcode(7)},
|
||||
WIDGET.newSwitch{name="b8", x=280, y=500, disp=_VKAdisp(8),code=_VKAcode(8)},
|
||||
WIDGET.newSwitch{name="b9", x=280, y=560, disp=_VKAdisp(9),code=_VKAcode(9)},
|
||||
WIDGET.newSwitch{name="b10", x=280, y=620, disp=_VKAdisp(10),code=_VKAcode(10)},
|
||||
WIDGET.newSwitch{name="b11", x=580, y=80, disp=_VKAdisp(11),code=_VKAcode(11)},
|
||||
WIDGET.newSwitch{name="b12", x=580, y=140, disp=_VKAdisp(12),code=_VKAcode(12)},
|
||||
WIDGET.newSwitch{name="b13", x=580, y=200, disp=_VKAdisp(13),code=_VKAcode(13)},
|
||||
WIDGET.newSwitch{name="b14", x=580, y=260, disp=_VKAdisp(14),code=_VKAcode(14)},
|
||||
WIDGET.newSwitch{name="b15", x=580, y=320, disp=_VKAdisp(15),code=_VKAcode(15)},
|
||||
WIDGET.newSwitch{name="b16", x=580, y=380, disp=_VKAdisp(16),code=_VKAcode(16)},
|
||||
WIDGET.newSwitch{name="b17", x=580, y=440, disp=_VKAdisp(17),code=_VKAcode(17)},
|
||||
WIDGET.newSwitch{name="b18", x=580, y=500, disp=_VKAdisp(18),code=_VKAcode(18)},
|
||||
WIDGET.newSwitch{name="b19", x=580, y=560, disp=_VKAdisp(19),code=_VKAcode(19)},
|
||||
WIDGET.newSwitch{name="b20", x=580, y=620, disp=_VKAdisp(20),code=_VKAcode(20)},
|
||||
WIDGET.newSwitch{name="b1", x=280, y=80, disp=_VKAdisp(1),code=_VKAcode(1)},
|
||||
WIDGET.newSwitch{name="b2", x=280, y=140, disp=_VKAdisp(2),code=_VKAcode(2)},
|
||||
WIDGET.newSwitch{name="b3", x=280, y=200, disp=_VKAdisp(3),code=_VKAcode(3)},
|
||||
WIDGET.newSwitch{name="b4", x=280, y=260, disp=_VKAdisp(4),code=_VKAcode(4)},
|
||||
WIDGET.newSwitch{name="b5", x=280, y=320, disp=_VKAdisp(5),code=_VKAcode(5)},
|
||||
WIDGET.newSwitch{name="b6", x=280, y=380, disp=_VKAdisp(6),code=_VKAcode(6)},
|
||||
WIDGET.newSwitch{name="b7", x=280, y=440, disp=_VKAdisp(7),code=_VKAcode(7)},
|
||||
WIDGET.newSwitch{name="b8", x=280, y=500, disp=_VKAdisp(8),code=_VKAcode(8)},
|
||||
WIDGET.newSwitch{name="b9", x=280, y=560, disp=_VKAdisp(9),code=_VKAcode(9)},
|
||||
WIDGET.newSwitch{name="b10", x=280, y=620, disp=_VKAdisp(10),code=_VKAcode(10)},
|
||||
WIDGET.newSwitch{name="b11", x=580, y=80, disp=_VKAdisp(11),code=_VKAcode(11)},
|
||||
WIDGET.newSwitch{name="b12", x=580, y=140, disp=_VKAdisp(12),code=_VKAcode(12)},
|
||||
WIDGET.newSwitch{name="b13", x=580, y=200, disp=_VKAdisp(13),code=_VKAcode(13)},
|
||||
WIDGET.newSwitch{name="b14", x=580, y=260, disp=_VKAdisp(14),code=_VKAcode(14)},
|
||||
WIDGET.newSwitch{name="b15", x=580, y=320, disp=_VKAdisp(15),code=_VKAcode(15)},
|
||||
WIDGET.newSwitch{name="b16", x=580, y=380, disp=_VKAdisp(16),code=_VKAcode(16)},
|
||||
WIDGET.newSwitch{name="b17", x=580, y=440, disp=_VKAdisp(17),code=_VKAcode(17)},
|
||||
WIDGET.newSwitch{name="b18", x=580, y=500, disp=_VKAdisp(18),code=_VKAcode(18)},
|
||||
WIDGET.newSwitch{name="b19", x=580, y=560, disp=_VKAdisp(19),code=_VKAcode(19)},
|
||||
WIDGET.newSwitch{name="b20", x=580, y=620, disp=_VKAdisp(20),code=_VKAcode(20)},
|
||||
|
||||
WIDGET.newButton{name="norm", x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=i<11 end end},
|
||||
WIDGET.newButton{name="pro", x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=true end end},
|
||||
WIDGET.newSwitch{name="hide", x=1150, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")},
|
||||
WIDGET.newSwitch{name="icon", x=1150, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon"),hideF=_notShow},
|
||||
WIDGET.newSlider{name="sfx", x=830, y=380, w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX"),hideF=_notShow},
|
||||
WIDGET.newSlider{name="vib", x=830, y=450, w=400,unit=6,font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB"),hideF=_notShow},
|
||||
WIDGET.newSlider{name="alpha", x=830, y=520, w=400, font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha"),hideF=_notShow},
|
||||
WIDGET.newButton{name="norm", x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=i<11 end end},
|
||||
WIDGET.newButton{name="pro", x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=true end end},
|
||||
WIDGET.newSwitch{name="hide", x=1150, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")},
|
||||
WIDGET.newSwitch{name="icon", x=1150, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon"),hideF=_notShow},
|
||||
WIDGET.newSlider{name="sfx", x=830, y=380, w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX"),hideF=_notShow},
|
||||
WIDGET.newSlider{name="vib", x=830, y=450, w=400,unit=6, font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB"),hideF=_notShow},
|
||||
WIDGET.newSlider{name="alpha", x=830, y=520, w=400, font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha"),hideF=_notShow},
|
||||
|
||||
WIDGET.newSwitch{name="track", x=360, y=720, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack"),hideF=_notShow},
|
||||
WIDGET.newSwitch{name="dodge", x=800, y=720, font=35,disp=SETval("VKDodge"),code=SETrev("VKDodge"),hideF=_notTrack},
|
||||
WIDGET.newSlider{name="tchW", x=140, y=860, w=1000, font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=_notTrack},
|
||||
WIDGET.newSlider{name="curW", x=140, y=930, w=1000, font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=_notTrack},
|
||||
WIDGET.newSwitch{name="track", x=360, y=720, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack"),hideF=_notShow},
|
||||
WIDGET.newSwitch{name="dodge", x=800, y=720, font=35,disp=SETval("VKDodge"),code=SETrev("VKDodge"),hideF=_notTrack},
|
||||
WIDGET.newSlider{name="tchW", x=140, y=860, w=1000, font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=_notTrack},
|
||||
WIDGET.newSlider{name="curW", x=140, y=930, w=1000, font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=_notTrack},
|
||||
|
||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,92 +3,92 @@ local gc=love.graphics
|
||||
local scene={}
|
||||
|
||||
function scene.sceneBack()
|
||||
saveSettings()
|
||||
saveSettings()
|
||||
end
|
||||
|
||||
local fakeBlock={{true}}
|
||||
function scene.draw()
|
||||
local skinLib=SKIN.lib[SETTING.skinSet]
|
||||
gc.push('transform')
|
||||
gc.translate(720,149-WIDGET.scrollPos)
|
||||
gc.scale(2)
|
||||
gc.setColor(1,1,1)
|
||||
PLY.draw.drawGhost[SETTING.ghostType](fakeBlock,0,0,SETTING.ghost,skinLib,math.floor(TIME()*3)%16+1)
|
||||
gc.pop()
|
||||
local skinLib=SKIN.lib[SETTING.skinSet]
|
||||
gc.push('transform')
|
||||
gc.translate(720,149-WIDGET.scrollPos)
|
||||
gc.scale(2)
|
||||
gc.setColor(1,1,1)
|
||||
PLY.draw.drawGhost[SETTING.ghostType](fakeBlock,0,0,SETTING.ghost,skinLib,math.floor(TIME()*3)%16+1)
|
||||
gc.pop()
|
||||
|
||||
gc.push('transform')
|
||||
gc.setColor(1,1,1)
|
||||
local T=skinLib[1]
|
||||
gc.translate(0,1410-WIDGET.scrollPos)
|
||||
gc.setShader(SHADER.blockSatur)
|
||||
gc.draw(T,435,0)gc.draw(T,465,0)gc.draw(T,465,30)gc.draw(T,495,30)
|
||||
gc.setShader(SHADER.fieldSatur)
|
||||
for i=1,8 do
|
||||
gc.draw(skinLib[i],330+30*i,100)
|
||||
gc.draw(skinLib[i+8],330+30*i,130)
|
||||
end
|
||||
gc.setShader()
|
||||
gc.pop()
|
||||
gc.push('transform')
|
||||
gc.setColor(1,1,1)
|
||||
local T=skinLib[1]
|
||||
gc.translate(0,1410-WIDGET.scrollPos)
|
||||
gc.setShader(SHADER.blockSatur)
|
||||
gc.draw(T,435,0)gc.draw(T,465,0)gc.draw(T,465,30)gc.draw(T,495,30)
|
||||
gc.setShader(SHADER.fieldSatur)
|
||||
for i=1,8 do
|
||||
gc.draw(skinLib[i],330+30*i,100)
|
||||
gc.draw(skinLib[i+8],330+30*i,130)
|
||||
end
|
||||
gc.setShader()
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
scene.widgetScrollHeight=900
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=640,y=15,font=80},
|
||||
WIDGET.newText{name="title", x=640,y=15,font=80},
|
||||
|
||||
WIDGET.newButton{name="sound", x=200,y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_sound','swipeR')},
|
||||
WIDGET.newButton{name="game", x=1080,y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_game','swipeL')},
|
||||
WIDGET.newButton{name="sound", x=200,y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_sound','swipeR')},
|
||||
WIDGET.newButton{name="game", x=1080,y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_game','swipeL')},
|
||||
|
||||
WIDGET.newSwitch{name="block", x=380,y=180,disp=SETval("block"),code=SETrev("block")},
|
||||
WIDGET.newSwitch{name="smooth", x=380,y=250,disp=SETval("smooth"),code=SETrev("smooth")},
|
||||
WIDGET.newSwitch{name="upEdge", x=380,y=320,disp=SETval("upEdge"),code=SETrev("upEdge")},
|
||||
WIDGET.newSwitch{name="bagLine", x=380,y=390,disp=SETval("bagLine"),code=SETrev("bagLine")},
|
||||
WIDGET.newSwitch{name="block", x=380,y=180,disp=SETval("block"),code=SETrev("block")},
|
||||
WIDGET.newSwitch{name="smooth", x=380,y=250,disp=SETval("smooth"),code=SETrev("smooth")},
|
||||
WIDGET.newSwitch{name="upEdge", x=380,y=320,disp=SETval("upEdge"),code=SETrev("upEdge")},
|
||||
WIDGET.newSwitch{name="bagLine", x=380,y=390,disp=SETval("bagLine"),code=SETrev("bagLine")},
|
||||
|
||||
WIDGET.newSelector{name="ghostType",x=915,y=180,w=350,list={'color','gray','colorCell','grayCell','colorLine','grayLine'},disp=SETval("ghostType"),code=SETsto("ghostType")},
|
||||
WIDGET.newSlider{name="ghost", x=740,y=240,w=350,unit=1,disp=SETval("ghost"), show="percent",code=SETsto("ghost")},
|
||||
WIDGET.newSlider{name="center", x=740,y=300,w=350,unit=1,disp=SETval("center"), show="percent",code=SETsto("center")},
|
||||
WIDGET.newSlider{name="grid", x=740,y=360,w=350,unit=.4,disp=SETval("grid"), show="percent",code=SETsto("grid")},
|
||||
WIDGET.newSlider{name="lineNum", x=740,y=420,w=350,unit=1,disp=SETval("lineNum"), show="percent",code=SETsto("lineNum")},
|
||||
WIDGET.newSelector{name="ghostType", x=915,y=180,w=350,list={'color','gray','colorCell','grayCell','colorLine','grayLine'},disp=SETval("ghostType"),code=SETsto("ghostType")},
|
||||
WIDGET.newSlider{name="ghost", x=740,y=240,w=350,unit=1,disp=SETval("ghost"), show="percent",code=SETsto("ghost")},
|
||||
WIDGET.newSlider{name="center", x=740,y=300,w=350,unit=1,disp=SETval("center"), show="percent",code=SETsto("center")},
|
||||
WIDGET.newSlider{name="grid", x=740,y=360,w=350,unit=.4,disp=SETval("grid"), show="percent",code=SETsto("grid")},
|
||||
WIDGET.newSlider{name="lineNum", x=740,y=420,w=350,unit=1,disp=SETval("lineNum"), show="percent",code=SETsto("lineNum")},
|
||||
|
||||
WIDGET.newSlider{name="lockFX", x=330,y=460,w=540,unit=5,disp=SETval("lockFX"), code=SETsto("lockFX")},
|
||||
WIDGET.newSlider{name="dropFX", x=330,y=520,w=540,unit=5,disp=SETval("dropFX"), code=SETsto("dropFX")},
|
||||
WIDGET.newSlider{name="moveFX", x=330,y=580,w=540,unit=5,disp=SETval("moveFX"), code=SETsto("moveFX")},
|
||||
WIDGET.newSlider{name="clearFX", x=330,y=640,w=540,unit=5,disp=SETval("clearFX"),code=SETsto("clearFX")},
|
||||
WIDGET.newSlider{name="splashFX", x=330,y=700,w=540,unit=5,disp=SETval("splashFX"),code=SETsto("splashFX")},
|
||||
WIDGET.newSlider{name="shakeFX", x=330,y=760,w=540,unit=5,disp=SETval("shakeFX"),code=SETsto("shakeFX")},
|
||||
WIDGET.newSlider{name="atkFX", x=330,y=820,w=540,unit=5,disp=SETval("atkFX"), code=SETsto("atkFX")},
|
||||
WIDGET.newSelector{name="frame", x=600,y=890,w=460,list={8,10,13,17,22,29,37,47,62,80,100},disp=SETval("frameMul"),code=SETsto("frameMul")},
|
||||
WIDGET.newSlider{name="lockFX", x=330,y=460,w=540,unit=5,disp=SETval("lockFX"), code=SETsto("lockFX")},
|
||||
WIDGET.newSlider{name="dropFX", x=330,y=520,w=540,unit=5,disp=SETval("dropFX"), code=SETsto("dropFX")},
|
||||
WIDGET.newSlider{name="moveFX", x=330,y=580,w=540,unit=5,disp=SETval("moveFX"), code=SETsto("moveFX")},
|
||||
WIDGET.newSlider{name="clearFX", x=330,y=640,w=540,unit=5,disp=SETval("clearFX"), code=SETsto("clearFX")},
|
||||
WIDGET.newSlider{name="splashFX", x=330,y=700,w=540,unit=5,disp=SETval("splashFX"), code=SETsto("splashFX")},
|
||||
WIDGET.newSlider{name="shakeFX", x=330,y=760,w=540,unit=5,disp=SETval("shakeFX"), code=SETsto("shakeFX")},
|
||||
WIDGET.newSlider{name="atkFX", x=330,y=820,w=540,unit=5,disp=SETval("atkFX"), code=SETsto("atkFX")},
|
||||
WIDGET.newSelector{name="frame", x=600,y=890,w=460,list={8,10,13,17,22,29,37,47,62,80,100},disp=SETval("frameMul"),code=SETsto("frameMul")},
|
||||
|
||||
WIDGET.newSwitch{name="text", x=450,y=980,disp=SETval("text"), code=SETrev("text")},
|
||||
WIDGET.newSwitch{name="score", x=450,y=1030,disp=SETval("score"), code=SETrev("score")},
|
||||
WIDGET.newSwitch{name="bufferWarn", x=450,y=1100,disp=SETval("bufferWarn"), code=SETrev("bufferWarn")},
|
||||
WIDGET.newSwitch{name="showSpike", x=450,y=1150,disp=SETval("showSpike"), code=SETrev("showSpike")},
|
||||
WIDGET.newSwitch{name="nextPos", x=450,y=1220,disp=SETval("nextPos"), code=SETrev("nextPos")},
|
||||
WIDGET.newSwitch{name="highCam", x=450,y=1270,disp=SETval("highCam"), code=SETrev("highCam")},
|
||||
WIDGET.newSwitch{name="warn", x=450,y=1340,disp=SETval("warn"), code=SETrev("warn")},
|
||||
WIDGET.newSwitch{name="text", x=450,y=980,disp=SETval("text"), code=SETrev("text")},
|
||||
WIDGET.newSwitch{name="score", x=450,y=1030,disp=SETval("score"), code=SETrev("score")},
|
||||
WIDGET.newSwitch{name="bufferWarn", x=450,y=1100,disp=SETval("bufferWarn"), code=SETrev("bufferWarn")},
|
||||
WIDGET.newSwitch{name="showSpike", x=450,y=1150,disp=SETval("showSpike"), code=SETrev("showSpike")},
|
||||
WIDGET.newSwitch{name="nextPos", x=450,y=1220,disp=SETval("nextPos"), code=SETrev("nextPos")},
|
||||
WIDGET.newSwitch{name="highCam", x=450,y=1270,disp=SETval("highCam"), code=SETrev("highCam")},
|
||||
WIDGET.newSwitch{name="warn", x=450,y=1340,disp=SETval("warn"), code=SETrev("warn")},
|
||||
|
||||
WIDGET.newSwitch{name="clickFX", x=950,y=980,disp=SETval("clickFX"), code=SETrev("clickFX")},
|
||||
WIDGET.newSwitch{name="power", x=950,y=1070,disp=SETval("powerInfo"), code=SETrev("powerInfo")},
|
||||
WIDGET.newSwitch{name="clean", x=950,y=1160,disp=SETval("cleanCanvas"),code=SETrev("cleanCanvas")},
|
||||
WIDGET.newSwitch{name="fullscreen", x=950,y=1250,disp=SETval("fullscreen"), code=switchFullscreen},
|
||||
WIDGET.newSwitch{name="bg", x=950,y=1340,disp=SETval("bg"),
|
||||
code=function()
|
||||
BG.set('none')
|
||||
SETTING.bg=not SETTING.bg
|
||||
BG.set()
|
||||
end},
|
||||
WIDGET.newSwitch{name="clickFX", x=950,y=980,disp=SETval("clickFX"), code=SETrev("clickFX")},
|
||||
WIDGET.newSwitch{name="power", x=950,y=1070,disp=SETval("powerInfo"), code=SETrev("powerInfo")},
|
||||
WIDGET.newSwitch{name="clean", x=950,y=1160,disp=SETval("cleanCanvas"), code=SETrev("cleanCanvas")},
|
||||
WIDGET.newSwitch{name="fullscreen", x=950,y=1250,disp=SETval("fullscreen"), code=switchFullscreen},
|
||||
WIDGET.newSwitch{name="bg", x=950,y=1340,disp=SETval("bg"),
|
||||
code=function()
|
||||
BG.set('none')
|
||||
SETTING.bg=not SETTING.bg
|
||||
BG.set()
|
||||
end},
|
||||
|
||||
WIDGET.newSelector{name="blockSatur",x=800,y=1440,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
disp=SETval("blockSatur"),
|
||||
code=function(v)SETTING.blockSatur=v;applyBlockSatur(SETTING.blockSatur)end
|
||||
},
|
||||
WIDGET.newSelector{name="fieldSatur",x=800,y=1540,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
disp=SETval("fieldSatur"),
|
||||
code=function(v)SETTING.fieldSatur=v;applyFieldSatur(SETTING.fieldSatur)end
|
||||
},
|
||||
WIDGET.newSelector{name="blockSatur", x=800,y=1440,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
disp=SETval("blockSatur"),
|
||||
code=function(v)SETTING.blockSatur=v;applyBlockSatur(SETTING.blockSatur)end
|
||||
},
|
||||
WIDGET.newSelector{name="fieldSatur", x=800,y=1540,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
disp=SETval("fieldSatur"),
|
||||
code=function(v)SETTING.fieldSatur=v;applyFieldSatur(SETTING.fieldSatur)end
|
||||
},
|
||||
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -3,110 +3,110 @@ local scene={}
|
||||
local mini,b2b,b3b,pc
|
||||
|
||||
function scene.sceneInit()
|
||||
mini,b2b,b3b,pc=false,false,false,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,isRep)
|
||||
if isRep then return end
|
||||
if key=="1"then
|
||||
mini=not mini
|
||||
elseif key=="2"then
|
||||
b2b=not b2b
|
||||
if b2b then b3b=false end
|
||||
elseif key=="3"then
|
||||
b3b=not b3b
|
||||
if b3b then b2b=false end
|
||||
elseif key=="4"then
|
||||
pc=not pc
|
||||
elseif type(key)=='number'then
|
||||
local CHN=VOC.getFreeChannel()
|
||||
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[math.floor(key/10)].."spin",CHN)
|
||||
end
|
||||
if lineCount[key%10]then VOC.play(lineCount[key%10],CHN)end
|
||||
if pc then VOC.play('perfect_clear',CHN)end
|
||||
elseif key=="tab"then
|
||||
SCN.swapTo('music','none')
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="1"then
|
||||
mini=not mini
|
||||
elseif key=="2"then
|
||||
b2b=not b2b
|
||||
if b2b then b3b=false end
|
||||
elseif key=="3"then
|
||||
b3b=not b3b
|
||||
if b3b then b2b=false end
|
||||
elseif key=="4"then
|
||||
pc=not pc
|
||||
elseif type(key)=='number'then
|
||||
local CHN=VOC.getFreeChannel()
|
||||
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[math.floor(key/10)].."spin",CHN)
|
||||
end
|
||||
if lineCount[key%10]then VOC.play(lineCount[key%10],CHN)end
|
||||
if pc then VOC.play('perfect_clear',CHN)end
|
||||
elseif key=="tab"then
|
||||
SCN.swapTo('music','none')
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=30, y=15,font=70,align='L'},
|
||||
WIDGET.newSlider{name="sfx", x=510, y=60,w=330,font=35,change=function()SFX.play('blip_1')end,disp=SETval("sfx"),sound=false,code=SETsto("sfx")},
|
||||
WIDGET.newSlider{name="voc", x=510, y=120,w=330,font=35,change=function()VOC.play('test')end,disp=SETval("voc"),sound=false,code=SETsto("voc")},
|
||||
WIDGET.newText{name="title", x=30, y=15,font=70,align='L'},
|
||||
WIDGET.newSlider{name="sfx", x=510, y=60,w=330,font=35,change=function()SFX.play('blip_1')end,disp=SETval("sfx"),sound=false,code=SETsto("sfx")},
|
||||
WIDGET.newSlider{name="voc", x=510, y=120,w=330,font=35,change=function()VOC.play('test')end,disp=SETval("voc"),sound=false,code=SETsto("voc")},
|
||||
|
||||
WIDGET.newKey{name="move", x=110, y=140,w=160,h=50,font=20,sound=false,code=function()SFX.play('move')end},
|
||||
WIDGET.newKey{name="lock", x=110, y=205,w=160,h=50,font=20,sound=false,code=function()SFX.play('lock')end},
|
||||
WIDGET.newKey{name="drop", x=110, y=270,w=160,h=50,font=20,sound=false,code=function()SFX.play('drop')end},
|
||||
WIDGET.newKey{name="fall", x=110, y=335,w=160,h=50,font=20,sound=false,code=function()SFX.play('fall')end},
|
||||
WIDGET.newKey{name="rotate", x=110, y=400,w=160,h=50,font=20,sound=false,code=function()SFX.play('rotate')end},
|
||||
WIDGET.newKey{name="rotatekick",x=110, y=465,w=160,h=50,font=20,sound=false,code=function()SFX.play('rotatekick')end},
|
||||
WIDGET.newKey{name="hold", x=110, y=530,w=160,h=50,font=20,sound=false,code=function()SFX.play('hold')end},
|
||||
WIDGET.newKey{name="prerotate",x=110, y=595,w=160,h=50,font=20,sound=false,code=function()SFX.play('prerotate')end},
|
||||
WIDGET.newKey{name="prehold", x=110, y=660,w=160,h=50,font=20,sound=false,code=function()SFX.play('prehold')end},
|
||||
WIDGET.newKey{name="move", x=110, y=140,w=160,h=50,font=20,sound=false,code=function()SFX.play('move')end},
|
||||
WIDGET.newKey{name="lock", x=110, y=205,w=160,h=50,font=20,sound=false,code=function()SFX.play('lock')end},
|
||||
WIDGET.newKey{name="drop", x=110, y=270,w=160,h=50,font=20,sound=false,code=function()SFX.play('drop')end},
|
||||
WIDGET.newKey{name="fall", x=110, y=335,w=160,h=50,font=20,sound=false,code=function()SFX.play('fall')end},
|
||||
WIDGET.newKey{name="rotate", x=110, y=400,w=160,h=50,font=20,sound=false,code=function()SFX.play('rotate')end},
|
||||
WIDGET.newKey{name="rotatekick",x=110, y=465,w=160,h=50,font=20,sound=false,code=function()SFX.play('rotatekick')end},
|
||||
WIDGET.newKey{name="hold", x=110, y=530,w=160,h=50,font=20,sound=false,code=function()SFX.play('hold')end},
|
||||
WIDGET.newKey{name="prerotate", x=110, y=595,w=160,h=50,font=20,sound=false,code=function()SFX.play('prerotate')end},
|
||||
WIDGET.newKey{name="prehold", x=110, y=660,w=160,h=50,font=20,sound=false,code=function()SFX.play('prehold')end},
|
||||
|
||||
WIDGET.newKey{name="clear1", x=280, y=140,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_1')end},
|
||||
WIDGET.newKey{name="clear2", x=280, y=205,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_2')end},
|
||||
WIDGET.newKey{name="clear3", x=280, y=270,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_3')end},
|
||||
WIDGET.newKey{name="clear4", x=280, y=335,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_4')end},
|
||||
WIDGET.newKey{name="spin0", x=280, y=400,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_0')end},
|
||||
WIDGET.newKey{name="spin1", x=280, y=465,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_1')end},
|
||||
WIDGET.newKey{name="spin2", x=280, y=530,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_2')end},
|
||||
WIDGET.newKey{name="spin3", x=280, y=595,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_3')end},
|
||||
WIDGET.newKey{name="_pc", x=280, y=660,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear')end},
|
||||
WIDGET.newKey{name="clear1", x=280, y=140,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_1')end},
|
||||
WIDGET.newKey{name="clear2", x=280, y=205,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_2')end},
|
||||
WIDGET.newKey{name="clear3", x=280, y=270,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_3')end},
|
||||
WIDGET.newKey{name="clear4", x=280, y=335,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear_4')end},
|
||||
WIDGET.newKey{name="spin0", x=280, y=400,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_0')end},
|
||||
WIDGET.newKey{name="spin1", x=280, y=465,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_1')end},
|
||||
WIDGET.newKey{name="spin2", x=280, y=530,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_2')end},
|
||||
WIDGET.newKey{name="spin3", x=280, y=595,w=160,h=50,font=20,sound=false,code=function()SFX.play('spin_3')end},
|
||||
WIDGET.newKey{name="_pc", x=280, y=660,w=160,h=50,font=20,sound=false,code=function()SFX.play('clear')end},
|
||||
|
||||
WIDGET.newKey{name="_1", x=970, y=75,w=140,h=50,font=20,sound=false,code=pressKey(1)},
|
||||
WIDGET.newKey{name="_2", x=1130, y=75,w=140,h=50,font=20,sound=false,code=pressKey(2)},
|
||||
WIDGET.newKey{name="_3", x=970, y=140,w=140,h=50,font=20,sound=false,code=pressKey(3)},
|
||||
WIDGET.newKey{name="_4", x=1130, y=140,w=140,h=50,font=20,sound=false,code=pressKey(4)},
|
||||
WIDGET.newKey{name="_1", x=970, y=75,w=140,h=50,font=20,sound=false,code=pressKey(1)},
|
||||
WIDGET.newKey{name="_2", x=1130, y=75,w=140,h=50,font=20,sound=false,code=pressKey(2)},
|
||||
WIDGET.newKey{name="_3", x=970, y=140,w=140,h=50,font=20,sound=false,code=pressKey(3)},
|
||||
WIDGET.newKey{name="_4", x=1130, y=140,w=140,h=50,font=20,sound=false,code=pressKey(4)},
|
||||
|
||||
WIDGET.newKey{name="z0", x=650, y=205,w=140,h=50,font=20,sound=false,code=pressKey(10)},
|
||||
WIDGET.newKey{name="z1", x=650, y=270,w=140,h=50,font=20,sound=false,code=pressKey(11)},
|
||||
WIDGET.newKey{name="z2", x=650, y=335,w=140,h=50,font=20,sound=false,code=pressKey(12)},
|
||||
WIDGET.newKey{name="z3", x=650, y=400,w=140,h=50,font=20,sound=false,code=pressKey(13)},
|
||||
WIDGET.newKey{name="t0", x=650, y=465,w=140,h=50,font=20,sound=false,code=pressKey(50)},
|
||||
WIDGET.newKey{name="t1", x=650, y=530,w=140,h=50,font=20,sound=false,code=pressKey(51)},
|
||||
WIDGET.newKey{name="t2", x=650, y=595,w=140,h=50,font=20,sound=false,code=pressKey(52)},
|
||||
WIDGET.newKey{name="t3", x=650, y=660,w=140,h=50,font=20,sound=false,code=pressKey(53)},
|
||||
WIDGET.newKey{name="z0", x=650, y=205,w=140,h=50,font=20,sound=false,code=pressKey(10)},
|
||||
WIDGET.newKey{name="z1", x=650, y=270,w=140,h=50,font=20,sound=false,code=pressKey(11)},
|
||||
WIDGET.newKey{name="z2", x=650, y=335,w=140,h=50,font=20,sound=false,code=pressKey(12)},
|
||||
WIDGET.newKey{name="z3", x=650, y=400,w=140,h=50,font=20,sound=false,code=pressKey(13)},
|
||||
WIDGET.newKey{name="t0", x=650, y=465,w=140,h=50,font=20,sound=false,code=pressKey(50)},
|
||||
WIDGET.newKey{name="t1", x=650, y=530,w=140,h=50,font=20,sound=false,code=pressKey(51)},
|
||||
WIDGET.newKey{name="t2", x=650, y=595,w=140,h=50,font=20,sound=false,code=pressKey(52)},
|
||||
WIDGET.newKey{name="t3", x=650, y=660,w=140,h=50,font=20,sound=false,code=pressKey(53)},
|
||||
|
||||
WIDGET.newKey{name="s0", x=810, y=205,w=140,h=50,font=20,sound=false,code=pressKey(20)},
|
||||
WIDGET.newKey{name="s1", x=810, y=270,w=140,h=50,font=20,sound=false,code=pressKey(21)},
|
||||
WIDGET.newKey{name="s2", x=810, y=335,w=140,h=50,font=20,sound=false,code=pressKey(22)},
|
||||
WIDGET.newKey{name="s3", x=810, y=400,w=140,h=50,font=20,sound=false,code=pressKey(23)},
|
||||
WIDGET.newKey{name="o0", x=810, y=465,w=140,h=50,font=20,sound=false,code=pressKey(60)},
|
||||
WIDGET.newKey{name="o1", x=810, y=530,w=140,h=50,font=20,sound=false,code=pressKey(61)},
|
||||
WIDGET.newKey{name="o2", x=810, y=595,w=140,h=50,font=20,sound=false,code=pressKey(62)},
|
||||
WIDGET.newKey{name="o3", x=810, y=660,w=140,h=50,font=20,sound=false,code=pressKey(63)},
|
||||
WIDGET.newKey{name="s0", x=810, y=205,w=140,h=50,font=20,sound=false,code=pressKey(20)},
|
||||
WIDGET.newKey{name="s1", x=810, y=270,w=140,h=50,font=20,sound=false,code=pressKey(21)},
|
||||
WIDGET.newKey{name="s2", x=810, y=335,w=140,h=50,font=20,sound=false,code=pressKey(22)},
|
||||
WIDGET.newKey{name="s3", x=810, y=400,w=140,h=50,font=20,sound=false,code=pressKey(23)},
|
||||
WIDGET.newKey{name="o0", x=810, y=465,w=140,h=50,font=20,sound=false,code=pressKey(60)},
|
||||
WIDGET.newKey{name="o1", x=810, y=530,w=140,h=50,font=20,sound=false,code=pressKey(61)},
|
||||
WIDGET.newKey{name="o2", x=810, y=595,w=140,h=50,font=20,sound=false,code=pressKey(62)},
|
||||
WIDGET.newKey{name="o3", x=810, y=660,w=140,h=50,font=20,sound=false,code=pressKey(63)},
|
||||
|
||||
WIDGET.newKey{name="j0", x=970, y=205,w=140,h=50,font=20,sound=false,code=pressKey(30)},
|
||||
WIDGET.newKey{name="j1", x=970, y=270,w=140,h=50,font=20,sound=false,code=pressKey(31)},
|
||||
WIDGET.newKey{name="j2", x=970, y=335,w=140,h=50,font=20,sound=false,code=pressKey(32)},
|
||||
WIDGET.newKey{name="j3", x=970, y=400,w=140,h=50,font=20,sound=false,code=pressKey(33)},
|
||||
WIDGET.newKey{name="i0", x=970, y=465,w=140,h=50,font=20,sound=false,code=pressKey(70)},
|
||||
WIDGET.newKey{name="i1", x=970, y=530,w=140,h=50,font=20,sound=false,code=pressKey(71)},
|
||||
WIDGET.newKey{name="i2", x=970, y=595,w=140,h=50,font=20,sound=false,code=pressKey(72)},
|
||||
WIDGET.newKey{name="i3", x=970, y=660,w=140,h=50,font=20,sound=false,code=pressKey(73)},
|
||||
WIDGET.newKey{name="j0", x=970, y=205,w=140,h=50,font=20,sound=false,code=pressKey(30)},
|
||||
WIDGET.newKey{name="j1", x=970, y=270,w=140,h=50,font=20,sound=false,code=pressKey(31)},
|
||||
WIDGET.newKey{name="j2", x=970, y=335,w=140,h=50,font=20,sound=false,code=pressKey(32)},
|
||||
WIDGET.newKey{name="j3", x=970, y=400,w=140,h=50,font=20,sound=false,code=pressKey(33)},
|
||||
WIDGET.newKey{name="i0", x=970, y=465,w=140,h=50,font=20,sound=false,code=pressKey(70)},
|
||||
WIDGET.newKey{name="i1", x=970, y=530,w=140,h=50,font=20,sound=false,code=pressKey(71)},
|
||||
WIDGET.newKey{name="i2", x=970, y=595,w=140,h=50,font=20,sound=false,code=pressKey(72)},
|
||||
WIDGET.newKey{name="i3", x=970, y=660,w=140,h=50,font=20,sound=false,code=pressKey(73)},
|
||||
|
||||
WIDGET.newKey{name="l0", x=1130, y=205,w=140,h=50,font=20,sound=false,code=pressKey(40)},
|
||||
WIDGET.newKey{name="l1", x=1130, y=270,w=140,h=50,font=20,sound=false,code=pressKey(41)},
|
||||
WIDGET.newKey{name="l2", x=1130, y=335,w=140,h=50,font=20,sound=false,code=pressKey(42)},
|
||||
WIDGET.newKey{name="l3", x=1130, y=400,w=140,h=50,font=20,sound=false,code=pressKey(43)},
|
||||
WIDGET.newKey{name="l0", x=1130, y=205,w=140,h=50,font=20,sound=false,code=pressKey(40)},
|
||||
WIDGET.newKey{name="l1", x=1130, y=270,w=140,h=50,font=20,sound=false,code=pressKey(41)},
|
||||
WIDGET.newKey{name="l2", x=1130, y=335,w=140,h=50,font=20,sound=false,code=pressKey(42)},
|
||||
WIDGET.newKey{name="l3", x=1130, y=400,w=140,h=50,font=20,sound=false,code=pressKey(43)},
|
||||
|
||||
WIDGET.newSwitch{name="mini", x=515, y=465,font=25,disp=function()return mini end,sound=false,code=pressKey"1"},
|
||||
WIDGET.newSwitch{name="b2b", x=515, y=530,font=25,disp=function()return b2b end,sound=false,code=pressKey"2"},
|
||||
WIDGET.newSwitch{name="b3b", x=515, y=595,font=25,disp=function()return b3b end,sound=false,code=pressKey"3"},
|
||||
WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=function()return pc end,sound=false,code=pressKey"4"},
|
||||
WIDGET.newSwitch{name="mini", x=515, y=465,font=25,disp=function()return mini end,sound=false,code=pressKey"1"},
|
||||
WIDGET.newSwitch{name="b2b", x=515, y=530,font=25,disp=function()return b2b end,sound=false,code=pressKey"2"},
|
||||
WIDGET.newSwitch{name="b3b", x=515, y=595,font=25,disp=function()return b3b end,sound=false,code=pressKey"3"},
|
||||
WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=function()return pc end,sound=false,code=pressKey"4"},
|
||||
|
||||
WIDGET.newButton{name="music", x=1140, y=540,w=170,h=80,font=40,code=pressKey"tab"},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="music", x=1140, y=540,w=170,h=80,font=40,code=pressKey"tab"},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -11,96 +11,96 @@ local names
|
||||
local counter
|
||||
|
||||
function scene.sceneInit()
|
||||
time=0
|
||||
v=12
|
||||
BG.set()
|
||||
names={}
|
||||
counter=26
|
||||
time=0
|
||||
v=12
|
||||
BG.set()
|
||||
names={}
|
||||
counter=26
|
||||
end
|
||||
|
||||
function scene.mouseDown(x,y)
|
||||
local T=40*math.min(time,45)
|
||||
if not GAME.playing then
|
||||
if x>230 and x<1050 then
|
||||
if math.abs(y-800+T)<70 then
|
||||
loadGame('sprintLock',true)
|
||||
elseif math.abs(y-2160+T)<70 then
|
||||
loadGame('sprintFix',true)
|
||||
end
|
||||
end
|
||||
end
|
||||
local T=40*math.min(time,45)
|
||||
if not GAME.playing then
|
||||
if x>230 and x<1050 then
|
||||
if math.abs(y-800+T)<70 then
|
||||
loadGame('sprintLock',true)
|
||||
elseif math.abs(y-2160+T)<70 then
|
||||
loadGame('sprintFix',true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.touchDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
scene.mouseDown(x,y)
|
||||
end
|
||||
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
elseif not GAME.playing then
|
||||
if key=="l"then
|
||||
loadGame('sprintLock',true)
|
||||
elseif key=="f"then
|
||||
loadGame('sprintFix',true)
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
if key=="escape"then
|
||||
SCN.back()
|
||||
elseif not GAME.playing then
|
||||
if key=="l"then
|
||||
loadGame('sprintLock',true)
|
||||
elseif key=="f"then
|
||||
loadGame('sprintFix',true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if(kb.isDown("space","return")or tc.getTouches()[1])and v<6.26 then
|
||||
v=v+.26
|
||||
elseif v>1 then
|
||||
v=v-.16
|
||||
end
|
||||
time=time+v*dt
|
||||
counter=counter-1
|
||||
if counter==0 then
|
||||
local N=patron[rnd(#patron)]
|
||||
local T=gc.newText(getFont(N.font),N.name)
|
||||
local r=rnd()<.5
|
||||
ins(names,{
|
||||
text=T,
|
||||
x=r and -T:getWidth()or SCR.w,
|
||||
y=rnd()*(SCR.h-T:getHeight()),
|
||||
w=T:getWidth(),
|
||||
vx=(r and 1 or -1)*(1.626+rnd())*(SCR.w+T:getWidth())/SCR.w,
|
||||
})
|
||||
counter=26
|
||||
end
|
||||
for i=#names,1,-1 do
|
||||
local N=names[i]
|
||||
N.x=N.x+N.vx
|
||||
if N.vx>0 and N.x>SCR.w or N.vx<0 and N.x<-N.w then
|
||||
rem(names,i)
|
||||
end
|
||||
end
|
||||
if(kb.isDown("space","return")or tc.getTouches()[1])and v<6.26 then
|
||||
v=v+.26
|
||||
elseif v>1 then
|
||||
v=v-.16
|
||||
end
|
||||
time=time+v*dt
|
||||
counter=counter-1
|
||||
if counter==0 then
|
||||
local N=patron[rnd(#patron)]
|
||||
local T=gc.newText(getFont(N.font),N.name)
|
||||
local r=rnd()<.5
|
||||
ins(names,{
|
||||
text=T,
|
||||
x=r and -T:getWidth()or SCR.w,
|
||||
y=rnd()*(SCR.h-T:getHeight()),
|
||||
w=T:getWidth(),
|
||||
vx=(r and 1 or -1)*(1.626+rnd())*(SCR.w+T:getWidth())/SCR.w,
|
||||
})
|
||||
counter=26
|
||||
end
|
||||
for i=#names,1,-1 do
|
||||
local N=names[i]
|
||||
N.x=N.x+N.vx
|
||||
if N.vx>0 and N.x>SCR.w or N.vx<0 and N.x<-N.w then
|
||||
rem(names,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.setColor(1,1,1,.3)
|
||||
for i=1,#names do
|
||||
local N=names[i]
|
||||
gc.draw(N.text,N.x,N.y)
|
||||
end
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.setColor(1,1,1,.3)
|
||||
for i=1,#names do
|
||||
local N=names[i]
|
||||
gc.draw(N.text,N.x,N.y)
|
||||
end
|
||||
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
gc.setColor(COLOR.Z)
|
||||
local T=40*math.min(time,45)
|
||||
local L=text.staff
|
||||
setFont(40)
|
||||
for i=1,#L do
|
||||
mStr(L[i],640,800+70*i-T)
|
||||
end
|
||||
mDraw(TEXTURE.title_color,640,800-T,nil,.6)
|
||||
mDraw(TEXTURE.title_color,640,2160-T,nil,.6)
|
||||
if time>50 then gc.print("CLICK ME →",50,550,-.5)end
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
gc.setColor(COLOR.Z)
|
||||
local T=40*math.min(time,45)
|
||||
local L=text.staff
|
||||
setFont(40)
|
||||
for i=1,#L do
|
||||
mStr(L[i],640,800+70*i-T)
|
||||
end
|
||||
mDraw(TEXTURE.title_color,640,800-T,nil,.6)
|
||||
mDraw(TEXTURE.title_color,640,2160-T,nil,.6)
|
||||
if time>50 then gc.print("CLICK ME →",50,550,-.5)end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -12,107 +12,107 @@ 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},{},{}
|
||||
for i=1,7 do
|
||||
local s,c=S.spin[i],S.clear[i]
|
||||
Y1[i]=s[1]+s[2]+s[3]+s[4]
|
||||
Y2[i]=c[1]+c[2]+c[3]+c[4]
|
||||
for j=1,4 do
|
||||
X1[j]=X1[j]+s[j]
|
||||
X2[j]=X2[j]+c[j]
|
||||
end
|
||||
end
|
||||
form={
|
||||
A1=S.spin,A2=S.clear,
|
||||
X1=X1,X2=X2,
|
||||
Y1=Y1,Y2=Y2,
|
||||
}
|
||||
item={
|
||||
S.run,
|
||||
S.game,
|
||||
STRING.time(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),
|
||||
("%.2f %.2f"):format(S.atk/S.row,S.digatk/S.dig),
|
||||
S.b2b.." "..S.b3b,
|
||||
S.pc.." "..S.hpc,
|
||||
("%d/%.2f%%"):format(S.extraPiece,S.finesseRate*20/S.piece),
|
||||
}
|
||||
for i=1,11 do
|
||||
item[i]=text.stat[i].."\t"..item[i]
|
||||
end
|
||||
local S=STAT
|
||||
local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{}
|
||||
for i=1,7 do
|
||||
local s,c=S.spin[i],S.clear[i]
|
||||
Y1[i]=s[1]+s[2]+s[3]+s[4]
|
||||
Y2[i]=c[1]+c[2]+c[3]+c[4]
|
||||
for j=1,4 do
|
||||
X1[j]=X1[j]+s[j]
|
||||
X2[j]=X2[j]+c[j]
|
||||
end
|
||||
end
|
||||
form={
|
||||
A1=S.spin,A2=S.clear,
|
||||
X1=X1,X2=X2,
|
||||
Y1=Y1,Y2=Y2,
|
||||
}
|
||||
item={
|
||||
S.run,
|
||||
S.game,
|
||||
STRING.time(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),
|
||||
("%.2f %.2f"):format(S.atk/S.row,S.digatk/S.dig),
|
||||
S.b2b.." "..S.b3b,
|
||||
S.pc.." "..S.hpc,
|
||||
("%d/%.2f%%"):format(S.extraPiece,S.finesseRate*20/S.piece),
|
||||
}
|
||||
for i=1,11 do
|
||||
item[i]=text.stat[i].."\t"..item[i]
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
local _,__=minoColor,SETTING.skin
|
||||
local A,B=form.A1,form.A2
|
||||
local _,__=minoColor,SETTING.skin
|
||||
local A,B=form.A1,form.A2
|
||||
|
||||
setFont(25)
|
||||
for x=1,7 do
|
||||
gc_setColor(_[__[x]])
|
||||
mStr(text.block[x],80*x,40)
|
||||
mStr(text.block[x],80*x,280)
|
||||
for y=1,4 do
|
||||
mStr(A[x][y],80*x,40+40*y)
|
||||
mStr(B[x][y],80*x,280+40*y)
|
||||
end
|
||||
mStr(form.Y1[x],80*x,240)
|
||||
mStr(form.Y2[x],80*x,480)
|
||||
end
|
||||
setFont(25)
|
||||
for x=1,7 do
|
||||
gc_setColor(_[__[x]])
|
||||
mStr(text.block[x],80*x,40)
|
||||
mStr(text.block[x],80*x,280)
|
||||
for y=1,4 do
|
||||
mStr(A[x][y],80*x,40+40*y)
|
||||
mStr(B[x][y],80*x,280+40*y)
|
||||
end
|
||||
mStr(form.Y1[x],80*x,240)
|
||||
mStr(form.Y2[x],80*x,480)
|
||||
end
|
||||
|
||||
A,B=form.X1,form.X2
|
||||
for y=1,4 do
|
||||
gc_setColor(.5,.5,.5)
|
||||
gc_print(y-1,620,40+40*y)
|
||||
gc_print(y,620,280+40*y)
|
||||
gc_setColor(1,1,1)
|
||||
mStr(A[y],680,40+40*y)
|
||||
mStr(B[y],680,280+40*y)
|
||||
end
|
||||
A,B=form.X1,form.X2
|
||||
for y=1,4 do
|
||||
gc_setColor(.5,.5,.5)
|
||||
gc_print(y-1,620,40+40*y)
|
||||
gc_print(y,620,280+40*y)
|
||||
gc_setColor(1,1,1)
|
||||
mStr(A[y],680,40+40*y)
|
||||
mStr(B[y],680,280+40*y)
|
||||
end
|
||||
|
||||
setFont(20)
|
||||
for i=1,11 do
|
||||
gc_print(item[i],740,40*i+10)
|
||||
end
|
||||
setFont(20)
|
||||
for i=1,11 do
|
||||
gc_print(item[i],740,40*i+10)
|
||||
end
|
||||
|
||||
gc_setLineWidth(2)
|
||||
gc.rectangle('line',40,80,560,160,5)
|
||||
gc.rectangle('line',40,320,560,160,5)
|
||||
for x=1,6 do
|
||||
x=80*x+40
|
||||
gc_line(x,80,x,240)
|
||||
gc_line(x,320,x,480)
|
||||
end
|
||||
for y=1,3 do
|
||||
gc_line(40,80+40*y,600,80+40*y)
|
||||
gc_line(40,320+40*y,600,320+40*y)
|
||||
end
|
||||
gc_setLineWidth(2)
|
||||
gc.rectangle('line',40,80,560,160,5)
|
||||
gc.rectangle('line',40,320,560,160,5)
|
||||
for x=1,6 do
|
||||
x=80*x+40
|
||||
gc_line(x,80,x,240)
|
||||
gc_line(x,320,x,480)
|
||||
end
|
||||
for y=1,3 do
|
||||
gc_line(40,80+40*y,600,80+40*y)
|
||||
gc_line(40,320+40*y,600,320+40*y)
|
||||
end
|
||||
|
||||
local t=TIME()
|
||||
gc_draw(TEXTURE.title,260,615,.2+.04*sin(t*3),.4,nil,580,118)
|
||||
local t=TIME()
|
||||
gc_draw(TEXTURE.title,260,615,.2+.04*sin(t*3),.4,nil,580,118)
|
||||
|
||||
local r=t*2
|
||||
local R=int(r)%7+1
|
||||
gc_setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc_draw(TEXTURE.miniBlock[R],680,50,t*10%6.2832,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
gc_draw(TEXTURE.miniBlock[R],680,300,0,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
local r=t*2
|
||||
local R=int(r)%7+1
|
||||
gc_setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc_draw(TEXTURE.miniBlock[R],680,50,t*10%6.2832,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
gc_draw(TEXTURE.miniBlock[R],680,300,0,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{name="path", x=820,y=540,w=250,h=80,font=25,
|
||||
code=function()
|
||||
if SYSTEM=="Windows"or SYSTEM=="Linux"then
|
||||
love.system.openURL(SAVEDIR)
|
||||
else
|
||||
MES.new('info',SAVEDIR)
|
||||
end
|
||||
end
|
||||
},
|
||||
WIDGET.newButton{name="save", x=820,y=640,w=250,h=80,font=25,code=goScene'savedata'},
|
||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
WIDGET.newButton{name="path",x=820,y=540,w=250,h=80,font=25,
|
||||
code=function()
|
||||
if SYSTEM=="Windows"or SYSTEM=="Linux"then
|
||||
love.system.openURL(SAVEDIR)
|
||||
else
|
||||
MES.new('info',SAVEDIR)
|
||||
end
|
||||
end
|
||||
},
|
||||
WIDGET.newButton{name="save",x=820,y=640,w=250,h=80,font=25,code=goScene'savedata'},
|
||||
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
|
||||
}
|
||||
|
||||
return scene
|
||||
@@ -6,95 +6,95 @@ local scene={}
|
||||
local backCounter
|
||||
local list,timer
|
||||
local function _push(mes)
|
||||
ins(list,{mes,120})
|
||||
timer=1
|
||||
ins(list,{mes,120})
|
||||
timer=1
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
backCounter=5
|
||||
list={}
|
||||
timer=0
|
||||
backCounter=5
|
||||
list={}
|
||||
timer=0
|
||||
end
|
||||
|
||||
function scene.gamepadDown(key)
|
||||
_push("[gamepadDown] <"..key..">")
|
||||
_push("[gamepadDown] <"..key..">")
|
||||
end
|
||||
function scene.gamepadUp(key)
|
||||
_push{COLOR.H,"[gamepadUp] <"..key..">"}
|
||||
_push{COLOR.H,"[gamepadUp] <"..key..">"}
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
_push("[keyDown] <"..key..">")
|
||||
if key=="escape"then
|
||||
backCounter=backCounter-1
|
||||
if backCounter==0 then
|
||||
SCN.back()
|
||||
else
|
||||
MES.new('info',backCounter)
|
||||
end
|
||||
end
|
||||
if isRep then return end
|
||||
_push("[keyDown] <"..key..">")
|
||||
if key=="escape"then
|
||||
backCounter=backCounter-1
|
||||
if backCounter==0 then
|
||||
SCN.back()
|
||||
else
|
||||
MES.new('info',backCounter)
|
||||
end
|
||||
end
|
||||
end
|
||||
function scene.keyUp(key)
|
||||
_push{COLOR.H,"[keyUp] <"..key..">"}
|
||||
_push{COLOR.H,"[keyUp] <"..key..">"}
|
||||
end
|
||||
function scene.mouseClick(x,y)
|
||||
SYSFX.newRipple(.5,x,y,50)
|
||||
_push("[mouseClick]")
|
||||
SYSFX.newRipple(.5,x,y,50)
|
||||
_push("[mouseClick]")
|
||||
end
|
||||
function scene.mouseDown(x,y,k)
|
||||
SYSFX.newShade(.5,x-10,y-10,20,20)
|
||||
_push(("[mouseDown] <%d: %d, %d>"):format(k,x,y))
|
||||
SYSFX.newShade(.5,x-10,y-10,20,20)
|
||||
_push(("[mouseDown] <%d: %d, %d>"):format(k,x,y))
|
||||
end
|
||||
function scene.mouseMove(x,y)
|
||||
SYSFX.newShade(.5,x-3,y-3,6,6)
|
||||
SYSFX.newShade(.5,x-3,y-3,6,6)
|
||||
end
|
||||
function scene.mouseUp(x,y,k)
|
||||
SYSFX.newRectRipple(1,x-10,y-10,20,20)
|
||||
_push{COLOR.H,"[mouseUp] <"..k..">"}
|
||||
SYSFX.newRectRipple(1,x-10,y-10,20,20)
|
||||
_push{COLOR.H,"[mouseUp] <"..k..">"}
|
||||
end
|
||||
function scene.touchClick(x,y)
|
||||
SYSFX.newRipple(.5,x,y,50)
|
||||
_push("[touchClick]")
|
||||
SYSFX.newRipple(.5,x,y,50)
|
||||
_push("[touchClick]")
|
||||
end
|
||||
function scene.touchDown(x,y)
|
||||
SYSFX.newShade(.5,x-10,y-10,20,20)
|
||||
_push(("[touchDown] <%d, %d>"):format(x,y))
|
||||
SYSFX.newShade(.5,x-10,y-10,20,20)
|
||||
_push(("[touchDown] <%d, %d>"):format(x,y))
|
||||
end
|
||||
function scene.touchMove(x,y)
|
||||
SYSFX.newShade(.5,x-3,y-3,6,6)
|
||||
SYSFX.newShade(.5,x-3,y-3,6,6)
|
||||
end
|
||||
function scene.touchUp(x,y)
|
||||
SYSFX.newRectRipple(1,x-10,y-10,20,20)
|
||||
_push{COLOR.H,"[touchUp]"}
|
||||
SYSFX.newRectRipple(1,x-10,y-10,20,20)
|
||||
_push{COLOR.H,"[touchUp]"}
|
||||
end
|
||||
function scene.wheelMoved(dx,dy)
|
||||
_push(("[wheelMoved] <%d, %d>"):format(dx,dy))
|
||||
_push(("[wheelMoved] <%d, %d>"):format(dx,dy))
|
||||
end
|
||||
function scene.fileDropped(file)
|
||||
_push(("[fileDropped] <%s>"):format(file:getFilename()))
|
||||
_push(("[fileDropped] <%s>"):format(file:getFilename()))
|
||||
end
|
||||
function scene.directoryDropped(path)
|
||||
_push(("[directoryDropped] <%s>"):format(path))
|
||||
_push(("[directoryDropped] <%s>"):format(path))
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if timer>0 then
|
||||
timer=timer-dt/.526
|
||||
end
|
||||
for i=#list,1,-1 do
|
||||
list[i][2]=list[i][2]-1
|
||||
if list[i][2]==0 then
|
||||
rem(list,i)
|
||||
end
|
||||
end
|
||||
if timer>0 then
|
||||
timer=timer-dt/.526
|
||||
end
|
||||
for i=#list,1,-1 do
|
||||
list[i][2]=list[i][2]-1
|
||||
if list[i][2]==0 then
|
||||
rem(list,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
setFont(15)
|
||||
for i=1,#list do
|
||||
gc.setColor(1,1,1,list[i][2]/30)
|
||||
gc.print(list[i][1],20,20*i)
|
||||
end
|
||||
setFont(15)
|
||||
for i=1,#list do
|
||||
gc.setColor(1,1,1,list[i][2]/30)
|
||||
gc.print(list[i][1],20,20*i)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
|
||||
Reference in New Issue
Block a user