重构模式环境的dropPiece和task事件为更强大的自定义和未来联网任意模式做准备

整理出所有模式的这两个事件独立到一个文件夹并整理所有模式引用它们的方式
警告:很可能有错误,需要他人帮助测试
This commit is contained in:
MrZ626
2021-08-26 23:49:20 +08:00
parent a4c9bdef4a
commit 7ad386d28f
127 changed files with 1504 additions and 1334 deletions

View File

@@ -350,6 +350,26 @@ local function _applyGameEnv(P)--Finish gameEnv processing
if ENV.grid==0 then ENV.grid=false end
if ENV.center==0 then ENV.center=false end
if ENV.lineNum==0 then ENV.lineNum=false end
--Apply eventSet
if ENV.eventSet then
if type(ENV.eventSet)=='string'then
local eventSet=require('parts.eventsets.'..ENV.eventSet)
if eventSet then
for k,v in next,eventSet do
ENV[k]=v
end
else
MES.new('warn',"No event set called: "..ENV.eventSet)
end
else
MES.new('warn',"Wrong event set type: "..type(ENV.eventSet))
end
end
--Apply events
if type(ENV.dropPiece)=='function'then ENV.dropPiece={ENV.dropPiece} else ENV.dropPiece=TABLE.shift(ENV.dropPiece) end
if type(ENV.task)=='function'then P:newTask(ENV.task) else for i=1,#ENV.task do P:newTask(ENV.task[i])end end
end
--------------------------</Libs>--------------------------