diff --git a/public/project/functions.js b/public/project/functions.js index 8a83dc6..ddee5e7 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -344,147 +344,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { core.items.quickLoadEquip(keyCode - 48); return; } - - const [x, y] = flags.mouseLoc ?? []; - const mx = Math.round(x + core.bigmap.offsetX / 32); - const my = Math.round(y + core.bigmap.offsetY / 32); - - // 根据keyCode值来执行对应操作 - switch (keyCode) { - case 74: // J:打开技能树 - core.useItem('skill1', true); - break; - case 27: // ESC:打开菜单栏 - core.openSettings(true); - break; - case 88: // X:使用怪物手册 - core.openBook(true); - break; - case 71: // G:使用楼传器 - core.useFly(true); - break; - case 65: // A:读取自动存档(回退) - core.doSL('autoSave', 'load'); - break; - case 87: // W:撤销回退 - core.doSL('autoSave', 'reload'); - break; - case 83: // S:存档 - core.save(true); - break; - case 68: // D:读档 - core.load(true); - break; - case 84: // T:打开道具栏 - core.openToolbox(true); - break; - case 81: // Q:打开装备栏 - core.openEquipbox(true); - break; - case 90: // Z:转向 - core.turnHero(); - break; - case 86: // V:打开快捷商店列表 - core.openQuickShop(true); - break; - case 32: // SPACE:轻按 - core.getNextItem(); - break; - case 82: // R:回放录像 - core.ui._drawReplay(); - break; - case 33: - case 34: // PgUp/PgDn:浏览地图 - core.ui._drawViewMaps(); - break; - case 66: // B:打开数据统计 - core.ui._drawStatistics(); - break; - case 72: // H:打开帮助页面 - core.useItem('I560', true); - break; - case 67: // C:怪物临界 - if (core.getBlockCls(mx, my)?.startsWith('enemy')) { - // mota.plugin.fixed.showFixed.value = false; - mota.ui.main.open('fixedDetail', { - panel: 'critical' - }); - } - break; - case 69: // E:怪物属性 - if (core.getBlockCls(mx, my)?.startsWith('enemy')) { - // mota.plugin.fixed.showFixed.value = false; - mota.ui.main.open('fixedDetail', { - panel: 'special' - }); - } - break; - case 77: // M:快速标记 - // todo: refactor - const blocks = core.getMapBlocksObj(); - const block = blocks[`${mx},${my}`]; - break; - case 78: // N:重新开始 - core.confirmRestart(); - break; - case 79: // O:查看工程 - core.actions._clickGameInfo_openProject(); - break; - case 80: // P:游戏主页 - core.actions._clickGameInfo_openComments(); - break; - case 49: // 1: 断灭之刃 - if (!flags.bladeOn) break; - if (flags.autoSkill) { - mota.plugin.utils.tip('error', '已开启自动切换技能!'); - break; - } - core.status.route.push('key:49'); // 将按键记在录像中 - core.playSound('光标移动'); - if (flags.blade) flags.blade = false; - else flags.blade = true; - core.updateStatusBar(); - break; - case 50: // 快捷键2: 跳跃技能 || 破 - if ( - !flags.chase && - !core.status.floorId.startsWith('tower') && - flags.skill2 - ) { - core.plugin.skillEffects.jumpSkill(); - core.status.route.push('key:50'); // 将按键记在录像中 - } else { - if (core.hasItem('pickaxe')) { - core.status.route.push('key:50'); // 将按键记在录像中 - core.useItem('pickaxe', true); // 第二个参数true代表该次使用道具是被按键触发的,使用过程不计入录像 - } - } - break; - case 51: // 3: 铸剑为盾 - if (!flags.shieldOn) break; - if (flags.autoSkill) { - mota.plugin.utils.tip('error', '已开启自动切换技能!'); - break; - } - core.status.route.push('key:51'); // 将按键记在录像中 - core.playSound('光标移动'); - if (flags.shield) flags.shield = false; - else flags.shield = true; - core.updateStatusBar(); - break; - case 53: // 5:读取自动存档(回退),方便手机版操作 - core.doSL('autoSave', 'load'); - break; - case 54: // 6:撤销回退,方便手机版操作 - core.doSL('autoSave', 'reload'); - break; - case 55: // 快捷键7:绑定为轻按,方便手机版操作 - core.getNextItem(); - break; - case 119: // F8:开启debug模式 - core.debug(); - break; - } } }, control: { diff --git a/src/core/main/init/hotkey.ts b/src/core/main/init/hotkey.ts index 96e96b6..5268476 100644 --- a/src/core/main/init/hotkey.ts +++ b/src/core/main/init/hotkey.ts @@ -327,6 +327,69 @@ gameKey.use(mainScope); // ----- Realization +gameKey + .when(() => !core.status.lockControl) + .realize('book', () => { + core.openBook(true); + }) + .realize('save', () => { + core.save(true); + }) + .realize('load', () => { + core.load(true); + }) + .realize('toolbox', () => { + core.openToolbox(true); + }) + .realize('equipbox', () => { + core.openEquipbox(true); + }) + .realize('fly', () => { + core.useFly(true); + }) + .realize('menu', () => { + core.openSettings(true); + }) + .realize('replay', () => { + core.ui._drawReplay(); + }) + .realize('shop', () => { + core.openQuickShop(true); + }) + .realize('statistics', () => { + core.ui._drawStatistics(); + }) + .realize('viewMap', () => { + core.ui._drawViewMaps(); + }) + .realize('skillTree', () => { + core.useItem('skill1', true); + }) + .realize('desc', () => { + core.useItem('I560', true); + }) + .realize('undo', () => { + core.doSL('autoSave', 'load'); + }) + .realize('redo', () => { + core.doSL('autoSave', 'reload'); + }) + .realize('turn', () => { + core.turnHero(); + }) + .realize('getNext', () => { + core.getNextItem(); + }) + .realize('mark', () => {}) + .realize('special', () => {}) + .realize('critical', () => {}) + .realize('restart', () => { + core.confirmRestart(); + }) + .realize('comment', () => { + core.actions._clickGameInfo_openComments(); + }); + // ----- Listening document.addEventListener('keyup', e => { const assist = generateBinary([e.ctrlKey, e.shiftKey, e.altKey]); diff --git a/src/types/ui.d.ts b/src/types/ui.d.ts index 2b1eb32..65d4ad3 100644 --- a/src/types/ui.d.ts +++ b/src/types/ui.d.ts @@ -821,11 +821,11 @@ interface Ui { /** * 绘制浏览地图 */ - _drawViewMaps(); + _drawViewMaps(): void; - _drawReplay(); + _drawReplay(): void; - _drawStatistics(); + _drawStatistics(): void; } declare const ui: new () => Ui; diff --git a/src/ui/fly.vue b/src/ui/fly.vue index 6445db5..b544042 100644 --- a/src/ui/fly.vue +++ b/src/ui/fly.vue @@ -93,9 +93,7 @@ import { DoubleRightOutlined } from '@ant-design/icons-vue'; import { debounce } from 'lodash-es'; -import { downloadCanvasImage, keycode, tip } from '../plugin/utils'; -import { sleep } from 'mutate-animate'; -import { KeyCode } from '../plugin/keyCodes'; +import { downloadCanvasImage, tip } from '../plugin/utils'; import { GameUi } from '@/core/main/custom/ui'; import { gameKey } from '@/core/main/init/hotkey';