mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 23:29:27 +08:00
refactor: 定点查看怪物详细信息
This commit is contained in:
parent
eaad1f0a5a
commit
1e58dbe411
@ -1,6 +1,6 @@
|
||||
import { debounce } from 'lodash-es';
|
||||
import { gameListener } from '../game';
|
||||
import { fixedUi } from './ui';
|
||||
import { gameListener, hook } from '../game';
|
||||
import { fixedUi, mainUi } from './ui';
|
||||
import { ref } from 'vue';
|
||||
import { sleep } from 'mutate-animate';
|
||||
|
||||
@ -53,3 +53,10 @@ gameListener.on('mouseMove', e => {
|
||||
showFixed(hovered);
|
||||
}
|
||||
});
|
||||
|
||||
hook.once('mounted', () => {
|
||||
mainUi.on('start', () => {
|
||||
showFixed.cancel();
|
||||
closeFixed();
|
||||
});
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ import { Hotkey } from '../custom/hotkey';
|
||||
import { generateBinary, keycode } from '@/plugin/utils';
|
||||
import { hovered } from './fixed';
|
||||
import { hasMarkedEnemy, markEnemy, unmarkEnemy } from '@/plugin/mark';
|
||||
import { mainUi } from './ui';
|
||||
|
||||
export const mainScope = Symbol.for('@key_main');
|
||||
export const gameKey = new Hotkey('gameKey', '游戏按键');
|
||||
@ -405,8 +406,12 @@ gameKey
|
||||
else markEnemy(id);
|
||||
}
|
||||
})
|
||||
.realize('special', () => {})
|
||||
.realize('critical', () => {})
|
||||
.realize('special', () => {
|
||||
mainUi.open('fixedDetail', { panel: 'special' });
|
||||
})
|
||||
.realize('critical', () => {
|
||||
mainUi.open('fixedDetail', { panel: 'critical' });
|
||||
})
|
||||
.realize('restart', () => {
|
||||
core.confirmRestart();
|
||||
})
|
||||
|
@ -76,8 +76,6 @@ import { useDrag } from '../plugin/use';
|
||||
import EnemySpecial from '../panel/enemySpecial.vue';
|
||||
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
|
||||
import EnemyCritical from '../panel/enemyCritical.vue';
|
||||
import { KeyCode } from '../plugin/keyCodes';
|
||||
import { keycode } from '../plugin/utils';
|
||||
import { sleep } from 'mutate-animate';
|
||||
import EnemyTarget from '../panel/enemyTarget.vue';
|
||||
import { detailInfo } from '../plugin/ui/book';
|
||||
|
@ -9,12 +9,15 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDetailedEnemy, getLocFromMouseLoc } from '../plugin/ui/fixed';
|
||||
import { getDetailedEnemy } from '../plugin/ui/fixed';
|
||||
import BookDetail from './bookDetail.vue';
|
||||
import { detailInfo } from '../plugin/ui/book';
|
||||
import { hovered } from '@/core/main/init/fixed';
|
||||
import { GameUi } from '@/core/main/custom/ui';
|
||||
|
||||
const props = defineProps<{
|
||||
num: number;
|
||||
ui: GameUi;
|
||||
panel?: 'special' | 'critical' | 'target';
|
||||
}>();
|
||||
|
||||
@ -22,10 +25,10 @@ const panel = props.panel ?? 'special';
|
||||
|
||||
detailInfo.pos = 0;
|
||||
|
||||
const [x, y] = flags.mouseLoc;
|
||||
const [mx, my] = getLocFromMouseLoc(x, y);
|
||||
if (hovered) {
|
||||
const { x, y } = hovered;
|
||||
const enemy = core.status.thisMap.enemy.list.find(v => {
|
||||
return v.x === mx && v.y === my;
|
||||
return v.x === x && v.y === y;
|
||||
});
|
||||
if (enemy) {
|
||||
const detail = getDetailedEnemy(enemy);
|
||||
@ -33,6 +36,7 @@ if (enemy) {
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
mota.ui.main.close(props.num);
|
||||
|
Loading…
Reference in New Issue
Block a user