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

@@ -25,11 +25,16 @@ export class Engine {
private justCameFromImage = false
private loopActive = false
private onUnlockChapter: ((chapterId: string) => void) | null = null
private onMarkWatched: ((sceneId: string) => void) | null = null
setChapterUnlockHandler(handler: (chapterId: string) => void) {
this.onUnlockChapter = handler
}
setMarkWatchedHandler(handler: (sceneId: string) => void) {
this.onMarkWatched = handler
}
constructor() {
this.sceneManager = new SceneManager()
this.videoManager = new VideoManager()
@@ -277,6 +282,8 @@ export class Engine {
}
private onVideoEnd(scene: SceneNode) {
this.onMarkWatched?.(scene.id)
if (this.loopActive) return
const validChoices = this.getValidChoices(scene)
@@ -348,6 +355,13 @@ export class Engine {
this.emit('gameEnd')
}
skipCurrentScene() {
const scene = this.currentScene
if (!scene) return
this.videoManager.getActiveVideoElement()?.pause()
this.onVideoEnd(scene)
}
startChapter(chapterId: string) {
const chapter = this.sceneManager.getChapter(chapterId)
if (!chapter) return