提取自定义游戏加载用函数

This commit is contained in:
MrZ626
2020-12-08 13:57:38 +08:00
parent 62a039b672
commit d018265175
3 changed files with 18 additions and 31 deletions

View File

@@ -446,6 +446,21 @@ end
function resumeGame() function resumeGame()
SCN.swapTo("play","none") SCN.swapTo("play","none")
end end
function applyCustomGame()
for k,v in next,CUSTOMENV do
GAME.modeEnv[k]=v
end
if BAG[1]then
GAME.modeEnv.bag=BAG
else
GAME.modeEnv.bag=nil
end
if MISSION[1]then
GAME.modeEnv.mission=MISSION
else
GAME.modeEnv.mission=nil
end
end
function loadGame(M,ifQuickPlay) function loadGame(M,ifQuickPlay)
freshDate() freshDate()
if legalGameTime()then if legalGameTime()then

View File

@@ -49,23 +49,11 @@ return{
color=COLOR.white, color=COLOR.white,
env={}, env={},
load=function() load=function()
for k,v in next,CUSTOMENV do applyCustomGame()
GAME.modeEnv[k]=v
end
if BAG[1]then
GAME.modeEnv.bag=BAG
else
GAME.modeEnv.bag=nil
end
if MISSION[1]then
GAME.modeEnv.mission=MISSION
else
GAME.modeEnv.mission=nil
end
GAME.modeEnv.dropPiece=PLY.check_lineReach GAME.modeEnv.dropPiece=PLY.check_lineReach
for y=1,20 do for y=1,20 do
if notAir(FIELD[1][y])then if notAir(FIELD[1][y])then
--Switch clear mode on --Switch clear sprint mode on
GAME.modeEnv.dropPiece=checkClear GAME.modeEnv.dropPiece=checkClear
break break
end end
@@ -83,8 +71,6 @@ return{
for _,P in next,PLAYERS.alive do for _,P in next,PLAYERS.alive do
setField(P,1) setField(P,1)
end end
GAME.modeEnv.bg=CUSTOMENV.bg
GAME.modeEnv.bgm=CUSTOMENV.bgm
end, end,
mesDisp=function(P) mesDisp=function(P)
setFont(55) setFont(55)

View File

@@ -38,19 +38,7 @@ return{
dropPiece=puzzleCheck, dropPiece=puzzleCheck,
}, },
load=function() load=function()
for k,v in next,CUSTOMENV do applyCustomGame()
GAME.modeEnv[k]=v
end
if BAG[1]then
GAME.modeEnv.bag=BAG
else
GAME.modeEnv.bag=nil
end
if MISSION[1]then
GAME.modeEnv.mission=MISSION
else
GAME.modeEnv.mission=nil
end
PLY.newPlayer(1) PLY.newPlayer(1)
local L=GAME.modeEnv.opponent local L=GAME.modeEnv.opponent
if L~=0 then if L~=0 then
@@ -61,8 +49,6 @@ return{
PLY.newAIPlayer(2,AIBUILDER("CC",2*L-11,int(L*.5-1.5),true,4000*L)) PLY.newAIPlayer(2,AIBUILDER("CC",2*L-11,int(L*.5-1.5),true,4000*L))
end end
end end
GAME.modeEnv.bg=CUSTOMENV.bg
GAME.modeEnv.bgm=CUSTOMENV.bgm
end, end,
mesDisp=function(P) mesDisp=function(P)
local dx,dy=P.fieldOff.x,P.fieldOff.y local dx,dy=P.fieldOff.x,P.fieldOff.y