Commit Graph

19 Commits

Author SHA1 Message Date
64a474a741 feat: expose store as window.__store for debugging 2026-06-07 20:29:14 +08:00
12d30cc128 docs: add QTE explanation comment in QTESystem 2026-06-07 19:50:45 +08:00
319a379921 feat: P2 - QTE system, subtitles, save thumbnails
- QTESystem: trigger detection via timeupdate, multi-key matching, timeout handling
- QTEOverlay: SVG countdown ring + key prompts + success/fail animation
- Engine: integrate QTE (timeupdate check, conditional branching, effect application)
- Subtitles: WebVTT parsing + synchronized subtitle rendering
- GamePlayer: overlay QTE and subtitle components
- SaveSystem: DB v2 with thumbnail field, canvas snapshot at 320x180 JPEG
- SaveLoadMenu: thumbnail preview for save slots
- VideoManager: getActiveVideoElement() for canvas capture
- App.vue: QTE/subtitle integration, thumbnail capture on save
- stores: QTE state management, save list with thumbnails
- demo.json: QTE scene (right_door), subtitles, new event types
- ROADMAP: mark P2 as completed
2026-06-07 19:35:14 +08:00
c168e30e52 tweak: reduce intro timeLimit from 15s to 5s for faster testing 2026-06-07 19:00:16 +08:00
fa84ed909a test: add timeLimit to intro scene for timer feature testing
First intro choice has 15s limit, times out to left_door if user doesn't act
2026-06-07 18:59:37 +08:00
7826d789a7 docs: add unit comment for Choice.timeLimit 2026-06-07 18:57:16 +08:00
c7d035bd8f fix: interpret Choice.timeLimit as seconds, convert to ms internally
Previously maxLimit was passed directly to setTimeout/setInterval (ms),
so a JSON value of 10 meant 10ms instead of the intended 10 seconds.
Now timeLimit in JSON represents seconds, engine multiplies by 1000.
2026-06-07 18:56:30 +08:00
25ea9ce9fd fix: consistent timer unit (seconds) in ChoiceSystem first onUpdate
The first onUpdate call used raw milliseconds (e.g. total: 10000),
while subsequent ticks used seconds (total: 10). This caused the
progress bar to jump on the first interval tick.
2026-06-07 18:53:05 +08:00
c61826e87c feat: auto-save on scene change + resume from auto-save
- useGameEngine: auto-save to slot 0 on every sceneChange event
- useGameEngine: add resumeAutoSave() for continuing from auto-save
- useGameEngine: extract registerEvents() to share between start and resume
- SaveLoadMenu: show slot 0 as '自动存档' with distinct styling and read-only button
- App.vue: check auto-save on load, show '继续上次进度' button if available
2026-06-07 18:42:34 +08:00
2de9f99a81 feat: add StateManager.dump() and expose window.__sm for debugging
- StateManager.dump(): console.table formatted dump of variables, flags, history
- window.__sm: exposes engine.stateManager in dev mode for console inspection
2026-06-07 17:27:52 +08:00
b96a12a2f3 docs: add comment explaining waitReady logic 2026-06-07 17:05:59 +08:00
937e45c203 feat: P1 core - seamless video switching, conditional branches, save/load
- VideoManager: A/B dual-buffered video with crossfade transitions and candidate preloading
- Engine: condition-based choice filtering, ChoiceSystem timer, resumeScene for save/load
- SceneManager: getCandidateUrls for preloading next scenes
- SaveSystem: Dexie.js IndexedDB multi-slot save/load
- ChoiceSystem: timed choices with countdown and auto-default on timeout
- GamePlayer: dual video elements with crossfade CSS
- ChoicePanel: timer progress bar and countdown text
- SaveLoadMenu: save/load UI component
- App.vue: menu trigger, dual video refs, save/load integration
- gameStore: timer state, saves list
- demo.json: conditional choice example (secret ending, requires trust >= 80)
- ROADMAP: mark P1 as completed
2026-06-07 16:48:52 +08:00
42181fe185 chore: remove unused imports in useGameEngine 2026-06-07 16:18:05 +08:00
058e688f6e add feature idea: AI-generated story from player choices 2026-06-07 16:03:05 +08:00
7aed2b46ca fix: add start button to satisfy browser autoplay policy
Replace auto-start after loading with a '开始游戏' button overlay.
The user click provides the required user gesture for autoplay with sound,
fixing the issue where play() was silently rejected and choices never appeared.
2026-06-07 15:44:31 +08:00
192ecbbce2 fix: wait for video metadata before playing and set onEnd before play
- Reorder onEnd callback before play() in Engine.goToScene to prevent
  missed ended event if video ends synchronously
- Wait for loadedmetadata event in VideoManager.play() before seeking
  to ensure currentTime reset works correctly on new video sources
2026-06-07 14:34:15 +08:00
fb93782331 fix: wait for DOM update before attaching video element 2026-06-07 14:16:20 +08:00
3729b90be9 add README 2026-06-07 14:05:01 +08:00
aeb6dc46a4 init 2026-06-07 13:50:05 +08:00