|
|
@@ -217,30 +217,29 @@ export default class Game extends cc.Component {
|
|
|
//this.img_head.spriteFrame = new cc.SpriteFrame(result);
|
|
|
}
|
|
|
|
|
|
+ isRefreshTask = false;
|
|
|
private changeTaskUI() {
|
|
|
- cc.tween(this.lbl_task.node).to(0.1, { scale: 1.2 }).to(0.1, { scale: 1 }).start();
|
|
|
- if (gData.gameData.playerProp.userFarmTaskInfo) {
|
|
|
- let com = gData.gameData.playerProp.userFarmTaskInfo.completeCount;
|
|
|
- let count = gData.gameData.playerProp.userFarmTaskInfo.taskCount;
|
|
|
- //if(gData.gameData.init_redBagTask)
|
|
|
- // {
|
|
|
- // this.lbl_task.string = `<b><color=#8D4D32>点击领取任务!</c></b>`
|
|
|
- // this.node_hand.active = true;
|
|
|
- // }else
|
|
|
- {
|
|
|
- this.lbl_task.string = `<b><color=#8D4D32>进行${count}次生产</c><color=#D73D25>(${com}/${count})</color></b>`
|
|
|
- if (com >= count) {
|
|
|
- this.node_hand.active = true;
|
|
|
- } else {
|
|
|
- this.node_hand.active = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (gData.gameData.playerProp.completeFarmTaskTimes < 1) {
|
|
|
- //mk.tip.pop("百元红包进度+1");
|
|
|
- }
|
|
|
+ //cc.tween(this.lbl_task.node).to(0.1, { scale: 1.2 }).to(0.1, { scale: 1 }).start();
|
|
|
+ if (!this.isRefreshTask) {
|
|
|
+ this.isRefreshTask = true;
|
|
|
+ cc.tween(this.lbl_task.node).delay(0.6).to(0.1, { scale: 1.2 }).to(0.1, { scale: 1 }).call(() => {
|
|
|
+ if (gData.gameData.playerProp.userFarmTaskInfo) {
|
|
|
+ let com = gData.gameData.playerProp.userFarmTaskInfo.completeCount;
|
|
|
+ let count = gData.gameData.playerProp.userFarmTaskInfo.taskCount;
|
|
|
+ this.lbl_task.string = `<b><color=#8D4D32>进行${count}次生产</c><color=#D73D25>(${com}/${count})</color></b>`
|
|
|
+ if (com >= count) {
|
|
|
+ this.node_hand.active = true;
|
|
|
+ } else {
|
|
|
+ this.node_hand.active = false;
|
|
|
+ }
|
|
|
|
|
|
+ // if (gData.gameData.playerProp.completeFarmTaskTimes < 1) {
|
|
|
+ // mk.tip.pop("百元红包进度+1");
|
|
|
+ // }
|
|
|
+ this.isRefreshTask = false;
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
}
|
|
|
-
|
|
|
gData.gameData.init_task = false;
|
|
|
}
|
|
|
|
|
|
@@ -419,8 +418,7 @@ export default class Game extends cc.Component {
|
|
|
/** 点击种植 */
|
|
|
public async onClickPlant() {
|
|
|
mk.audio.playEffect("button");
|
|
|
- if (gData.gameData.leftTimes <= 0)
|
|
|
- {
|
|
|
+ if (gData.gameData.leftTimes <= 0) {
|
|
|
// mk.tip.pop('生产次数不足');
|
|
|
mk.ui.openPanel('module/speedUpUI/productReward');
|
|
|
return;
|
|
|
@@ -442,49 +440,45 @@ export default class Game extends cc.Component {
|
|
|
|
|
|
let addAni = cc.instantiate(this.ani_add3);
|
|
|
addAni.parent = this.ani_add3.parent;
|
|
|
- addAni.getComponent(cc.Label).string = `百元红包:${com}/${count}`;
|
|
|
- cc.tween(addAni).call(()=>{
|
|
|
+ addAni.getComponent(cc.Label).string = `百元红包:${com}/${count}`;
|
|
|
+ cc.tween(addAni).call(() => {
|
|
|
addAni.opacity = 255;
|
|
|
- }).by(0.8, {y : 100}).to(0.4, {opacity : 0}).call(()=>{
|
|
|
+ }).by(0.8, { y: 100 }).to(0.4, { opacity: 0 }).call(() => {
|
|
|
addAni.destroy();
|
|
|
}).start();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
this.dpFlyRedAni();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public dpFlyRedAni(starPos: cc.Vec2 = null)
|
|
|
- {
|
|
|
- if(starPos)
|
|
|
- {
|
|
|
- if(this.node_taskHb && this.node_taskHb.parent)
|
|
|
- {
|
|
|
+ public dpFlyRedAni(starPos: cc.Vec2 = null) {
|
|
|
+ if (starPos) {
|
|
|
+ if (this.node_taskHb && this.node_taskHb.parent) {
|
|
|
let pos = this.node_taskHb.parent.convertToWorldSpaceAR(this.node_taskHb.getPosition());
|
|
|
mk.fly.PlayCoinAnim(1, 5, starPos, pos, () => {
|
|
|
console.log("dpFlyRedAni delay1-----");
|
|
|
- gData.gameData.init_task = true;
|
|
|
+ //gData.gameData.init_task = true;
|
|
|
}, 0.8);
|
|
|
- }else{
|
|
|
- gData.gameData.init_task = true;
|
|
|
+ } else {
|
|
|
+ //gData.gameData.init_task = true;
|
|
|
console.log("dpFlyRedAni1-----");
|
|
|
}
|
|
|
-
|
|
|
- }else{
|
|
|
|
|
|
- if(this.node_taskHb && this.node_taskHb.parent && this.btn_product)
|
|
|
- {
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (this.node_taskHb && this.node_taskHb.parent && this.btn_product) {
|
|
|
let pos = this.node_taskHb.parent.convertToWorldSpaceAR(this.node_taskHb.getPosition());
|
|
|
mk.fly.PlayCoinAnim(1, 5, this.btn_product, pos, () => {
|
|
|
- gData.gameData.init_task = true;
|
|
|
+ //gData.gameData.init_task = true;
|
|
|
console.log("dpFlyRedAni delay2-----");
|
|
|
}, 0.8);
|
|
|
- }else{
|
|
|
- gData.gameData.init_task = true;
|
|
|
+ } else {
|
|
|
+ //gData.gameData.init_task = true;
|
|
|
console.log("dpFlyRedAni2-----");
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -517,12 +511,12 @@ export default class Game extends cc.Component {
|
|
|
this.ani_add.node.getComponent(cc.Label).string = `+${exp}`;
|
|
|
this.ani_add.node.active = true;
|
|
|
this.ani_add.play();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
|
|
|
- this.ani_add2.getComponent(cc.Label).string = `生产次数+${exp}`;
|
|
|
- cc.tween(this.ani_add2).delay(1.3).call(()=>{
|
|
|
+ this.ani_add2.getComponent(cc.Label).string = `生产次数+${exp}`;
|
|
|
+ cc.tween(this.ani_add2).delay(1.3).call(() => {
|
|
|
this.ani_add2.opacity = 255;
|
|
|
- }).by(0.8, {y : 100}).to(0.4, {opacity : 0}).call(()=>{
|
|
|
+ }).by(0.8, { y: 100 }).to(0.4, { opacity: 0 }).call(() => {
|
|
|
this.ani_add2.y = this.posY;
|
|
|
}).start();
|
|
|
}
|