From d28abbcf462f368ad2c390057eccf6844e44a98e Mon Sep 17 00:00:00 2001 From: dgflash Date: Sat, 10 Jan 2026 20:56:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DTimerManager=E6=96=B0?= =?UTF-8?q?=E7=89=88=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/core/common/timer/TimerManager.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/assets/core/common/timer/TimerManager.ts b/assets/core/common/timer/TimerManager.ts index 1f52881..c159cfb 100644 --- a/assets/core/common/timer/TimerManager.ts +++ b/assets/core/common/timer/TimerManager.ts @@ -15,7 +15,7 @@ interface ITimer> { /** 定时器 */ timer: Timer; /** 数据对象 - 必须包含数字类型的字段 */ - object: T; + object: any; /** 修改数据对象的字段 */ field: keyof T; /** 事件侦听器的目标和被叫方 */ @@ -139,7 +139,7 @@ export class TimerManager extends Component { target: null!, startTime: 0, onSeconds: null, - onCompletes: null + onCompletes: null, }; } @@ -172,7 +172,7 @@ export class TimerManager extends Component { } */ register>( - object: T, + object: object, field: keyof T, target: object, onSecond?: Function, @@ -194,16 +194,14 @@ export class TimerManager extends Component { if (onSecond) { data.onSeconds = data.onSeconds || []; data.onSeconds.push(onSecond); - } - else { + } else { data.onSeconds = null; } if (onComplete) { data.onCompletes = data.onCompletes || []; data.onCompletes.push(onComplete); - } - else { + } else { data.onCompletes = null; } @@ -401,4 +399,4 @@ export class TimerManager extends Component { // 清理对象池 this.timerPool.length = 0; } -} \ No newline at end of file +}