自定义场地第一页影响拼图模式有效性

This commit is contained in:
MrZ626
2020-11-05 18:23:27 +08:00
parent b664beda1d
commit 66872d3edf
3 changed files with 48 additions and 34 deletions

View File

@@ -62,18 +62,13 @@ return{
else else
modeEnv.mission=nil modeEnv.mission=nil
end end
local clearmode modeEnv.dropPiece=PLY.check_lineReach
if FIELD[1]then
for y=1,20 do for y=1,20 do
if notAir(FIELD[1][y])then if notAir(FIELD[1][y])then
clearmode=true --Switch clear mode on
end
end
end
if clearmode then
modeEnv.dropPiece=checkClear modeEnv.dropPiece=checkClear
else break
modeEnv.dropPiece=PLY.check_lineReach end
end end
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L=modeEnv.opponent local L=modeEnv.opponent

View File

@@ -5,11 +5,23 @@ local Timer=love.timer.getTime
local int=math.floor local int=math.floor
local find,sub=string.find,string.sub local find,sub=string.find,string.sub
local function notAir(L)
for i=1,10 do
if L[i]>0 then return true end
end
end
local customEnv=customEnv local customEnv=customEnv
function sceneInit.customGame() function sceneInit.customGame()
destroyPlayers() destroyPlayers()
BG.set(customEnv.bg) BG.set(customEnv.bg)
BGM.play(customEnv.bgm) BGM.play(customEnv.bgm)
sceneInit={initField=false}
for y=1,20 do
if notAir(FIELD[1][y])then
sceneTemp.initField=true
end
end
end end
function keyDown.customGame(key) function keyDown.customGame(key)
@@ -27,7 +39,13 @@ function keyDown.customGame(key)
end end
end end
SCN.push() SCN.push()
loadGame((key=="return2"or kb.isDown("lalt","lctrl","lshift"))and"custom_puzzle"or"custom_clear",true) if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
if sceneTemp.initField then
loadGame("custom_puzzle",true)
end
else
loadGame("custom_clear",true)
end
elseif key=="f"then elseif key=="f"then
SCN.go("custom_field","swipeD") SCN.go("custom_field","swipeD")
elseif key=="s"then elseif key=="s"then
@@ -83,6 +101,7 @@ end
function Pnt.customGame() function Pnt.customGame()
--Field content --Field content
if sceneTemp.initField then
gc.push("transform") gc.push("transform")
gc.translate(95,290) gc.translate(95,290)
gc.scale(.5) gc.scale(.5)
@@ -101,10 +120,11 @@ function Pnt.customGame()
end end
end end end end
gc.pop() gc.pop()
end
--Field --Field
setFont(40) setFont(40)
if #FIELD>1 then if sceneTemp.initField and #FIELD>1 then
gc.setColor(1,1,int(Timer()*6.26)%2) gc.setColor(1,1,int(Timer()*6.26)%2)
gc.print("+",275,300) gc.print("+",275,300)
gc.print(#FIELD-1,300,300) gc.print(#FIELD-1,300,300)
@@ -117,6 +137,7 @@ function Pnt.customGame()
gc.print(#BAG,360,545) gc.print(#BAG,360,545)
end end
setFont(30) setFont(30)
gc.setColor(1,1,1)
gc.print(customEnv.sequence,330,510) gc.print(customEnv.sequence,330,510)
--Sequence --Sequence
@@ -152,7 +173,7 @@ WIDGET.init("customGame",{
WIDGET.newButton({name="copy", x=1070, y=310,w=310,h=70,color="lRed", font=25,code=WIDGET.lnk.pressKey("cC")}), WIDGET.newButton({name="copy", x=1070, y=310,w=310,h=70,color="lRed", font=25,code=WIDGET.lnk.pressKey("cC")}),
WIDGET.newButton({name="paste", x=1070, y=390,w=310,h=70,color="lBlue", font=25,code=WIDGET.lnk.pressKey("cV")}), WIDGET.newButton({name="paste", x=1070, y=390,w=310,h=70,color="lBlue", font=25,code=WIDGET.lnk.pressKey("cV")}),
WIDGET.newButton({name="clear", x=1070, y=470,w=310,h=70,color="lYellow",font=35,code=WIDGET.lnk.pressKey("return")}), WIDGET.newButton({name="clear", x=1070, y=470,w=310,h=70,color="lYellow",font=35,code=WIDGET.lnk.pressKey("return")}),
WIDGET.newButton({name="puzzle",x=1070, y=550,w=310,h=70,color="lMagenta",font=35,code=WIDGET.lnk.pressKey("return2")}), WIDGET.newButton({name="puzzle",x=1070, y=550,w=310,h=70,color="lMagenta",font=35,code=WIDGET.lnk.pressKey("return2"),hide=function()return not sceneTemp.initField end}),
--More --More
WIDGET.newKey({name="advance", x=730, y=190,w=220,h=90,color="red", font=35,code=WIDGET.lnk.goScene("custom_advance")}), WIDGET.newKey({name="advance", x=730, y=190,w=220,h=90,color="red", font=35,code=WIDGET.lnk.goScene("custom_advance")}),

View File

@@ -5,8 +5,6 @@ local max,min,int=math.max,math.min,math.floor
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local sub=string.sub local sub=string.sub
local FIELD=FIELD local FIELD=FIELD
function sceneInit.custom_field() function sceneInit.custom_field()
sceneTemp={ sceneTemp={