From 8b8abf1ea43d1e0740d7312fcb13225cce2e0484 Mon Sep 17 00:00:00 2001 From: dgflash Date: Thu, 19 Jan 2023 20:40:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DLabelTime=E8=AE=A1=E6=97=B6?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=BF=9E=E7=BB=AD=E4=BD=BF=E7=94=A8=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/libs/gui/label/LabelTime.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/libs/gui/label/LabelTime.ts b/assets/libs/gui/label/LabelTime.ts index e91ef8a..6fbf486 100644 --- a/assets/libs/gui/label/LabelTime.ts +++ b/assets/libs/gui/label/LabelTime.ts @@ -122,10 +122,13 @@ export default class LabelTime extends Label { this.countDown--; this.format(); if (this.onSecond) this.onSecond(this.node); + + if (this.countDown == 0) { + this.onScheduleComplete(); + } } private onScheduleComplete() { - this.countDown--; this.timing_end(); if (this.onComplete) this.onComplete(this.node); } @@ -133,13 +136,11 @@ export default class LabelTime extends Label { /** 开始计时 */ private timing_start() { this.schedule(this.onScheduleSecond, 1); - this.scheduleOnce(this.onScheduleComplete, this.countDown); this.format(); } private timing_end() { - this.unschedule(this.onScheduleSecond); - this.unschedule(this.onScheduleComplete); + this.unscheduleAllCallbacks(); this.format(); } }