wuwangdong 4 tahun lalu
induk
melakukan
56acf7b676

+ 2 - 0
assets/script/before/main/FarmIcon.ts

@@ -163,6 +163,8 @@ export class FarmIcon extends cc.Component {
 
         let child = this.node.getChildByName('hb');
         this.node.removeChild(child);
+
+        gData.gameData.gameStyle.doCropFlyLogic(this.plantID, this.node);
     }
 
     public async plant(id: number) {

+ 21 - 0
assets/script/game/game/Game.ts

@@ -93,6 +93,8 @@ export default class Game extends cc.Component {
     @property({ displayName: '数字组', type: cc.Label })
     lbl_value: cc.Label[] = [];
 
+    //订单部分
+    
     posY = 0;
     /** 是否开始增加次数倒计时 */
     private lastTimeSpan = 0;
@@ -832,5 +834,24 @@ export default class Game extends cc.Component {
 
         return des;
     }
+
+    //订单部分
+
+    async doCropFlyLogic(plantId:number, farmNode: cc.Node)
+    {
+        let crop = cc.instantiate(this.icon_plant.node);
+        crop.active = true;
+        crop.getComponent(cc.Sprite).spriteFrame = await mk.loader.load("game/coregame/texture/plant_icons/nameIcon/plant_name_" + plantId, cc.SpriteFrame);
+ 
+        mk.fly.playFlyAniExtra(farmNode, this.node_taskHb, crop, 0.6);
+    }
+
+    async cloneCropFuc(plantId: number)
+    {
+       
+        //iconPath = "game/coregame/texture/plant_icons/plantIcon_";
+        
+        //this.icon_plantName.spriteFrame = await mk.loader.load(namePath + gData.gameData.nextCanProduct.picture, cc.SpriteFrame);
+    }
 }
 

+ 19 - 0
assets/script/mk/system/FlySystem.ts

@@ -171,5 +171,24 @@ export default class FlySystem extends cc.Component {
             newNode.destroy();
         }).start();
     }
+
+    public playFlyAniExtra(startTarget: cc.Node, endTarget: cc.Node, cloneTarget: cc.Node, duration: number, callFuc: Function = null) {
+        let worldPos_1 = startTarget.parent.convertToWorldSpaceAR(startTarget.getPosition());
+        let pos_1 = this.node.convertToNodeSpaceAR(worldPos_1);
+        let worldPos_2 = startTarget.parent.convertToWorldSpaceAR(endTarget.getPosition());
+        let pos_2 = this.node.convertToNodeSpaceAR(worldPos_2);
+        if (cloneTarget) {
+            cloneTarget.setParent(this.node);
+            cloneTarget.setPosition(pos_1);
+            cc.tween(cloneTarget).to(2, { position: cc.v3(pos_2) }, cc.easeSineOut()).call(() => {
+                if (callFuc) {
+                    callFuc();
+                }
+                cloneTarget.destroy();
+            }).start();
+        } else {
+            return;
+        }
+    }
 }