|
|
@@ -22,7 +22,7 @@ export default class NumberAnim extends cc.Component {
|
|
|
this.toFixed = toFixed;
|
|
|
this.len_target = new_value.toString().length;
|
|
|
this.targetProgress = new_value;
|
|
|
- this.PlayMoneyAni(0.3)
|
|
|
+ this.PlayMoneyAni(0.3);
|
|
|
}
|
|
|
|
|
|
//////////////////////////////////数字滚动效果//////////////////////////////////
|
|
|
@@ -43,12 +43,11 @@ export default class NumberAnim extends cc.Component {
|
|
|
/** 保留小数点位数 */
|
|
|
private toFixed: number = 0;
|
|
|
|
|
|
- private PlayMoneyAni(time) {
|
|
|
+ private PlayMoneyAni(time: number) {
|
|
|
this.totalTime = time;
|
|
|
- this.delta = (this.targetProgress - this.lastNum) / time;
|
|
|
+ this.delta = (this.targetProgress - this.lastNum);// / time;
|
|
|
this.curValue = this.lastNum;
|
|
|
this.curTime = 0;
|
|
|
- // console.log("--->Update Time: " + time + " delta: " + this.delta + " curValue: " + this.curValue + " lastNum: " + this.lastNum);
|
|
|
this.isPlayAni = true;
|
|
|
}
|
|
|
|
|
|
@@ -62,18 +61,20 @@ export default class NumberAnim extends cc.Component {
|
|
|
this.curValue = this.targetProgress;
|
|
|
this.lastNum = this.targetProgress;
|
|
|
}
|
|
|
- // console.log("-->CurValue:" + this.curValue);
|
|
|
} else {
|
|
|
this.isPlayAni = false;
|
|
|
this.curTime = this.totalTime;
|
|
|
- //this.unschedule(this.UpdateAni);
|
|
|
this.curValue = this.targetProgress;
|
|
|
this.lastNum = this.targetProgress;
|
|
|
}
|
|
|
if (this.curValue == this.targetProgress) {
|
|
|
this.lbl_count.string = `${this.targetProgress}`;
|
|
|
} else {
|
|
|
- this.lbl_count.string = `${this.curValue.toFixed(this.toFixed)}`;
|
|
|
+ if (!this.curValue) {
|
|
|
+ mk.console.log('数字动画出现异常:', this.curValue);
|
|
|
+ this.curValue = this.targetProgress;
|
|
|
+ }
|
|
|
+ this.lbl_count.string = this.curValue.toFixed(this.toFixed);
|
|
|
}
|
|
|
}
|
|
|
}
|