修改勇士属性获取方式,实现勇士自动定位

This commit is contained in:
AncTe committed 2023-01-09 23:50:28 +08:00
1 parent a85cef79ec
commit 7465dd92c8
11 files changed
+319 -138

No files matched your search

+13
View File
@@ -35,6 +35,11 @@ export const showStudied = ref(true);
*/
export const useFixed = ref(true);
/**
* 是否使用勇士自动定位功能
*/
export const autoLocate = ref(true);
watch(transition, n => {
core.plugin.transition.value = n;
core.setLocalStorage('transition', n);
@@ -67,6 +72,12 @@ watch(useFixed, n => {
core.setLocalStorage('useFixed', n);
});
watch(autoSkill, n => {
flags.autoLocate = n;
core.updateStatusBar();
core.status.route.push(`set:autoLocate:${n}`);
});
/**
* 重置设置信息,从localStorage读取即可
*/
@@ -82,9 +93,11 @@ function reset() {
function resetFlag() {
flags.autoSkill ??= true;
flags.itemDetail ??= true;
flags.autoLocate ??= true;
itemDetail.value = flags.itemDetail ? true : false;
autoSkill.value = flags.autoSkill ? true : false;
autoLocate.value = flags.autoLocate ? true : false;
}
export default function init() {
+8 -7
View File
@@ -1,5 +1,5 @@
import { sleep } from 'mutate-animate';
import { Component, markRaw, ref, Ref, watch } from 'vue';
import { Component, markRaw, ref, Ref, shallowReactive, watch } from 'vue';
import Book from '../ui/book.vue';
import Toolbox from '../ui/toolbox.vue';
import Equipbox from '../ui/equipbox.vue';
@@ -41,21 +41,22 @@ const UI_LIST: [Ref<boolean>, Component][] = [
];
/** ui栈 */
export const uiStack = ref<Component[]>([]);
export const uiStack = shallowReactive<Component[]>([]);
export default function init() {
app = document.getElementById('root') as HTMLDivElement;
UI_LIST.forEach(([ref, com]) => {
watch(ref, n => {
if (n === true) {
uiStack.value.push(markRaw(com));
uiStack.push(markRaw(com));
showApp();
} else {
const index = uiStack.value.findIndex(v => v === com);
if (uiStack.value.length === 1) {
const index = uiStack.findIndex(v => v === com);
if (index === -1) return;
if (uiStack.length === 1) {
hideApp(index);
} else {
uiStack.value.splice(index, 1);
uiStack.splice(index, 1);
}
}
});
@@ -98,7 +99,7 @@ async function hideApp(index: number) {
app.style.transition = '';
app.style.opacity = '0';
}
uiStack.value.splice(index, 1);
uiStack.splice(index, 1);
app.style.display = 'none';
if (!noClosePanel.value) core.closePanel();
noClosePanel.value = false;