插件编写:能编写自定义快捷键吗?

如题
已邀请:

谷主

赞同来自:

用App.pluginManager.SetHotkey

jinqi166 - 80后

赞同来自:

-- 遍历输出当前FGUI编辑器下所有快捷键配置
fprint("11111111111111111")
fprint(App.hotkeyManager.functions);
fprint(App.hotkeyManager.functions.Count);
for i = 0, App.hotkeyManager.functions.Count-1 do
fprint(App.hotkeyManager.functions[i]);
---@type CS.FairyEditor.HotkeyManager.FunctionDef
local functinDef = App.hotkeyManager.functions[i];
fprint("id= ".. tostring(functinDef.id))
fprint("desc= ".. tostring(functinDef.desc))
fprint("hotkey= ".. tostring(functinDef.hotkey))
fprint("isCustomized= ".. tostring(functinDef.isCustomized))
end
fprint("222222222222222")
--- 通过funcid获取指定快捷键配置信息
---@type CS.FairyEditor.HotkeyManager.FunctionDef
local groupF = App.hotkeyManager:GetFunctionDef("0304")
fprint(groupF.desc);--(组件编辑) 组合
App.hotkeyManager:SetHotkey("0304","CTRL+P")--修改默认配置项:组件合并快捷键从CTRL+R换成CTRL+P

--- 自定义一个快捷键:编辑器插件下设置快捷键并处理回调事件!
App.pluginManager:SetHotkey("CTRL+ENTER",function()

fprint("hahaha")
end)

要回复问题请先登录注册