feat: full-screen StoryGallery with flow layout, startAtScene engine method, clickable flow nodes
This commit is contained in:
@@ -357,17 +357,30 @@ export class Engine {
|
||||
const scene = this.sceneManager.getScene(chapter.startScene)
|
||||
if (!scene) return
|
||||
|
||||
const defaultVars = chapter.defaultVariables
|
||||
if (defaultVars) {
|
||||
this.stateManager.variables = { ...defaultVars }
|
||||
this.initChapterState(chapter)
|
||||
this.ended = false
|
||||
this.isInitialScene = false
|
||||
this.goToScene(scene)
|
||||
}
|
||||
|
||||
private initChapterState(chapter: { defaultVariables?: Record<string, number> }) {
|
||||
if (chapter.defaultVariables) {
|
||||
this.stateManager.variables = { ...chapter.defaultVariables }
|
||||
} else {
|
||||
this.stateManager.init(this.sceneManager.chapters.length > 0
|
||||
? {} // from chapters, use the chapter's defaultVariables or empty
|
||||
: {})
|
||||
this.stateManager.init({})
|
||||
}
|
||||
this.stateManager.flags = new Set()
|
||||
this.stateManager.history = []
|
||||
}
|
||||
|
||||
startAtScene(chapterId: string, sceneId: string) {
|
||||
const chapter = this.sceneManager.getChapter(chapterId)
|
||||
if (!chapter) return
|
||||
|
||||
const scene = this.sceneManager.getScene(sceneId)
|
||||
if (!scene) return
|
||||
|
||||
this.initChapterState(chapter)
|
||||
this.ended = false
|
||||
this.isInitialScene = false
|
||||
this.goToScene(scene)
|
||||
|
||||
Reference in New Issue
Block a user