全屏游戏

This commit is contained in:
AncTe committed 2023-02-22 21:39:44 +08:00
1 parent 2687a0e50b
commit f3938bf1bb
9 files changed
+175 -91

No files matched your search

+14 -1
View File
@@ -1,8 +1,11 @@
import list from '../../data/achievement.json';
import { has } from '../utils';
type AchievementList = typeof list;
type AchievementType = keyof AchievementList;
type AchievementData = Record<AchievementType, boolean[]>;
export default function init() {
return {};
}
@@ -10,5 +13,15 @@ export default function init() {
export function completeAchievement(type: AchievementType, index: number) {}
export function hasCompletedAchievement(type: AchievementType, index: number) {
return true;
let data = core.getLocalStorage<AchievementData>('achievement');
if (!has(data)) {
const d = {
normal: [],
challenge: [],
explore: []
};
data = d;
core.setLocalStorage('achievement', d);
}
return data[type][index] ?? false;
}