mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-28 09:27:07 +08:00
fix: 实现按键时的id判断
This commit is contained in:
parent
a2639e63db
commit
d10022c9e8
2
idea.md
2
idea.md
@ -81,7 +81,7 @@ dam4.png ---- 存档 59
|
||||
[] 优化插件加载系统
|
||||
[] 优化 Scroll 组件
|
||||
[] 重写技能控制系统
|
||||
[] 自定义快捷键
|
||||
[x] 自定义快捷键
|
||||
[x] 优化 ui 控制系统
|
||||
[] 优化游戏进程与渲染进程间的通讯
|
||||
[] 优化资源分离,音乐放到 bgm 目录下
|
||||
|
@ -99,7 +99,9 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
|
||||
*/
|
||||
realize(id: string, func: HotkeyFunc) {
|
||||
const toSet = Object.values(this.data).filter(v => {
|
||||
return v.id === id || v.id.split('_').slice(0, -1).join('_') === id;
|
||||
const split = v.id.split('_');
|
||||
const last = !isNaN(Number(split.at(-1)));
|
||||
return v.id === id || (last && split.slice(0, -1).join('_') === id);
|
||||
});
|
||||
if (toSet.length === 0) {
|
||||
throw new Error(`Realize nonexistent key '${id}'.`);
|
||||
|
Loading…
Reference in New Issue
Block a user