feat: playback bar component, save system improvements, demo and roadmap updates

This commit is contained in:
2026-06-09 14:21:41 +08:00
parent ca71b6d52e
commit 660fa9347c
9 changed files with 222 additions and 16 deletions

View File

@@ -16,15 +16,22 @@ interface UnlockRecord {
chapterId: string
}
interface WatchedRecord {
sceneId: string
timestamp: number
}
class SaveDB extends Dexie {
saves!: Table<SaveRecord, number>
unlocks!: Table<UnlockRecord, string>
watched!: Table<WatchedRecord, string>
constructor() {
super('MovieGameSaves')
this.version(3).stores({
this.version(4).stores({
saves: '++id, slot',
unlocks: 'chapterId',
watched: 'sceneId',
})
}
}
@@ -96,4 +103,21 @@ export class SaveSystem {
const records = await db.unlocks.toArray()
return records.map((r) => r.chapterId)
}
async markWatched(sceneId: string) {
const exists = await db.watched.get(sceneId)
if (!exists) {
await db.watched.put({ sceneId, timestamp: Date.now() })
}
}
async isWatched(sceneId: string): Promise<boolean> {
const record = await db.watched.get(sceneId)
return !!record
}
async getWatchedSceneIds(): Promise<string[]> {
const records = await db.watched.toArray()
return records.map((r) => r.sceneId)
}
}