feat: add progression logic for puzzle residences

- Implemented functions to manage puzzle progress including checking if residences are started, complete, and unlocked.
- Added utility functions to retrieve piece IDs based on residence and route.
- Introduced a new TypeScript file for progression management.
- Integrated puzzle data configuration and residence data for seamless progression tracking.
This commit is contained in:
zhongyidian committed 2026-05-01 21:19:25 +08:00
1 parent 5a1c3cc368
commit 284302341c
72 files changed
+1104 -517

No files matched your search

+10 -7
View File
@@ -38,16 +38,19 @@ function AppContent() {
;(async () => {
try {
const raw = await getUserDefine(PUZZLE_LESSON_ID, PUZZLE_KEY)
if (!raw) return
const data = JSON.parse(raw) as { puzzles?: Record<string, number[]> }
if (data.puzzles) {
usePuzzleStore.setState((prev) => ({
...prev,
puzzles: deserializePuzzles(data.puzzles),
}))
if (raw) {
const data = JSON.parse(raw) as { puzzles?: Record<string, number[]> }
if (data.puzzles) {
usePuzzleStore.setState((prev) => ({
...prev,
puzzles: deserializePuzzles(data.puzzles),
}))
}
}
} catch (e) {
console.error('Failed to load puzzle store', e)
} finally {
usePuzzleStore.getState().setLoaded(true)
}
})()
}, [])