1.0.6 支持模块热重载
This commit is contained in:
parent
a8a29f6430
commit
b2662f14fe
|
@ -0,0 +1,31 @@
|
||||||
|
# 更新日志
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
|
||||||
|
**Loader**
|
||||||
|
|
||||||
|
同时按左右花括号键可热重载所有模块
|
||||||
|
|
||||||
|
**Keypad**
|
||||||
|
|
||||||
|
支持传入 table 类型以实现组合键判断
|
||||||
|
|
||||||
|
**新增**
|
||||||
|
|
||||||
|
引入 utils/Utils.lua 通用工具类
|
||||||
|
|
||||||
|
## 1.0.4
|
||||||
|
|
||||||
|
**新增**
|
||||||
|
|
||||||
|
引入 utils/Macro.lua 宏工具包,支持 Macro 定义简单宏功能进行循环控制
|
||||||
|
|
||||||
|
## 1.0.3
|
||||||
|
|
||||||
|
**修订**
|
||||||
|
|
||||||
|
Ctx 在 Loader 中进行全局变量化以减少潜在的 nil 引用问题
|
||||||
|
|
||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
首次上传框架
|
|
@ -1,3 +1,5 @@
|
||||||
# EigeenLoader
|
# EigeenLoader
|
||||||
|
|
||||||
猫猫虫的 LuaEngine 插件管理框架 for MHW
|
猫猫虫的 LuaEngine 插件管理框架 for MHW
|
||||||
|
|
||||||
|
![更新日志](Changelogs.md)
|
|
@ -1,15 +1,14 @@
|
||||||
-- 猫猫虫的 LuaEngine 工具模块:Keypad
|
-- 猫猫虫的 LuaEngine 工具模块:Keypad
|
||||||
-- @version: 1.0.0
|
-- @version: 1.0.1
|
||||||
|
|
||||||
local Keypad = {}
|
local Keypad = {}
|
||||||
|
|
||||||
--- 带计时器的按键触发操作(注:暂不支持组合键)
|
--- 带计时器的按键触发操作
|
||||||
---@param keypadID number|string
|
---@param keypadID number|string|table
|
||||||
---@param chrono number
|
---@param chrono number
|
||||||
---@param func fun()
|
---@param handler fun()
|
||||||
---@param xbox boolean|nil
|
---@param xbox boolean|nil
|
||||||
function Keypad.UseChronoscope(keypadID, chrono, func, xbox)
|
function Keypad.UseChronoscope(keypadID, chrono, handler, xbox)
|
||||||
if keypadID == nil or chrono == nil or func == nil then
|
if not keypadID or not chrono or not handler then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if chrono < 0 then
|
if chrono < 0 then
|
||||||
|
@ -19,23 +18,20 @@ function Keypad.UseChronoscope(keypadID, chrono, func, xbox)
|
||||||
xbox = nil
|
xbox = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: 暂不支持组合键
|
|
||||||
if type(keypadID) == "table" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local keypadIDStr = keypadID
|
local keypadIDStr = keypadID
|
||||||
if type(keypadID) == "number" then
|
if type(keypadID) == "number" then
|
||||||
keypadIDStr = tostring(keypadID)
|
keypadIDStr = tostring(keypadID)
|
||||||
|
elseif type(keypadID) == "table" then
|
||||||
|
keypadIDStr = table.concat(keypadID, ",")
|
||||||
end
|
end
|
||||||
local keypadShortcut = "keypad_keyCD_"..keypadIDStr
|
local keypadShortcut = "keypad_keyCD_" .. keypadIDStr
|
||||||
|
|
||||||
if engine.keypad(keypadID, xbox) and (CheckChronoscope(keypadShortcut) or
|
if engine.keypad(keypadID, xbox) and
|
||||||
not CheckPresenceChronoscope(keypadShortcut)) then
|
(CheckChronoscope(keypadShortcut) or not CheckPresenceChronoscope(keypadShortcut)) then
|
||||||
|
|
||||||
AddChronoscope(chrono, keypadShortcut)
|
AddChronoscope(chrono, keypadShortcut)
|
||||||
func()
|
handler()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return Keypad
|
return Keypad
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
local Utils = {}
|
||||||
|
|
||||||
|
function Utils:IsIn(table, element)
|
||||||
|
for key, value in pairs(table) do
|
||||||
|
if element == value then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return Utils
|
Loading…
Reference in New Issue