feat: P15 ending gallery, chapter recap, visited tracking, save system v6

This commit is contained in:
2026-06-09 17:49:07 +08:00
parent 47d6ce50fe
commit 9297117544
14 changed files with 517 additions and 48 deletions

View File

@@ -25,19 +25,25 @@ interface AchievementRecord {
achievementId: string
}
interface VisitedRecord {
sceneId: string
}
class SaveDB extends Dexie {
saves!: Table<SaveRecord, number>
unlocks!: Table<UnlockRecord, string>
watched!: Table<WatchedRecord, string>
achievements!: Table<AchievementRecord, string>
visited!: Table<VisitedRecord, string>
constructor() {
super('MovieGameSaves')
this.version(5).stores({
this.version(6).stores({
saves: '++id, slot',
unlocks: 'chapterId',
watched: 'sceneId',
achievements: 'achievementId',
visited: 'sceneId',
})
}
}
@@ -138,4 +144,16 @@ export class SaveSystem {
const records = await db.achievements.toArray()
return records.map((r) => r.achievementId)
}
async markVisited(sceneId: string) {
const exists = await db.visited.get(sceneId)
if (!exists) {
await db.visited.put({ sceneId })
}
}
async getVisitedSceneIds(): Promise<string[]> {
const records = await db.visited.toArray()
return records.map((r) => r.sceneId)
}
}