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 { debounce } from 'lodash-es';
|
||||||
import { gameListener } from '../game';
|
import { gameListener, hook } from '../game';
|
||||||
import { fixedUi } from './ui';
|
import { fixedUi, mainUi } from './ui';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { sleep } from 'mutate-animate';
|
import { sleep } from 'mutate-animate';
|
||||||
|
|
||||||
@ -53,3 +53,10 @@ gameListener.on('mouseMove', e => {
|
|||||||
showFixed(hovered);
|
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 { generateBinary, keycode } from '@/plugin/utils';
|
||||||
import { hovered } from './fixed';
|
import { hovered } from './fixed';
|
||||||
import { hasMarkedEnemy, markEnemy, unmarkEnemy } from '@/plugin/mark';
|
import { hasMarkedEnemy, markEnemy, unmarkEnemy } from '@/plugin/mark';
|
||||||
|
import { mainUi } from './ui';
|
||||||
|
|
||||||
export const mainScope = Symbol.for('@key_main');
|
export const mainScope = Symbol.for('@key_main');
|
||||||
export const gameKey = new Hotkey('gameKey', '游戏按键');
|
export const gameKey = new Hotkey('gameKey', '游戏按键');
|
||||||
@ -405,8 +406,12 @@ gameKey
|
|||||||
else markEnemy(id);
|
else markEnemy(id);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.realize('special', () => {})
|
.realize('special', () => {
|
||||||
.realize('critical', () => {})
|
mainUi.open('fixedDetail', { panel: 'special' });
|
||||||
|
})
|
||||||
|
.realize('critical', () => {
|
||||||
|
mainUi.open('fixedDetail', { panel: 'critical' });
|
||||||
|
})
|
||||||
.realize('restart', () => {
|
.realize('restart', () => {
|
||||||
core.confirmRestart();
|
core.confirmRestart();
|
||||||
})
|
})
|
||||||
|
@ -76,8 +76,6 @@ import { useDrag } from '../plugin/use';
|
|||||||
import EnemySpecial from '../panel/enemySpecial.vue';
|
import EnemySpecial from '../panel/enemySpecial.vue';
|
||||||
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
|
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
|
||||||
import EnemyCritical from '../panel/enemyCritical.vue';
|
import EnemyCritical from '../panel/enemyCritical.vue';
|
||||||
import { KeyCode } from '../plugin/keyCodes';
|
|
||||||
import { keycode } from '../plugin/utils';
|
|
||||||
import { sleep } from 'mutate-animate';
|
import { sleep } from 'mutate-animate';
|
||||||
import EnemyTarget from '../panel/enemyTarget.vue';
|
import EnemyTarget from '../panel/enemyTarget.vue';
|
||||||
import { detailInfo } from '../plugin/ui/book';
|
import { detailInfo } from '../plugin/ui/book';
|
||||||
|
@ -9,12 +9,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { getDetailedEnemy, getLocFromMouseLoc } from '../plugin/ui/fixed';
|
import { getDetailedEnemy } from '../plugin/ui/fixed';
|
||||||
import BookDetail from './bookDetail.vue';
|
import BookDetail from './bookDetail.vue';
|
||||||
import { detailInfo } from '../plugin/ui/book';
|
import { detailInfo } from '../plugin/ui/book';
|
||||||
|
import { hovered } from '@/core/main/init/fixed';
|
||||||
|
import { GameUi } from '@/core/main/custom/ui';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
num: number;
|
num: number;
|
||||||
|
ui: GameUi;
|
||||||
panel?: 'special' | 'critical' | 'target';
|
panel?: 'special' | 'critical' | 'target';
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@ -22,10 +25,10 @@ const panel = props.panel ?? 'special';
|
|||||||
|
|
||||||
detailInfo.pos = 0;
|
detailInfo.pos = 0;
|
||||||
|
|
||||||
const [x, y] = flags.mouseLoc;
|
if (hovered) {
|
||||||
const [mx, my] = getLocFromMouseLoc(x, y);
|
const { x, y } = hovered;
|
||||||
const enemy = core.status.thisMap.enemy.list.find(v => {
|
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) {
|
if (enemy) {
|
||||||
const detail = getDetailedEnemy(enemy);
|
const detail = getDetailedEnemy(enemy);
|
||||||
@ -33,6 +36,7 @@ if (enemy) {
|
|||||||
} else {
|
} else {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
mota.ui.main.close(props.num);
|
mota.ui.main.close(props.num);
|
||||||
|
Loading…
Reference in New Issue
Block a user