refactor: 怪物标记

This commit is contained in:
AncTe committed 2023-11-14 18:21:38 +08:00
1 parent d178908649
commit 8a8dee3176
13 files changed
+1710 -280

No files matched your search

-1
View File
@@ -17,7 +17,6 @@ interface AncTePlugin {
animate: ReturnType<typeof import('../plugin/animateController').default>;
utils: ReturnType<typeof import('../plugin/utils').default>;
status: ReturnType<typeof import('../plugin/ui/statusBar').default>;
mark: ReturnType<typeof import('../plugin/mark').default>;
fly: ReturnType<typeof import('../plugin/ui/fly').default>;
chase: ReturnType<typeof import('../plugin/chase/chase').default>;
webglUtils: ReturnType<typeof import('../plugin/webgl/utils').default>;
+1 -13
View File
@@ -267,21 +267,9 @@ hotkey
.register('mark', '标记怪物', {
defaults: KeyCode.KeyM,
func: () => {
// todo: refactor
const [x, y] = flags.mouseLoc ?? [];
const [mx, my] = getLocFromMouseLoc(x, y);
const blocks = core.getMapBlocksObj();
const block = blocks[`${mx},${my}`];
if (block.event.cls.startsWith('enemy')) {
const id = block.event.id as EnemyIds;
const name = core.material.enemys[id].name;
if (mota.plugin.mark.hasMarkedEnemy(id)) {
tip('success', `已取消标记${name}!`);
mota.plugin.mark.unmarkEnemy(id);
} else {
tip('success', `已标记${name}!`);
mota.plugin.mark.checkMarkedEnemy(false);
}
}
}
})
.register('skillTree', '技能树', {
+3 -1
View File
@@ -6,6 +6,8 @@ export interface GameEvent extends EmitableEvent {
reset: () => void;
/** Emitted in src/App.vue setup. */
mounted: () => void;
/** Emitted in plugin/ui.js */
statusBarUpdate: () => void;
}
export const hook = new EventEmitter<GameEvent>();
@@ -50,7 +52,7 @@ class GameListener extends EventEmitter<ListenerEvent> {
];
};
// hover & leave
// hover & leave & mouseMove
data.addEventListener('mousemove', e => {
if (core.status.lockControl || !core.isPlaying()) return;
this.emit('mouseMove', e);
-2
View File
@@ -4,7 +4,6 @@ import use from '@/plugin/use';
import animate from '@/plugin/animateController';
import utils from '@/plugin/utils';
import status from '@/plugin/ui/statusBar';
import mark from '@/plugin/mark';
import fly from '@/plugin/ui/fly';
import chase from '@/plugin/chase/chase';
import webglUtils from '@/plugin/webgl/utils';
@@ -27,7 +26,6 @@ export function resolvePlugin() {
['animate', animate()],
['utils', utils()],
['status', status()],
['mark', mark()],
['fly', fly()],
['chase', chase()],
['webglUtils', webglUtils()],