You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
216 lines
5.5 KiB
216 lines
5.5 KiB
3 months ago
|
<template>
|
||
2 months ago
|
<Tooltip :infos="[t('menu')]" width="12rem">
|
||
3 months ago
|
<img class="menu-img" :src="menu_icons.reborn" @click="showMenu">
|
||
|
</Tooltip>
|
||
|
|
||
2 months ago
|
<Dialog :title="t('menu')" v-model="showReborn" top="4rem" :left="state.mobile ? '4%' : '8%'" padding="0.7rem">
|
||
3 months ago
|
<div class="message">
|
||
|
<div class="tips">
|
||
2 months ago
|
<p>- {{ t('desc.0') }}</p>
|
||
|
<p>- {{ t('desc.1') }}</p>
|
||
|
<p>- {{ t('desc.2') }}</p>
|
||
3 months ago
|
</div>
|
||
|
</div>
|
||
2 months ago
|
<div class="points">
|
||
3 months ago
|
<div class="info">
|
||
2 months ago
|
<p>{{ t('total') }} :{{ points.total }}</p>
|
||
|
<p>{{ t('has') }} :{{ points.has }}</p>
|
||
3 months ago
|
</div>
|
||
|
<div class="attributes">
|
||
2 months ago
|
<div class="attribute" v-for="attr in piont_arrts" :key="attr">
|
||
3 months ago
|
<p>
|
||
|
<img :src="attr_icon_urls[attr]">
|
||
|
<span>
|
||
2 months ago
|
{{ t1(attr + '.0') }}:+{{ baseAttribute[attr] }}
|
||
3 months ago
|
{{ attr_unitys[attr] }}
|
||
|
</span>
|
||
|
</p>
|
||
|
<div class="group">
|
||
|
<Tooltip :infos="[t('subtractPoints')]" width="10rem">
|
||
3 months ago
|
<button class="button" @mousedown="mousedown(-1, attr, $event)"
|
||
|
@touchstart="touchstart(-1, attr)" @touchend="touchend(-1)">-</button>
|
||
3 months ago
|
</Tooltip>
|
||
2 months ago
|
<input type="number" min="0" disabled v-model="points[attr]">
|
||
3 months ago
|
<Tooltip :infos="[t('addPoints')]" width="10rem">
|
||
3 months ago
|
<button class="button" @mousedown="mousedown(1, attr, $event)"
|
||
|
@touchstart="touchstart(1, attr)" @touchend="touchend(1)">+</button>
|
||
3 months ago
|
</Tooltip>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</Dialog>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts" setup>
|
||
|
import { useStore } from "vuex";
|
||
2 months ago
|
import { reactive, onMounted, ref, computed, onBeforeUnmount } from "vue";
|
||
3 months ago
|
import { useI18n } from "vue3-i18n";
|
||
|
import { Tooltip, Dialog, Confirm } from "@/components"
|
||
2 months ago
|
import { menu_icons, piont_arrts, attr_icon_urls, attr_unitys, backpack_num } from "@/config";
|
||
|
import { createt } from "@/config/i18n";
|
||
3 months ago
|
|
||
2 months ago
|
const t = createt('point.');
|
||
|
const t1 = useI18n().t;
|
||
3 months ago
|
const { state, commit, dispatch } = useStore();
|
||
|
const showReborn = computed(() => {
|
||
2 months ago
|
return state.curMenu == 'point';
|
||
3 months ago
|
});
|
||
2 months ago
|
const points = computed(() => {
|
||
|
return state.points;
|
||
3 months ago
|
})
|
||
2 months ago
|
const baseAttribute = computed(() => {
|
||
|
return state.baseAttribute;
|
||
3 months ago
|
})
|
||
2 months ago
|
const arrts = ['hp', 'atk', 'crit', 'critDmg', 'def', 'bloc', 'moveSpeed', 'battleSpeed'];
|
||
3 months ago
|
|
||
|
let flag = false;
|
||
|
let curAttr = '';
|
||
|
let curNum = 0;
|
||
|
|
||
3 months ago
|
const touchstart = (num, attr) => {
|
||
|
if (!state.mobile) return;
|
||
|
flag = true;
|
||
|
if (curNum == 0) {
|
||
|
curNum = num;
|
||
|
flag = true;
|
||
|
curAttr = attr;
|
||
|
changeAttribute();
|
||
|
}
|
||
|
}
|
||
|
const touchend = (num) => {
|
||
|
if (!state.mobile) return;
|
||
|
if (curNum == num || curNum == num * -1) {
|
||
|
curNum = 0;
|
||
|
flag = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
3 months ago
|
const mousedown = (num, attr, e) => {
|
||
3 months ago
|
if (state.mobile) return;
|
||
3 months ago
|
flag = true;
|
||
|
num *= 4.5 * e.button + 1;
|
||
|
if (curNum == 0) {
|
||
|
curNum = num;
|
||
|
flag = true;
|
||
|
curAttr = attr;
|
||
|
changeAttribute();
|
||
|
}
|
||
|
}
|
||
|
const mouseup = (e) => {
|
||
3 months ago
|
if (state.mobile) return;
|
||
3 months ago
|
const num = 4.5 * e.button + 1
|
||
|
if (curNum == num || curNum == num * -1) {
|
||
|
curNum = 0;
|
||
|
flag = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const changeAttribute = () => {
|
||
|
if (flag) {
|
||
2 months ago
|
const rp = points.value;
|
||
|
const point = rp.has;
|
||
3 months ago
|
const oldPoint = rp[curAttr];
|
||
|
let num = 0;
|
||
|
if (curNum > 0 && point > 0) {
|
||
|
num = point - curNum < 0 ? point : curNum;
|
||
|
} else if (curNum < 0 && oldPoint > 0) {
|
||
|
num = oldPoint + curNum < 0 ? oldPoint * -1 : curNum;
|
||
|
}
|
||
|
if (num != 0) {
|
||
|
rp[curAttr] = oldPoint + num;
|
||
2 months ago
|
rp.has = point - num;
|
||
|
commit('set_points', rp)
|
||
3 months ago
|
}
|
||
|
setTimeout(changeAttribute, 100);
|
||
|
}
|
||
|
}
|
||
2 months ago
|
|
||
3 months ago
|
const showMenu = () => {
|
||
2 months ago
|
state.curMenu = showReborn.value ? null : 'point';
|
||
3 months ago
|
}
|
||
|
const keydown = (e) => {
|
||
|
if (e.keyCode == 82 && !e.ctrlKey) {
|
||
|
showMenu();
|
||
|
}
|
||
|
}
|
||
|
onMounted(() => {
|
||
|
document.addEventListener('keydown', keydown)
|
||
|
document.addEventListener('mouseup', mouseup)
|
||
|
});
|
||
|
onBeforeUnmount(() => {
|
||
|
document.removeEventListener('keydown', keydown)
|
||
|
document.removeEventListener('mouseup', mouseup)
|
||
|
})
|
||
|
</script>
|
||
|
<style lang="scss" scoped>
|
||
|
.message {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
border-bottom: 1px solid #ccc;
|
||
|
padding-bottom: 0.8rem;
|
||
|
|
||
3 months ago
|
p {
|
||
|
margin: 0.7rem;
|
||
|
}
|
||
|
|
||
3 months ago
|
.tips {
|
||
|
padding-left: 1.3rem;
|
||
2 months ago
|
text-align: left;
|
||
3 months ago
|
|
||
|
p {
|
||
|
color: #999;
|
||
|
font-size: 0.8rem;
|
||
|
margin: 0rem;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
2 months ago
|
.points {
|
||
3 months ago
|
padding: 0.1rem;
|
||
|
width: 32rem;
|
||
|
|
||
|
.info {
|
||
|
padding: 0.3rem;
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.attributes {
|
||
|
padding: 0.05rem 0;
|
||
|
|
||
|
}
|
||
|
|
||
|
.attribute {
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
2 months ago
|
padding: 0.3rem 0.7rem;
|
||
3 months ago
|
|
||
|
p {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
|
||
|
img {
|
||
|
width: 1.6rem;
|
||
|
height: 1.6rem;
|
||
|
}
|
||
|
|
||
|
span {
|
||
|
margin-left: 0.4rem;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.group {
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
|
||
|
input {
|
||
|
width: 5.5rem;
|
||
|
color: black;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</style>
|