From 25ea9ce9fdb259b3222ca89dec7816e58479bdeb Mon Sep 17 00:00:00 2001 From: cocos02 Date: Sun, 7 Jun 2026 18:53:05 +0800 Subject: [PATCH] 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. --- engine/systems/ChoiceSystem.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/systems/ChoiceSystem.ts b/engine/systems/ChoiceSystem.ts index 236ce83..f0c63be 100644 --- a/engine/systems/ChoiceSystem.ts +++ b/engine/systems/ChoiceSystem.ts @@ -25,13 +25,14 @@ export class ChoiceSystem { const maxLimit = Math.max(...timed.map((c) => c.timeLimit!)) + const maxLimitSec = maxLimit / 1000 + this.timeLimit = maxLimit this.elapsed = 0 this.onUpdate = onUpdate this.onTimeout = onTimeout - const state: ChoiceTimerState = { total: maxLimit, remaining: maxLimit } - this.onUpdate(state) + this.onUpdate({ total: maxLimitSec, remaining: maxLimitSec }) this.timerId = setInterval(() => { this.elapsed += this.tickMs