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);
//執行其他操作
}
},