properties: {
time: cc.Label
},
start() {
this.time.string = 20;//如果要对倒计时的时间重新赋值
this.schedule(this.doCountdownTime, 1);
},
//倒计时
doCountdownTime() {
//每秒更新显示信息
if (this.time.string > 0) {
this.time.string -= 1;
this.countDownShow(this.time.string);
}
},
countDownShow(temp) {
if (temp <= 0) {
this.time.string = 0;
//倒计时结束
this.unschedule(this.doCountdownTime);
//执行其他操作
}
},