refactor: 游戏按键

This commit is contained in:
AncTe committed 2023-11-18 23:03:47 +08:00
1 parent 9bf27f58e3
commit 337aaade8c
4 files changed
+67 -147

No files matched your search

+63
View File
@@ -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]);
+3 -3
View File
@@ -821,11 +821,11 @@ interface Ui {
/**
* 绘制浏览地图
*/
_drawViewMaps();
_drawViewMaps(): void;
_drawReplay();
_drawReplay(): void;
_drawStatistics();
_drawStatistics(): void;
}
declare const ui: new () => Ui;
+1 -3
View File
@@ -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';