|
|
@@ -6,7 +6,7 @@
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
|
|
@ccclass
|
|
|
-export default class BlessingBagItem extends cc.Component{
|
|
|
+export default class BlessingBagItem extends cc.Component {
|
|
|
|
|
|
@property(cc.Label)
|
|
|
txtNum: cc.Label = null;
|
|
|
@@ -24,6 +24,8 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
btnCanCash: cc.Node = null;
|
|
|
@property(cc.Node)
|
|
|
btnNoFinish: cc.Node = null;
|
|
|
+ @property(cc.Node)
|
|
|
+ ani_fadeUp: cc.Node = null;
|
|
|
|
|
|
data: any = null;
|
|
|
lastNum: number = 0;
|
|
|
@@ -35,18 +37,21 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
|
|
|
isPlayAni: boolean = false;
|
|
|
|
|
|
+ isInit: boolean = true;
|
|
|
+
|
|
|
/**
|
|
|
* list_data
|
|
|
* @param data item数据
|
|
|
*/
|
|
|
public async setItemData(bData) {
|
|
|
+ this.ani_fadeUp.opacity = 0;
|
|
|
this.Init(bData.data, bData.isPlayAniUpdate, bData.isPlayInitAni);
|
|
|
}
|
|
|
|
|
|
Init(data: any, isPlayAni: boolean = false, isPlayInitAni: boolean = false) {
|
|
|
this.data = data;
|
|
|
- this.txtNum.string = data.redMoney/100 + "元";
|
|
|
- this.txtTip.string = "<b><color=#F89800>" + data.redMoney/100 + "元</c><color = #BB6738>提现进度</c></b>";
|
|
|
+ this.txtNum.string = data.redMoney / 100 + "元";
|
|
|
+ this.txtTip.string = "<b><color=#F89800>" + data.redMoney / 100 + "元</c><color = #BB6738>提现进度</c></b>";
|
|
|
this.btnCashed.active = data.status == 2;
|
|
|
this.btnCanCash.active = data.status == 1;
|
|
|
this.btnNoFinish.active = data.status == 0;
|
|
|
@@ -66,9 +71,9 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
.start();
|
|
|
}, 0.3);
|
|
|
} else {
|
|
|
- this.txtSlider.string = (data.progressRate*100).toFixed(2) + "%";
|
|
|
+ this.txtSlider.string = (data.progressRate * 100).toFixed(2) + "%";
|
|
|
this.slider.fillRange = data.progressRate;
|
|
|
- this.lastNum = data.progressRate *100;
|
|
|
+ this.lastNum = data.progressRate * 100;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -78,8 +83,8 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
|
|
|
PlayNumAni(time: number) {
|
|
|
this.totalTime = time;
|
|
|
- this.delta = (this.data.progressRate*100 - this.lastNum) / time;
|
|
|
- this.deltaTime = time / (this.data.progressRate*100 - this.lastNum);
|
|
|
+ this.delta = (this.data.progressRate * 100 - this.lastNum) / time;
|
|
|
+ this.deltaTime = time / (this.data.progressRate * 100 - this.lastNum);
|
|
|
this.curValue = this.lastNum;
|
|
|
this.curTime = 0;
|
|
|
this.isPlayAni = true;
|
|
|
@@ -87,8 +92,8 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
|
|
|
PlayInitNumAni(time: number) {
|
|
|
this.totalTime = time;
|
|
|
- this.delta = (this.data.progressRate*100 - 0) / time;
|
|
|
- this.deltaTime = time / (this.data.progressRate*100 - 0);
|
|
|
+ this.delta = (this.data.progressRate * 100 - 0) / time;
|
|
|
+ this.deltaTime = time / (this.data.progressRate * 100 - 0);
|
|
|
this.curValue = 0;
|
|
|
this.curTime = 0;
|
|
|
|
|
|
@@ -99,14 +104,14 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
if (this.curTime < this.totalTime) {
|
|
|
this.curTime += this.deltaTime;
|
|
|
this.curValue += this.delta * this.deltaTime;
|
|
|
- if (this.curValue >= this.data.progressRate*100) {
|
|
|
- this.curValue = this.data.progressRate*100;
|
|
|
+ if (this.curValue >= this.data.progressRate * 100) {
|
|
|
+ this.curValue = this.data.progressRate * 100;
|
|
|
}
|
|
|
} else {
|
|
|
this.curTime = this.totalTime;
|
|
|
this.unschedule(this.UpdateAni);
|
|
|
- this.curValue = this.data.progressRate*100;
|
|
|
- this.lastNum = this.data.progressRate*100;
|
|
|
+ this.curValue = this.data.progressRate * 100;
|
|
|
+ this.lastNum = this.data.progressRate * 100;
|
|
|
}
|
|
|
this.txtSlider.string = this.curValue.toFixed(2) + "%";
|
|
|
this.slider.fillRange = this.curValue * 0.01;
|
|
|
@@ -117,8 +122,9 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
if (this.curTime < this.totalTime) {
|
|
|
this.curTime += dt;
|
|
|
this.curValue += this.delta * dt;
|
|
|
- if (this.curValue >= this.data.progressRate *100) {
|
|
|
+ if (this.curValue >= this.data.progressRate * 100) {
|
|
|
this.isPlayAni = false;
|
|
|
+ this.doAni();
|
|
|
this.curValue = this.data.progressRate * 100;
|
|
|
this.lastNum = this.data.progressRate * 100;
|
|
|
}
|
|
|
@@ -127,16 +133,34 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
//}
|
|
|
} else {
|
|
|
this.isPlayAni = false;
|
|
|
+ this.doAni();
|
|
|
this.curTime = this.totalTime;
|
|
|
//this.unschedule(this.UpdateAni);
|
|
|
this.curValue = this.data.progressRate * 100;
|
|
|
- this.lastNum = this.data.progressRate * 100;
|
|
|
+ this.lastNum = this.data.progressRate * 100;
|
|
|
}
|
|
|
this.txtSlider.string = this.curValue.toFixed(2) + "%";
|
|
|
this.slider.fillRange = this.curValue * 0.01;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ doAni() {
|
|
|
+ if(this.isInit)
|
|
|
+ {
|
|
|
+ this.isInit = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let add = this.data.progressRate*100 - this.lastNum;
|
|
|
+ if(add > 0)
|
|
|
+ {
|
|
|
+ this.ani_fadeUp.scale = 0;
|
|
|
+ this.ani_fadeUp.opacity = 255;
|
|
|
+ cc.tween(this.ani_fadeUp).to(0.2, {scale: 1}).delay(0.6).to(0.2, {opacity: 0}).start();
|
|
|
+ this.ani_fadeUp.getComponent(cc.Label).string = '+' + add.toFixed(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
OnExit() {
|
|
|
this.txtSlider.string = "0.00%";
|
|
|
this.slider.fillRange = 0;
|
|
|
@@ -152,7 +176,7 @@ export default class BlessingBagItem extends cc.Component{
|
|
|
Click_CanCashBtn() {
|
|
|
mk.audio.playEffect("button");
|
|
|
console.log("clicked canCash");
|
|
|
- gData.blessingBag.OpenTaskRbPanel( this.data.Id, this.data.redMoney);
|
|
|
+ gData.blessingBag.OpenTaskRbPanel(this.data.Id, this.data.redMoney);
|
|
|
}
|
|
|
|
|
|
Click_NoFinishBtn() {
|