重构模式环境的dropPiece和task事件为更强大的自定义和未来联网任意模式做准备
整理出所有模式的这两个事件独立到一个文件夹并整理所有模式引用它们的方式 警告:很可能有错误,需要他人帮助测试
This commit is contained in:
@@ -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>--------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user