HumanBreak/src/ui/fixedDetail.vue

43 lines
1020 B
Vue
Raw Normal View History

2023-01-06 22:18:33 +08:00
<template>
<div id="fixed-detail">
2023-01-08 22:59:39 +08:00
<BookDetail
:from-book="false"
:default-panel="panel"
@close="close"
></BookDetail>
2023-01-06 22:18:33 +08:00
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { getDetailedEnemy } from '../plugin/ui/fixed';
import BookDetail from './bookDetail.vue';
2023-01-08 22:59:39 +08:00
const panel = core.plugin.fixedDetailPanel ?? 'special';
2023-01-06 22:18:33 +08:00
core.plugin.bookDetailPos = 0;
2023-01-06 23:00:38 +08:00
const [x, y] = flags.mouseLoc;
const mx = Math.round(x + core.bigmap.offsetX / 32);
const my = Math.round(y + core.bigmap.offsetY / 32);
const e = core.getBlockId(mx, my);
if (e && core.getClsFromId(e)?.startsWith('enemy')) {
2023-01-06 22:18:33 +08:00
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;
2023-01-06 23:00:38 +08:00
} else {
close();
}
function close() {
core.plugin.fixedDetailOpened.value = false;
}
2023-01-06 22:18:33 +08:00
</script>
<style lang="less" scoped>
#fixed-detail {
width: 80%;
height: 100%;
}
</style>