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:
1 parent
5a1c3cc368
commit
284302341c
72 files changed
+1104
-517
No files matched your search
@@ -6,6 +6,9 @@ import { setUserDefine } from '@/lib/utils/api-common'
|
||||
interface PuzzleStore {
|
||||
// 每个故居的已解锁碎片集合,格式:{ residence: Set<pieceId> }
|
||||
puzzles: Record<string, Set<number>>
|
||||
isLoaded: boolean
|
||||
|
||||
setLoaded: (isLoaded: boolean) => void
|
||||
|
||||
// 解锁碎片
|
||||
unlockPuzzle: (residence: string, pieceId: number) => void
|
||||
@@ -74,6 +77,9 @@ export const usePuzzleStore = create<PuzzleStore>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
puzzles: {},
|
||||
isLoaded: false,
|
||||
|
||||
setLoaded: (isLoaded: boolean) => set({ isLoaded }),
|
||||
|
||||
unlockPuzzle: (residence: string, pieceId: number) => {
|
||||
const { puzzles } = get()
|
||||
|
||||
Reference in new issue
Block a user