chore: sync latest changes

This commit is contained in:
2026-06-09 17:21:54 +08:00
parent bca137535b
commit 451c6ea025
12 changed files with 503 additions and 28 deletions

View File

@@ -5,6 +5,7 @@ import { StateManager } from './StateManager'
import { ChoiceSystem } from '../systems/ChoiceSystem'
import { QTESystem } from '../systems/QTESystem'
import { AudioSystem } from '../systems/AudioSystem'
import { AchievementSystem } from '../systems/AchievementSystem'
type EventHandler = (...args: any[]) => void
@@ -15,6 +16,7 @@ export class Engine {
choiceSystem: ChoiceSystem
qteSystem: QTESystem
audioSystem: AudioSystem
achievementSystem: AchievementSystem
private currentScene: SceneNode | null = null
private events: Map<EngineEvent, Set<EventHandler>> = new Map()
@@ -42,6 +44,11 @@ export class Engine {
this.choiceSystem = new ChoiceSystem()
this.qteSystem = new QTESystem()
this.audioSystem = new AudioSystem()
this.achievementSystem = new AchievementSystem()
this.stateManager.onAfterApply = (vars) => {
this.achievementSystem.check(vars)
}
this.videoManager.onTimeUpdate(this.onTimeUpdate)
}

View File

@@ -4,6 +4,7 @@ export class StateManager {
variables: Record<string, number> = {}
flags: Set<string> = new Set()
history: ChoiceRecord[] = []
onAfterApply: ((variables: Record<string, number>) => void) | null = null
init(initialVars: Record<string, number>) {
this.variables = { ...initialVars }
@@ -72,6 +73,7 @@ export class StateManager {
break
}
}
this.onAfterApply?.(this.variables)
}
recordChoice(choice: ChoiceRecord) {