1.0.3
This commit is contained in:
parent
f2cb2e3787
commit
bb9397e934
|
@ -1,5 +1,5 @@
|
||||||
-- 猫猫虫的 LuaEngine 插件管理框架
|
-- 猫猫虫的 LuaEngine 插件管理框架
|
||||||
-- @version: 1.0.2
|
-- @version: 1.0.3
|
||||||
--
|
--
|
||||||
-- 自动加载以下目录的lua模块:
|
-- 自动加载以下目录的lua模块:
|
||||||
-- ./eigeen_modules
|
-- ./eigeen_modules
|
||||||
|
@ -31,6 +31,7 @@ local MODULE_ROOT = "./Lua/eigeen_modules"
|
||||||
-- globals
|
-- globals
|
||||||
-- 所有模块列表,仅在初始化时加载。后续处理都基于此列表,因此增删改mod需要重载此框架。
|
-- 所有模块列表,仅在初始化时加载。后续处理都基于此列表,因此增删改mod需要重载此框架。
|
||||||
local Modules = {}
|
local Modules = {}
|
||||||
|
local Ctx = {}
|
||||||
|
|
||||||
-- 需要执行的模块函数,每次执行前进行处理。
|
-- 需要执行的模块函数,每次执行前进行处理。
|
||||||
local ExecuteModules = {}
|
local ExecuteModules = {}
|
||||||
|
@ -195,7 +196,7 @@ end
|
||||||
|
|
||||||
function on_time()
|
function on_time()
|
||||||
local playerData = engine.Player:new()
|
local playerData = engine.Player:new()
|
||||||
local ctx = {
|
Ctx = {
|
||||||
playerData = playerData,
|
playerData = playerData,
|
||||||
worldData = engine.World:new(),
|
worldData = engine.World:new(),
|
||||||
questData = engine.Quest:new(),
|
questData = engine.Quest:new(),
|
||||||
|
@ -203,33 +204,28 @@ function on_time()
|
||||||
Keypad = Keypad
|
Keypad = Keypad
|
||||||
}
|
}
|
||||||
-- local MetaCtx = {
|
-- local MetaCtx = {
|
||||||
-- Speed = Speed:new(ctx.playerData),
|
-- Speed = Speed:new(Ctx.playerData),
|
||||||
-- Keypad = Keypad
|
-- Keypad = Keypad
|
||||||
-- }
|
-- }
|
||||||
-- MetaCtx.__index = MetaCtx
|
-- MetaCtx.__index = MetaCtx
|
||||||
-- setmetatable(ctx, MetaCtx)
|
-- setmetatable(Ctx, MetaCtx)
|
||||||
-- 建立遍历专用表,而不是遍历modules主表。条件判断操作更改后刷新遍历专用表。
|
-- 建立遍历专用表,而不是遍历modules主表。条件判断操作更改后刷新遍历专用表。
|
||||||
local wpType = ctx.playerData.Weapon.type
|
local wpType = Ctx.playerData.Weapon.type
|
||||||
if ctx.playerData.Weapon.type ~= LastWeaponType then
|
if Ctx.playerData.Weapon.type ~= LastWeaponType then
|
||||||
ExecuteModules = buildExecuteModules(ctx)
|
ExecuteModules = buildExecuteModules(Ctx)
|
||||||
LastWeaponType = ctx.playerData.Weapon.type
|
LastWeaponType = Ctx.playerData.Weapon.type
|
||||||
end
|
end
|
||||||
if ctx.worldData.MapId ~= LastMapID then
|
if Ctx.worldData.MapId ~= LastMapID then
|
||||||
ExecuteModules = buildExecuteModules(ctx)
|
ExecuteModules = buildExecuteModules(Ctx)
|
||||||
LastMapID = ctx.worldData.MapId
|
LastMapID = Ctx.worldData.MapId
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 执行onTime方法
|
-- 执行onTime方法
|
||||||
executeOnTime(ctx, ExecuteModules)
|
executeOnTime(Ctx, ExecuteModules)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_imgui()
|
function on_imgui()
|
||||||
local ctx = {
|
executeOnImgui(Ctx, ExecuteModules)
|
||||||
playerData = engine.Player:new(),
|
|
||||||
worldData = engine.World:new(),
|
|
||||||
questData = engine.Quest:new()
|
|
||||||
}
|
|
||||||
executeOnImgui(ctx, ExecuteModules)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_init()
|
function on_init()
|
||||||
|
@ -238,12 +234,7 @@ function on_init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_switch_scenes()
|
function on_switch_scenes()
|
||||||
local ctx = {
|
executeOnSwitchScenes(Ctx, ExecuteModules)
|
||||||
playerData = engine.Player:new(),
|
|
||||||
worldData = engine.World:new(),
|
|
||||||
questData = engine.Quest:new()
|
|
||||||
}
|
|
||||||
executeOnSwitchScenes(ctx, ExecuteModules)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_monster_create()
|
function on_monster_create()
|
||||||
|
|
Loading…
Reference in New Issue