mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-18 13:24:30 +08:00
怪物标记功能
This commit is contained in:
1 parent
22350c4dda
commit
8418bccdf6
31 files changed
+662
-316
No files matched your search
+4
-2
@@ -127,6 +127,8 @@ async function show() {
|
||||
async function exit() {
|
||||
noClosePanel.value = true;
|
||||
core.plugin.bookOpened.value = false;
|
||||
if (core.plugin.transition.value) await sleep(650);
|
||||
else await sleep(100);
|
||||
if (core.events.recoverEvents(core.status.event.interval)) {
|
||||
return;
|
||||
} else if (has(core.status.event.ui)) {
|
||||
@@ -134,7 +136,6 @@ async function exit() {
|
||||
// @ts-ignore
|
||||
core.ui._drawViewMaps(core.status.event.ui);
|
||||
} else core.ui.closePanel();
|
||||
await sleep(650);
|
||||
}
|
||||
|
||||
function checkScroll() {
|
||||
@@ -202,7 +203,8 @@ function keydown(e: KeyboardEvent) {
|
||||
onMounted(async () => {
|
||||
const div = document.getElementById('book') as HTMLDivElement;
|
||||
div.style.opacity = '1';
|
||||
await sleep(600);
|
||||
if (core.plugin.transition.value) await sleep(600);
|
||||
else await sleep(100);
|
||||
document.addEventListener('keyup', keyup);
|
||||
document.addEventListener('keydown', keydown);
|
||||
});
|
||||
|
||||
+22
-2
@@ -11,6 +11,7 @@
|
||||
<Transition name="detail">
|
||||
<EnemySpecial v-if="panel === 'special'"></EnemySpecial>
|
||||
<EnemyCritical v-else-if="panel === 'critical'"></EnemyCritical>
|
||||
<EnemyTarget v-else-if="panel === 'target'"></EnemyTarget>
|
||||
</Transition>
|
||||
<div id="detail-more">
|
||||
<Transition name="detail">
|
||||
@@ -19,7 +20,12 @@
|
||||
class="detial-more"
|
||||
v-if="panel === 'special'"
|
||||
>
|
||||
<span></span>
|
||||
<span
|
||||
id="enemy-target"
|
||||
class="button-text more"
|
||||
@click="changePanel($event, 'target')"
|
||||
><LeftOutlined /> 怪物更多信息</span
|
||||
>
|
||||
<span
|
||||
id="critical-more"
|
||||
class="button-text more"
|
||||
@@ -39,6 +45,19 @@
|
||||
><left-outlined /> 怪物特殊属性</span
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
id="special-more"
|
||||
class="detial-more"
|
||||
v-else-if="panel === 'target'"
|
||||
>
|
||||
<span></span>
|
||||
<span
|
||||
id="enemy-pos"
|
||||
class="button-text more"
|
||||
@click="changePanel($event, 'special')"
|
||||
>怪物特殊属性 <RightOutlined
|
||||
/></span>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,6 +73,7 @@ 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';
|
||||
|
||||
const enemy = core.plugin.bookDetailEnemy;
|
||||
const top = ref(core.plugin.bookDetailPos);
|
||||
@@ -104,7 +124,7 @@ onMounted(async () => {
|
||||
if (y > (parseFloat(style.height) * 4) / 5) moved = true;
|
||||
},
|
||||
() => {
|
||||
if (moved === false && panel.value !== 'critical') {
|
||||
if (moved === false && panel.value === 'special') {
|
||||
close();
|
||||
}
|
||||
moved = false;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div id="desc"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
#desc {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<div id="marked-enemy">
|
||||
<div v-for="v of all">
|
||||
<Box
|
||||
v-if="!getBoxPos(v).hidden"
|
||||
v-model:left="getBoxPos(v).left"
|
||||
v-model:top="getBoxPos(v).top"
|
||||
v-model:width="getBoxPos(v).width"
|
||||
v-model:height="getBoxPos(v).height"
|
||||
:resizable="true"
|
||||
>
|
||||
<Scroll class="box-scroll" :no-scroll="true">
|
||||
<div class="marked-main">
|
||||
<div class="marked-info">
|
||||
<BoxAnimate
|
||||
:id="v"
|
||||
:width="24"
|
||||
:height="24"
|
||||
></BoxAnimate>
|
||||
<span class="marked-name marked-item">{{
|
||||
getName(v)
|
||||
}}</span>
|
||||
</div>
|
||||
<span class="marked-damage marked-item"
|
||||
>伤害:{{ getDamage(v) }}</span
|
||||
>
|
||||
<span class="marked-critical marked-item"
|
||||
>临界: {{ getCritical(v)[0] }}</span
|
||||
>
|
||||
<span class="marked-critical-damage marked-item"
|
||||
>减伤: {{ getCritical(v)[1] }}</span
|
||||
>
|
||||
<span class="marked-def marked-item"
|
||||
>{{ ratio }}防: {{ getDefDamage(v) }}</span
|
||||
>
|
||||
<div class="marked-button">
|
||||
<span
|
||||
class="marked-hide button-text"
|
||||
@click="getBoxPos(v).hidden = true"
|
||||
>隐藏盒子</span
|
||||
>
|
||||
<span
|
||||
class="marked-cancel button-text"
|
||||
@click="unmarkEnemy(v)"
|
||||
>取消标记</span
|
||||
>
|
||||
</div>
|
||||
</div></Scroll
|
||||
>
|
||||
</Box>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { checkMarkedStatus, getMarkedEnemy, unmarkEnemy } from '../plugin/mark';
|
||||
import { has } from '../plugin/utils';
|
||||
import Box from '../components/box.vue';
|
||||
import Scroll from '../components/scroll.vue';
|
||||
import BoxAnimate from '../components/boxAnimate.vue';
|
||||
|
||||
interface BoxPos {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
const ratio = core.status.thisMap?.ratio ?? 1;
|
||||
|
||||
let all = getMarkedEnemy();
|
||||
|
||||
watch(checkMarkedStatus, update);
|
||||
|
||||
const boxPos = reactive<Partial<Record<EnemyIds, BoxPos>>>({});
|
||||
|
||||
function update() {
|
||||
all.push(...all.splice(0, all.length));
|
||||
for (const id in boxPos) {
|
||||
if (!all.includes(id as EnemyIds)) delete boxPos[id as EnemyIds];
|
||||
}
|
||||
}
|
||||
|
||||
function getBoxPos(id: EnemyIds) {
|
||||
if (has(boxPos[id])) return boxPos[id]!;
|
||||
boxPos[id] = {
|
||||
left: window.innerWidth - 300,
|
||||
top: 100,
|
||||
width: 200,
|
||||
height: 150,
|
||||
hidden: false
|
||||
};
|
||||
return boxPos[id]!;
|
||||
}
|
||||
|
||||
function getName(id: EnemyIds) {
|
||||
return core.material.enemys[id].name;
|
||||
}
|
||||
|
||||
function getDamage(id: EnemyIds) {
|
||||
return core.formatBigNumber(core.getDamageInfo(id)?.damage) ?? '???';
|
||||
}
|
||||
|
||||
function getCritical(id: EnemyIds) {
|
||||
return (
|
||||
core.nextCriticals(id, 1)[0]?.map(v => core.formatBigNumber(v)) ?? [
|
||||
0, 0
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
function getDefDamage(id: EnemyIds) {
|
||||
return core.formatBigNumber(core.getDefDamage(id, ratio));
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
#marked-enemy {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.box-scroll {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.marked-main {
|
||||
padding: 1vh 0 1vh 0;
|
||||
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>
|
||||
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div id="settings">
|
||||
<div id="tools">
|
||||
<span class="button-text tools" @click="exit"
|
||||
><left-outlined /> 返回游戏</span
|
||||
>
|
||||
</div>
|
||||
<div id="settings-main">
|
||||
<Scroll id="setting-left">
|
||||
<div id="setting-list">
|
||||
<span
|
||||
class="selectable setting-item"
|
||||
:selected="selected === 'transition'"
|
||||
@click="transition = !transition"
|
||||
>界面动画: {{
|
||||
transition ? 'ON' : 'OFF'
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
</Scroll>
|
||||
<a-divider id="divider" type="vertical"></a-divider>
|
||||
<div id="setting-right">
|
||||
<Scroll style="height: 100%">
|
||||
<span
|
||||
v-if="descText.value.startsWith('!!html')"
|
||||
v-html="descText.value"
|
||||
></span>
|
||||
<span v-else>{{ descText.value }}</span>
|
||||
</Scroll>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { transition } from '../plugin/settings';
|
||||
import settingInfo from '../data/settings.json';
|
||||
import { type } from '../plugin/utils';
|
||||
import Scroll from '../components/scroll.vue';
|
||||
import { LeftOutlined } from '@ant-design/icons-vue';
|
||||
|
||||
type Settings = typeof settingInfo;
|
||||
|
||||
const selected = ref<keyof Settings>('transition');
|
||||
|
||||
const descText = computed(() => {
|
||||
return type(settingInfo[selected.value].desc);
|
||||
});
|
||||
|
||||
function exit() {
|
||||
core.plugin.settingsOpened.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
#settings {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-family: 'normal';
|
||||
font-size: 24px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#settings-main {
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
#setting-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
width: 100%;
|
||||
padding: 1% 3% 1% 3%;
|
||||
}
|
||||
|
||||
#setting-left {
|
||||
flex-basis: 40%;
|
||||
}
|
||||
|
||||
#setting-right {
|
||||
flex-basis: 60%;
|
||||
}
|
||||
|
||||
#divider {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#tools {
|
||||
width: 100%;
|
||||
font-family: 'normal';
|
||||
font-size: 1.7em;
|
||||
height: 5vh;
|
||||
position: fixed;
|
||||
left: 10vw;
|
||||
top: 10vh;
|
||||
}
|
||||
</style>
|
||||
@@ -149,7 +149,6 @@ watch(mode, n => {
|
||||
const descText = computed(() => {
|
||||
const s = selected.value;
|
||||
if (s === 'none') return ref('没有选择道具');
|
||||
if (all[s].text!.startsWith('!!html')) return ref(all[s].text);
|
||||
return type(all[s].text!, 25, hyper('sin', 'out'), true);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user