HumanBreak/src/ui/markedEnemy.vue

158 lines
4.0 KiB
Vue
Raw Normal View History

2022-12-29 00:26:12 +08:00
<template>
<div id="marked-enemy">
2023-11-14 18:21:38 +08:00
<Box
v-model:left="boxPos.left"
v-model:top="boxPos.top"
v-model:width="boxPos.width"
v-model:height="boxPos.height"
:resizable="true"
:dragable="true"
>
<Scroll class="box-scroll" :no-scroll="true">
<div class="marked-main">
<div class="marked-info">
<BoxAnimate
:id="enemy.id"
:width="24"
:height="24"
></BoxAnimate>
<span class="marked-name marked-item">{{
getName()
}}</span>
</div>
<span class="marked-damage marked-item"
>伤害{{ format(info.damage) }}</span
>
<span class="marked-critical marked-item"
>临界{{ format(info.critical) }}</span
>
<span class="marked-critical-damage marked-item"
>减伤{{ format(info.criticalDam) }}</span
>
<span class="marked-def marked-item"
>{{ ratio }}{{ format(info.defDamage) }}</span
>
<div class="marked-button">
<span
class="marked-hide button-text"
@click.stop="hidden = true"
>隐藏盒子</span
2022-12-29 00:26:12 +08:00
>
2023-11-14 18:21:38 +08:00
<span
class="marked-cancel button-text"
@click.stop="unmarkEnemy(enemy.id)"
>取消标记</span
2022-12-29 00:26:12 +08:00
>
2023-11-14 18:21:38 +08:00
</div>
</div></Scroll
>
</Box>
2022-12-29 00:26:12 +08:00
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue';
2023-11-14 18:21:38 +08:00
import { MarkInfo, unmarkEnemy } from '../plugin/mark';
2022-12-29 00:26:12 +08:00
import Box from '../components/box.vue';
import Scroll from '../components/scroll.vue';
import BoxAnimate from '../components/boxAnimate.vue';
2023-11-14 18:21:38 +08:00
import { GameUi } from '@/core/main/custom/ui';
2024-01-24 21:32:49 +08:00
import { fixedUi } from '@/core/main/init/ui';
2023-11-14 18:21:38 +08:00
const props = defineProps<{
num: number;
ui: GameUi;
enemy: MarkInfo<EnemyIds>;
}>();
2022-12-29 00:26:12 +08:00
interface BoxPos {
left: number;
top: number;
width: number;
height: number;
}
2023-11-14 18:21:38 +08:00
interface MarkedEnemy {
damage: number;
critical: number;
criticalDam: number;
defDamage: number;
}
2022-12-29 00:26:12 +08:00
2023-11-14 18:21:38 +08:00
const enemy = props.enemy;
const ratio = core.status.thisMap?.ratio ?? 1;
2022-12-29 00:26:12 +08:00
2023-11-14 18:21:38 +08:00
const format = core.formatBigNumber;
2022-12-29 00:26:12 +08:00
2023-11-14 18:21:38 +08:00
const boxPos = reactive<BoxPos>({
left: window.innerWidth - 300,
top: 100,
width: 200,
height: 150
});
const info = reactive<MarkedEnemy>({
damage: 0,
critical: 0,
criticalDam: 0,
defDamage: 0
});
2022-12-29 00:26:12 +08:00
2023-11-14 18:21:38 +08:00
const hidden = ref(false);
2022-12-29 00:26:12 +08:00
2023-11-14 18:21:38 +08:00
watch(hidden, n => {
2024-01-24 21:32:49 +08:00
if (n) fixedUi.close(props.num);
2023-11-14 18:21:38 +08:00
});
watch(enemy.update, update);
2022-12-29 00:26:12 +08:00
2023-11-14 18:21:38 +08:00
function update() {
info.damage = enemy.enemy.calDamage().damage;
const critical = enemy.enemy.calCritical()[0];
info.critical = critical?.atkDelta ?? 0;
2024-04-20 12:27:38 +08:00
info.criticalDam = critical?.delta ?? 0;
2023-11-14 18:21:38 +08:00
info.defDamage = enemy.enemy.calDefDamage(ratio).delta;
2022-12-29 00:26:12 +08:00
}
2023-11-14 18:21:38 +08:00
function getName() {
return enemy.enemy.enemy.name;
2022-12-29 00:26:12 +08:00
}
</script>
<style lang="less" scoped>
#marked-enemy {
width: 100%;
height: 100%;
}
.box-scroll {
height: 100%;
width: 100%;
}
.marked-main {
2023-08-06 17:46:29 +08:00
padding: 1vh 0;
2022-12-29 00:26:12 +08:00
background-color: #0009;
display: flex;
flex-direction: column;
overflow: hidden;
}
.marked-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.marked-item {
margin-left: 10%;
}
.marked-button {
align-self: center;
width: 80%;
display: flex;
flex-direction: row;
justify-content: space-around;
}
</style>