private countDownTimer = 0;
private timeControl(second) {
if (second > 0) {
this.countDownTimer = egret.setTimeout(()=>{
}, this, 1000);
this.countDownTimer = egret.setInterval(function () {
if (second > 0 && this.bCanSelectFreeGame) {
second--;
// console.log('secound:', second);
let str: string = Utils.replaceString(Config.language['freeGameCountDown_' + Config.lang], [second]);
MainGameView.instance.changeGameTip(str);
if (second <= 0) {
// console.log("停止計時");
clearInterval(this.countDownTimer);//倒計時結束停止有效
let str: string = Utils.replaceString(Config.language['mainGame016_' + Config.lang]);
MainGameView.instance.changeGameTip(str);
}
}
}, this, 1000);
}
}
private onOpenButton(evt: egret.Event) {
let self = this;
clearInterval(this.countDownTimer);//倒計時還未結束時點擊按鈕停止無效?
}
uj5u.com熱心網友回復:
this.countDownTimer = egret.setTimeout(()=>{}, this, 1000);
這句話不要,原打算換個寫法
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/270395.html
標籤:JavaScript
上一篇:代碼資料回圈報錯的咨詢
