HumanBreak/src/ui/fixedDetail.vue

36 lines
920 B
Vue
Raw Normal View History

2023-01-06 22:18:33 +08:00
<template>
<div id="fixed-detail">
<BookDetail :from-book="false" @close="close"></BookDetail>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { getDetailedEnemy } from '../plugin/ui/fixed';
import BookDetail from './bookDetail.vue';
core.plugin.bookDetailPos = 0;
function close() {
core.plugin.fixedDetailOpened.value = false;
}
onMounted(() => {
const [x, y] = flags.mouseLoc;
2023-01-06 22:42:46 +08:00
const mx = Math.round(x + core.bigmap.offsetX / 32);
const my = Math.round(y + core.bigmap.offsetY / 32);
const e = core.getBlockId(mx, my);
2023-01-06 22:18:33 +08:00
if (!e || !core.getClsFromId(e)?.startsWith('enemy')) return;
const enemy = core.material.enemys[e as EnemyIds];
2023-01-06 22:42:46 +08:00
const detail = getDetailedEnemy(enemy, mx, my);
2023-01-06 22:18:33 +08:00
core.plugin.bookDetailEnemy = detail;
});
</script>
<style lang="less" scoped>
#fixed-detail {
width: 80%;
height: 100%;
}
</style>