feat: playback bar component, save system improvements, demo and roadmap updates
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user