feat: add puzzle residence configuration and reflection progress logic

- Introduced `puzzleResidences.ts` to define puzzle residence configurations including properties like display name, position, and puzzle availability.
- Added `reflectionProgress.ts` to manage badge unlocking logic based on place completion, including functions to determine unlocked badges and video sources for scenes.
This commit is contained in:
zhongyidian committed 2026-04-27 11:49:30 +08:00
1 parent e0fa47d21a
commit f5f36f75b5
153 files changed
+3846 -2352

No files matched your search

+13
View File
@@ -51,6 +51,10 @@ interface NieerStore {
reflectionWorks: Record<number, Record<string, unknown>>
setReflectionWork: (sceneId: number, payload: Record<string, unknown>) => void
resetReflectionWorks: () => void
// 是否已经看过体悟首页学习引导
hasSeenReflectionGuide: boolean
markReflectionGuideSeen: () => void
}
// 将 Set 转换为数组以便序列化
@@ -129,6 +133,7 @@ export const useNieerStore = create<NieerStore>()(
// ========== 体悟模块状态 ==========
visitedReflectionCursors: {},
reflectionWorks: {},
hasSeenReflectionGuide: false,
markReflectionCursorVisited: (scene: string, cursorId: number) => {
set((state) => {
@@ -182,6 +187,10 @@ export const useNieerStore = create<NieerStore>()(
resetReflectionWorks: () => {
set({ reflectionWorks: {} })
},
markReflectionGuideSeen: () => {
set({ hasSeenReflectionGuide: true })
},
}),
{
name: STORE_NAMES.NIEER,
@@ -190,6 +199,7 @@ export const useNieerStore = create<NieerStore>()(
visitedReflectionCursors: serializeVisitedExhibits(state.visitedReflectionCursors),
lastVisitedPlace: state.lastVisitedPlace,
reflectionWorks: state.reflectionWorks,
hasSeenReflectionGuide: state.hasSeenReflectionGuide,
}),
onRehydrateStorage: () => (state) => {
if (state) {
@@ -203,6 +213,9 @@ export const useNieerStore = create<NieerStore>()(
if (!state.reflectionWorks || typeof state.reflectionWorks !== 'object') {
state.reflectionWorks = {}
}
if ((state as any).hasSeenReflectionGuide === undefined) {
;(state as any).hasSeenReflectionGuide = false
}
}
},
}