Kaynağa Gözat

Merge branch 'master' of http://git.mokasz.com/zouyong/team1_nc

kaka 4 yıl önce
ebeveyn
işleme
c6879ed2f4

+ 0 - 12
assets/resources/animation/Main.meta

@@ -1,12 +0,0 @@
-{
-  "ver": "1.1.2",
-  "uuid": "4e4c7e27-6fce-4142-bde1-d4e0cea5b72e",
-  "isBundle": false,
-  "bundleName": "",
-  "priority": 1,
-  "compressionType": {},
-  "optimizeHotUpdate": {},
-  "inlineSpriteFrames": {},
-  "isRemoteBundle": {},
-  "subMetas": {}
-}

+ 294 - 21
assets/scene/MainScene.fire

@@ -78,28 +78,37 @@
         "__id__": 6
       },
       {
-        "__id__": 9
+        "__id__": 8
       },
       {
-        "__id__": 11
+        "__id__": 10
       },
       {
         "__id__": 13
+      },
+      {
+        "__id__": 15
+      },
+      {
+        "__id__": 17
+      },
+      {
+        "__id__": 20
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 17
+        "__id__": 24
       },
       {
-        "__id__": 18
+        "__id__": 25
       },
       {
-        "__id__": 19
+        "__id__": 26
       },
       {
-        "__id__": 20
+        "__id__": 27
       }
     ],
     "_prefab": null,
@@ -308,7 +317,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "界面层",
+    "_name": "界面层",
     "_objFlags": 0,
     "_parent": {
       "__id__": 2
@@ -318,9 +327,170 @@
     "_components": [
       {
         "__id__": 7
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 750,
+      "height": 1334
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "c4KZdsLhVDXp/ke35SXvVl"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 6
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 750,
+    "_originalHeight": 1334,
+    "_id": "94HVTPv7RCCrJFibPebIIp"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "特效层2",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 9
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "cahrTyu/5J0q6H4qLw5qyl"
+  },
+  {
+    "__type__": "9719d5vrDdGwKCmEwkS2KPT",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "_id": "64ERsg/5pFE4l4FAFog9Ci"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "界面层",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 11
       },
       {
-        "__id__": 8
+        "__id__": 12
       }
     ],
     "_prefab": null,
@@ -376,7 +546,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 10
     },
     "_enabled": true,
     "_id": "28M/hEEcFHZqi/h+X6U+Jt"
@@ -386,7 +556,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 10
     },
     "_enabled": true,
     "alignMode": 1,
@@ -419,7 +589,7 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 10
+        "__id__": 14
       }
     ],
     "_prefab": null,
@@ -475,7 +645,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 9
+      "__id__": 13
     },
     "_enabled": true,
     "tween_time": 1,
@@ -512,7 +682,7 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 12
+        "__id__": 16
       }
     ],
     "_prefab": null,
@@ -568,13 +738,116 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 11
+      "__id__": 15
     },
     "_enabled": true,
     "_id": "d7Krs4ut1FS6lgpB36rsTx"
   },
   {
     "__type__": "cc.Node",
+    "_name": "触摸监听层",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 18
+      },
+      {
+        "__id__": 19
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 750,
+      "height": 1334
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "c6eJGiPh1CNYgVvTnSw87U"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 17
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 750,
+    "_originalHeight": 1334,
+    "_id": "30qZbzaQBOvaYsR7m4nr0J"
+  },
+  {
+    "__type__": "c48faqtHrRIIYx6Y8FQN71b",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 17
+    },
+    "_enabled": true,
+    "isRegisterEvent": true,
+    "_id": "ecZaYZ7mFMTKBMPsMuZApg"
+  },
+  {
+    "__type__": "cc.Node",
     "_name": "引导层",
     "_objFlags": 0,
     "_parent": {
@@ -582,13 +855,13 @@
     },
     "_children": [
       {
-        "__id__": 14
+        "__id__": 21
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 16
+        "__id__": 23
       }
     ],
     "_prefab": null,
@@ -643,10 +916,10 @@
     "__type__": "cc.Node",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 13
+      "__id__": 20
     },
     "_prefab": {
-      "__id__": 15
+      "__id__": 22
     },
     "_name": "GuideWeak",
     "_active": true,
@@ -677,7 +950,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 14
+      "__id__": 21
     },
     "asset": {
       "__uuid__": "ba2e33b2-5a64-424b-8b08-247fed4be0f0"
@@ -690,7 +963,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 13
+      "__id__": 20
     },
     "_enabled": true,
     "alignMode": 1,
@@ -765,7 +1038,7 @@
     },
     "_enabled": true,
     "node_guide": {
-      "__id__": 13
+      "__id__": 20
     },
     "_id": "6fbJRZsUhE4p90rFOw/XX3"
   },

+ 3 - 0
assets/script/game/data/GameData.ts

@@ -17,6 +17,9 @@ export class GameData {
 
     public getPropsFnish: boolean = false;
 
+    //是否触摸屏幕
+    public isTouchScreen: boolean = false;
+
 
     public configs: any = {};
     public adShowConfig: ADShowCfg;

+ 1 - 1
assets/script/game/game/Farmer.ts

@@ -47,7 +47,7 @@ return;
             this.refreshTime -= dt;
         }else{
             this.refreshTime = 10;
-            mk.fly.PlayCoinAnim(1, 3, this.fly_node, '', null, -1 ,2);
+            mk.fly2.PlayCoinAnim(1, 3, this.fly_node, '', null, -1 ,2);
         }
     }
 }

+ 1 - 2
assets/script/game/game/Game.ts

@@ -302,7 +302,7 @@ export default class Game extends cc.Component {
     //测试道具获取效果
     private testFly() {
         mk.fly.PlayCoinAnim(1, 20, null, cc.v2(0, 0));
-        // mk.fly.PlayCoinAnim(2, 20, cc.v2(0, -300), 'Canvas/界面层/game/功能按钮/右侧按钮/btn2');
+        // mk.fly.PlayCoinAnim(2, 20, cc.v2(0, -300), 'Canvas/界面层/game/功能按钮/右侧按钮/btn2');
     }
 
     /** 点击开始 */
@@ -385,7 +385,6 @@ export default class Game extends cc.Component {
 
         let pos = this.node_taskHb.parent.convertToWorldSpaceAR(this.node_taskHb.getPosition());
         mk.fly.PlayCoinAnim(4, 3, this.btn_product, pos, () => {
-
             gData.gameData.init_task = true;
         }, 1)
     }

+ 25 - 0
assets/script/game/game/TouchListener.ts

@@ -0,0 +1,25 @@
+const { ccclass, property } = cc._decorator;
+
+/**
+ * @description 触摸监听
+ */
+
+ @ccclass
+ export class TouchListener extends cc.Component {
+
+    @property({displayName: '是否注册触摸事件'})
+    private isRegisterEvent = true;
+
+    start(){
+        this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
+        this.node['_touchListener'].swallowTouches  = false;
+    }
+
+    private onTouchStart(e)
+    {
+        if(!gData.gameData.isTouchScreen)
+        {
+            gData.gameData.isTouchScreen = true;
+        }        
+    }
+ }

+ 9 - 0
assets/script/game/game/TouchListener.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "c48faaad-1eb4-4821-8c7a-63c15037bd5b",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 3 - 1
assets/script/game/module/login/Login.ts

@@ -1,5 +1,6 @@
 import Util from "../../../before/util/Util";
 import JsbSystem from "../../../mk/system/JsbSystem";
+import { OpenActionType } from "../../../mk/system/UISystem";
 import { UpdateState } from "../../data/AppData";
 import HotUpdatePanel from "../hotUpdate/HotUpdatePanel";
 
@@ -91,7 +92,8 @@ export default class Login extends cc.Component {
                     mk.storage.setStorage("agreementTip", 1, false);
                 }
                 else {
-                    mk.ui.openPanel("game/prefab/game");
+                    let node = cc.find('Canvas/主界面层');
+                    mk.ui.openPanel("game/prefab/game", OpenActionType.normal, node);
                     console.log("===[Jsbsystem 显示开屏广告================================")
                     if (mk.ad.ifShowAd) {
                         JsbSystem.showSplash();

+ 2 - 2
assets/script/mk/system/FlySystem.ts

@@ -73,10 +73,10 @@ export default class FlySystem extends cc.Component {
             if (end == '') {
                 let url = ''
                 if (type == RewardType.redBag) {
-                    url = 'Canvas/界面层/game/node_ui/顶部个人信息/提现按钮/icon_zb';
+                    url = 'Canvas/界面层/game/node_ui/顶部个人信息/提现按钮/icon_zb';
                 }
                 else if (type == RewardType.pigRmb) {
-                    url = 'Canvas/界面层/game/node_ui/顶部个人信息/金猪币按钮/icon_zb';
+                    url = 'Canvas/界面层/game/node_ui/顶部个人信息/金猪币按钮/icon_zb';
                 } else {
                     // 未知类型
                     mk.pool.return('game/prefab/coin', target);

+ 182 - 0
assets/script/mk/system/FlySystem2.ts

@@ -0,0 +1,182 @@
+import { RewardType } from "../../game/data/GameData";
+
+/** 
+ * @description 获取道具特效
+ * @author kaka 
+ * */
+const { ccclass } = cc._decorator;
+
+@ccclass
+export default class FlySystem2 extends cc.Component {
+    onLoad() {
+        mk.fly2 = this;
+    }
+
+    private is_new_cb = true;
+    /**
+     * @param type 类型 道具id  10001,10002
+     * @param num 特效数量
+     * @param pos 起始位置
+     * @param endpos 飞行目标的世界坐标 或目标对象路径  如果为"",则飞到主界面货币按钮处 默认""
+     * @param cb 动画结束回调
+    */
+    public async PlayCoinAnim(type: number = 0, num: number, startpos_node: cc.Node, endpos: cc.Vec2 | string = '', item_cb: Function = null, isScale: number = -1, averageValue: number = -1) {
+        for (let i = 0; i < num; i++) {
+            let copyCoin = await mk.pool.getPrefab('game/prefab/coin');
+            let url = 'game/texture/coin/' + type;
+            let sf = await mk.loader.load(url, cc.SpriteFrame);
+            copyCoin.getComponent(cc.Sprite).spriteFrame = sf;
+            copyCoin.setParent(this.node);
+            if(isScale != -1)
+            {
+                copyCoin.scale = isScale;
+            }else{
+                copyCoin.scale = mk.math.random(0.56, 0.84, false);
+            }  
+            copyCoin.angle = mk.math.random(-45, 45, false);
+            let dir = cc.v2(mk.math.random(-1, 1, false), mk.math.random(-1, 1, false));
+            dir = dir.normalize();
+            let deltaInit = cc.v2(mk.math.random(10, 160, false) * dir.x, mk.math.random(10, 160, false) * dir.y);
+            let pos = new cc.Vec2(0, -300);
+            if(startpos_node)
+            {
+                let world_Pos = startpos_node.parent.convertToWorldSpaceAR(startpos_node.getPosition());
+                pos = this.node.convertToNodeSpaceAR(world_Pos);
+            }
+            let initPos = pos.add(deltaInit);
+            copyCoin.setPosition(pos);
+
+            this.FlyIn(type, copyCoin, initPos, endpos, item_cb, averageValue);
+        }
+        this.is_new_cb = true;
+    }
+
+    private FlyIn(type: number, target: cc.Node, end: cc.Vec2, endpos: cc.Vec2 | string = null, item_cb: Function = null, averageValue: number = -1) {
+        cc.tween(target)
+            .to(mk.math.random(0.3, 0.6, false), { position: cc.v3(end) }, cc.easeSineInOut())
+            .call(() => {
+                this.FlyOut(type, target, endpos, item_cb, averageValue);
+            })
+            .start();
+    }
+
+    private FlyOut(type: number, target: cc.Node, end: cc.Vec2 | string, item_cb: Function = null, averageValue: number = -1) {
+        let dur = mk.math.random(0.3, 1, false);
+        cc.tween(target)
+            .to(dur, { scale: 0.8 })
+            .start();
+
+            console.log('---');
+        let end_pos: cc.Vec2 = null;
+        let end_node: cc.Node = null;
+        if (typeof end === 'string') {
+            if (end == '') {
+                let url = ''
+                if (type == RewardType.redBag) {
+                    url = 'Canvas/主界面层/game/node_ui/顶部个人信息/提现按钮/icon_zb';
+                }
+                else if (type == RewardType.pigRmb) {
+                    url = 'Canvas/主界面层/game/node_ui/顶部个人信息/金猪币按钮/icon_zb';
+                } else {
+                    // 未知类型
+                    mk.pool.return('game/prefab/coin', target);
+                    return;
+                }
+                end = url;
+            }
+
+            end_node = cc.find(end as string);
+            let world_pos = end_node.parent.convertToWorldSpaceAR(end_node.getPosition());
+            end_pos = this.node.convertToNodeSpaceAR(world_pos);
+        }
+        else {
+            end_pos = this.node.convertToNodeSpaceAR(end);
+        }
+
+        cc.tween(target)
+            .to(dur, { position: cc.v3(end_pos) }, cc.easeSineOut())
+            .call(() => {
+                console.log('end_pos  ', target.position)
+                
+                // if (end_node) {
+                //     cc.tween(end_node).to(0.1, { scale: 1.2 }).to(0.05, { scale: 1 }).start();
+                // }
+                if(averageValue != -1)
+                {
+                    this.showLabStrChange(averageValue);
+                }
+
+                if (item_cb != null) {
+                    this.is_new_cb && item_cb();
+                    this.is_new_cb = false;
+                }
+                //this.iconScale(type);
+
+                mk.pool.return('game/prefab/coin', target);
+            })
+            .start();
+    }
+
+    /**
+     * icon缩放动画
+     * @param type icon类型
+     * @returns 
+     */
+    private iconScale(type: number) {
+        let node;
+        if (type === 1) {
+            node = gData.gameData.gameStyle.lbl_redMoney.node;
+        } else if (type === 3) {
+            node = gData.gameData.gameStyle.lbl_redMoney.node;
+        }
+        if (!node) return;
+        cc.tween(node).to(0.1, { scale: 1.3 }).to(0.05, { scale: 1 }).start();
+    }
+
+    private showLabStrChange(value: number)
+    {
+        if(gData.gameData.gameStyle.lbl_redMoney)
+        {
+            gData.gameData.gameData.redMoney += value;
+            //gData.gameData.gameStyle.lbl_redMoney.string = gData.gameData.gameData.redMoney.toString();
+            //cc.tween(gData.gameData.gameStyle.lbl_redMoney.node).to(0.1, { scale: 1.2 }).to(0.05, { scale: 1 }).start();
+        }
+    }
+
+    /**
+     * 节点飞行动画
+     * @param startTarget 飞行节点
+     * @param endTarget 飞行终点位置的节点
+     * @param duration 飞行时间
+     * @param callFuc 回调
+     * @param offsetPos 相对终点的偏移值
+     */
+
+    public playFlyAni(startTarget: cc.Node, cloneTarget: cc.Node, endTarget: cc.Node, duration: number, callFuc: Function|null = null, offsetPos: cc.Vec3 = cc.Vec3.ZERO)
+    {
+        let worldPos = startTarget.parent.convertToWorldSpaceAR(startTarget.getPosition());
+        let pos = endTarget.parent.convertToNodeSpaceAR(worldPos);
+        let newNode = cc.instantiate(cloneTarget);
+        newNode.active = true;
+        newNode.setParent(endTarget.parent);
+        newNode.setPosition(pos);
+        //cc.Tween.stopAllByTarget(newNode);
+
+        // let endWorldPos = endTarget.parent.convertToWorldSpaceAR(endTarget.getPosition());
+        // let endPos = this.node.convertToNodeSpaceAR(endWorldPos);
+
+        //测试代码
+        //let p = endTarget.getPosition();
+
+        let endPos = cc.Vec3.ZERO;
+        endPos.add(offsetPos, endPos);
+
+        cc.tween(newNode).to(duration, { position: cc.v3(endPos) }, cc.easeSineOut()).call(()=>{    
+            if(callFuc)
+            {
+                callFuc();
+            }      
+            newNode.destroy();
+        }).start();
+    }
+}

+ 9 - 0
assets/script/mk/system/FlySystem2.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "9719de6f-ac37-46c0-a0a6-130912d8a3d3",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 9 - 0
assets/script/mk/system/MKSystem.ts

@@ -25,6 +25,7 @@ import SetGray from "../../game/component/SetGray";
 import NumberAnim from "../../game/component/NumberAnim";
 import AliRiskManager from "../sdk/aliRisk/AliRiskManager";
 import ATSDKMgr from "../sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr";
+import FlySystem2 from "./FlySystem2";
 
 /**
  * @description mk系统
@@ -150,6 +151,14 @@ class MKSystem {
         this._fly = v;
     }
 
+    private _fly2:FlySystem2; 
+    public get fly2():FlySystem2{
+        return this._fly2;
+    }
+    public set fly2(v:FlySystem2){
+        this._fly2 = v;
+    }
+
     /** mk组件类型,此处仅返回类型 */
     private _component: comp_type
     /** 组件类型 */