mesDisp加入eventSet

eventSet中的规则不在覆盖,而是全部同时生效
调整部分模式的信息显示
自定义游戏可以选择部分eventSet
整理代码
警告:可能部分模式有问题,需要测试
This commit is contained in:
MrZ626
2021-08-28 04:01:58 +08:00
parent 5963db479e
commit 7f7f7e752e
141 changed files with 628 additions and 767 deletions

View File

@@ -891,9 +891,9 @@ function draw.norm(P,repMode)
;(P.type=='remote'and _drawFinesseCombo_remote or _drawFinesseCombo_norm)(P)
--Mode informations
if GAME.curMode.mesDisp then
gc_setColor(.97,.97,.97)
GAME.curMode.mesDisp(P,repMode)
gc_setColor(.97,.97,.97)
for i=1,#ENV.mesDisp do
ENV.mesDisp[i](P)
end
if P.frameRun<180 then _drawStartCounter(P.frameRun)end

View File

@@ -59,9 +59,10 @@ return{
mindas=0,minarr=0,minsdarr=0,
noInitSZO=false,
task={},
mesDisp={},
dropPiece={},
eventSet=false,
task={},
eventSet="X",
bg='none',bgm='race',
allowMod=true,

View File

@@ -265,6 +265,16 @@ local function _loadRemoteEnv(P,confStr)--Load gameEnv
end
end
end
local function _mergeFuncTable(f,L)
if type(f)=='function'then
ins(L,f)
elseif type(f)=='table'then
for i=1,#f do
ins(L,f[i])
end
end
return L
end
local function _applyGameEnv(P)--Finish gameEnv processing
local ENV=P.gameEnv
@@ -351,13 +361,19 @@ local function _applyGameEnv(P)--Finish gameEnv processing
if ENV.center==0 then ENV.center=false end
if ENV.lineNum==0 then ENV.lineNum=false end
--Apply events
ENV.mesDisp=_mergeFuncTable(ENV.mesDisp,{})
ENV.dropPiece=_mergeFuncTable(ENV.dropPiece,{})
ENV.task=_mergeFuncTable(ENV.task,{})
--Apply eventSet
if ENV.eventSet then
if ENV.eventSet and ENV.eventSet~="X"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
assert(type(ENV[k])=='table',"No eventSet method: "..k)
_mergeFuncTable(v,ENV[k])
end
else
MES.new('warn',"No event set called: "..ENV.eventSet)
@@ -367,9 +383,8 @@ local function _applyGameEnv(P)--Finish gameEnv processing
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
--Load tasks
for i=1,#ENV.task do P:newTask(ENV.task[i])end
end
--------------------------</Libs>--------------------------