refactor: 完成成就

This commit is contained in:
unanmed 2023-11-13 13:02:33 +08:00
parent 2d3146758b
commit d178908649
4 changed files with 6 additions and 10 deletions

View File

@ -159,7 +159,6 @@
</div> </div>
</div> </div>
<div id="root"></div> <div id="root"></div>
<div id="root2"></div>
<!-- injection --> <!-- injection -->
<script src='libs/thirdparty/lz-string.min.js'></script> <script src='libs/thirdparty/lz-string.min.js'></script>
<script src='libs/thirdparty/priority-queue.min.js'></script> <script src='libs/thirdparty/priority-queue.min.js'></script>

View File

@ -276,7 +276,6 @@ mainSetting.on('valueChange', (key, n, o) => {
}); });
const root = document.getElementById('root') as HTMLDivElement; const root = document.getElementById('root') as HTMLDivElement;
const root2 = document.getElementById('root2') as HTMLDivElement;
function handleScreenSetting<T extends number | boolean>( function handleScreenSetting<T extends number | boolean>(
key: string, key: string,
@ -318,7 +317,7 @@ function handleScreenSetting<T extends number | boolean>(
} else if (key === 'fontSize') { } else if (key === 'fontSize') {
// 字体大小 // 字体大小
core.setLocalStorage('fontSize', n); core.setLocalStorage('fontSize', n);
root.style.fontSize = root2.style.fontSize = `${n}px`; root.style.fontSize = `${n}px`;
} else if (key === 'smoothView') { } else if (key === 'smoothView') {
core.setLocalStorage('smoothView', n); core.setLocalStorage('smoothView', n);
} else if (key === 'criticalGem') { } else if (key === 'criticalGem') {

View File

@ -21,9 +21,6 @@ export default function init() {
return { completeAchievement, hasCompletedAchievement, addMountSign }; return { completeAchievement, hasCompletedAchievement, addMountSign };
} }
export const showComplete = ref(false);
export const completeAchi = ref('explore,1');
export const totalPoint = Object.values(list) export const totalPoint = Object.values(list)
.map((v: Achievement[]) => .map((v: Achievement[]) =>
v.reduce((prev, curr) => { v.reduce((prev, curr) => {
@ -54,8 +51,7 @@ export function completeAchievement(type: AchievementType, index: number) {
if (type === 'explore' && !Object.values(achiDict).includes(index)) { if (type === 'explore' && !Object.values(achiDict).includes(index)) {
checkCompletionAchievement(); checkCompletionAchievement();
} }
completeAchi.value = `${type},${index}`; mota.ui.fixed.open('completeAchi', { complete: `${type},${index}` });
showComplete.value = true;
} }
/** /**

View File

@ -25,13 +25,15 @@ import list from '../data/achievement.json';
import { import {
AchievementType, AchievementType,
getNowPoint, getNowPoint,
showComplete,
totalPoint totalPoint
} from '../plugin/ui/achievement'; } from '../plugin/ui/achievement';
import { GameUi } from '@/core/main/custom/ui';
const height = window.innerHeight; const height = window.innerHeight;
const props = defineProps<{ const props = defineProps<{
num: number;
ui: GameUi;
complete: string; complete: string;
}>(); }>();
@ -60,7 +62,7 @@ onMounted(async () => {
now.value = Math.floor(nowPoint + point * ratio); now.value = Math.floor(nowPoint + point * ratio);
}); });
await sleep(4600); await sleep(4600);
showComplete.value = false; mota.ui.fixed.close(props.num);
}); });
</script> </script>