今天更新2.12后,发现一个BUG, 在一个tween里面间隔一秒,去刷新label, 类似一个倒计时。都会出现Label的string直接变成1。上传中…
之前的版本是2.09是正常的。
const {ccclass, property} = cc._decorator;
@ccclass
export default class Helloworld extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
start () {
// init logic
this.label.string = this.text;
let allTimer = 23;
let that = this;
let func = function(){
allTimer--;
that.label.string = allTimer.toString()+'秒';
if(allTimer<=0){
// that.label.node.active =false;
}
}
cc['tween'](this)
.delay(1.0)
.call(() => {
func();
})
.repeat(Math.floor(23))
.start();
// this.schedule(func,1,23)
}
}