Browse Source

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

zouyong 5 years ago
parent
commit
99aef5512c

+ 0 - 12
assets/res/audio.meta

@@ -1,12 +0,0 @@
-{
-  "ver": "1.1.2",
-  "uuid": "160477ed-e2d0-4ee6-95f7-965820ef4f7d",
-  "isBundle": false,
-  "bundleName": "",
-  "priority": 1,
-  "compressionType": {},
-  "optimizeHotUpdate": {},
-  "inlineSpriteFrames": {},
-  "isRemoteBundle": {},
-  "subMetas": {}
-}

+ 119 - 0
assets/resources/game/prefab/coin.prefab

@@ -0,0 +1,119 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "asyncLoadAssets": false,
+    "readonly": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "coin",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_prefab": {
+      "__id__": 3
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 249,
+      "g": 247,
+      "b": 247,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 91,
+      "height": 91
+    },
+    "_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": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "8e888a59-b8e7-4546-b3cb-dbbd43868bee"
+    },
+    "_type": 0,
+    "_sizeMode": 1,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "104364bb-6ccf-4121-9404-129ac58b2ee8"
+    },
+    "fileId": "",
+    "sync": false
+  }
+]

+ 8 - 0
assets/resources/game/prefab/coin.prefab.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "1.2.9",
+  "uuid": "104364bb-6ccf-4121-9404-129ac58b2ee8",
+  "optimizationPolicy": "AUTO",
+  "asyncLoadAssets": false,
+  "readonly": false,
+  "subMetas": {}
+}

+ 2 - 2
assets/resources/game/prefab/game.prefab

@@ -2179,7 +2179,7 @@
     "asset": {
       "__uuid__": "b4dea4a9-29c8-46bc-a50d-5754afa7a2bd"
     },
-    "fileId": "d57XWfar9FlZV5UCOvKSVi",
+    "fileId": "d1PU/XLyhDerV+/uiR1oXo",
     "sync": false
   },
   {
@@ -4009,7 +4009,7 @@
       "__id__": 114
     },
     "_enabled": true,
-    "panel_name": "module/RedeemNode/RedeemNode",
+    "panel_name": "module/redeem/RedeemNode",
     "open_type": 0,
     "transition_type": 3,
     "onComplete": {

File diff suppressed because it is too large
+ 130 - 280
assets/resources/module/redeem/RedeemNode.prefab


+ 19 - 5
assets/scene/MainScene.fire

@@ -84,15 +84,12 @@
         "__id__": 11
       },
       {
-        "__id__": 12
+        "__id__": 13
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 13
-      },
-      {
         "__id__": 14
       },
       {
@@ -100,6 +97,9 @@
       },
       {
         "__id__": 16
+      },
+      {
+        "__id__": 17
       }
     ],
     "_prefab": null,
@@ -510,7 +510,11 @@
     },
     "_children": [],
     "_active": true,
-    "_components": [],
+    "_components": [
+      {
+        "__id__": 12
+      }
+    ],
     "_prefab": null,
     "_opacity": 255,
     "_color": {
@@ -560,6 +564,16 @@
     "_id": "a1JvNq9l1GDZtQfj46I+eB"
   },
   {
+    "__type__": "6ac05b5UF5BP4yjhbw+c0f0",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 11
+    },
+    "_enabled": true,
+    "_id": "dfDr9ixoNBX4RU6j6OMHdi"
+  },
+  {
     "__type__": "cc.Node",
     "_name": "引导层",
     "_objFlags": 0,

+ 2 - 1
assets/script/game/data/GameData.ts

@@ -20,7 +20,8 @@ export class GameData {
     public props: Map<number, number>;
 
     public pools = [
-        { url: "game/prefab/tips", num: 20 }
+        { url: "game/prefab/tips", num: 20 },
+        { url: "game/prefab/coin", num: 20 }
     ];
 
 

+ 1 - 1
assets/script/game/data/module/BlessingBagData.ts

@@ -59,7 +59,7 @@ export class BlessingBagData extends Data {
     async UpdateVideoProgress(data: any) {
         await mk.time.WaitForSeconds(0.5);
         this.isPlayAniUpdate = true;
-        this.videoRbData = data.UserRedMoneyInfo;
+        this.videoRbData = data.data;
     }
 
     /**

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

@@ -38,7 +38,7 @@ export default class Game extends cc.Component {
         this.initBtns();
     }
 
-    private initMusic(){
+    private initMusic() {
         mk.audio.playMusic("bgm");
     }
 
@@ -50,6 +50,12 @@ export default class Game extends cc.Component {
         sc.init();
     }
 
+    //测试道具获取效果
+    private testFly() {
+        mk.fly.PlayCoinAnim(10001, 20, cc.v2(0, -300), cc.v2(0, 0));
+        // mk.fly.PlayCoinAnim(10002, 20, cc.v2(0, -300), 'Canvas/界面层/game/功能按钮/右侧按钮/btn2');
+    }
+
     update() {
 
     }

+ 4 - 4
assets/script/game/module/module/blessingBag/BlessingBag.ts

@@ -123,10 +123,10 @@ export default class BlessingBag extends cc.Component {
 
         if (gData.blessingBag.isPlayAniUpdate) {
             if (this.lastNum < data.cumulativeAmount) {
-                // EffectNode.instance.PlayCoinAnim(1, 10, this.btnAd.getPosition(), true, this.btnCash.getPosition(), () => {
-                //     this.aniBigAdBtn.setCurrentTime(0);
-                //     this.aniBigAdBtn.play();
-                // });
+                mk.fly.PlayCoinAnim(10001, 10, this.btnAd.getPosition(), this.btnCash.getPosition(), () => {
+                    this.aniBigAdBtn.setCurrentTime(0);
+                    this.aniBigAdBtn.play();
+                });
                 this.txtAddEft.node.setPosition(cc.v2(0, 380));
                 this.txtAddEft.string = "+" + data.videoAmountPerTime + "元";
                 this.txtAddEft.node.stopAllActions();

+ 2 - 2
assets/script/game/module/module/moreGame/MoreGamePopNode.ts

@@ -68,9 +68,9 @@ export default class MoreGamePopNode extends cc.Component {
     }
 
     onClosePanel() {
-        mk.audio.playEffect('getGold');
+        // mk.audio.playEffect('getGold');
         mk.tip.pop('红包币+300');
         //     GameM.commonData.updateRedMoney(300, RecordTYPE.online)
-        //     EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300));
+        mk.fly.PlayCoinAnim(10001, 20, cc.v2(0, -300), cc.v2(0, 0));
     }
 }

+ 1 - 1
assets/script/game/module/module/redCode/VideoNode.ts

@@ -32,7 +32,7 @@ export default class VideoNode extends cc.Component {
                 this.videoPlayer.play()
 
                 mk.audio.setPauseMusic()
-                mk.audio.setTempEffect(false)
+                // mk.audio.setTempEffect(false)
             }, 1)
         })
     }

+ 61 - 69
assets/script/game/module/module/redeem/RedeemNode.ts

@@ -12,6 +12,9 @@ export default class RichHelpPanel extends cc.Component {
     @property(cc.Label)
     txtGiftName: cc.Label = null;
 
+    @property(cc.Prefab)
+    videoPre: cc.Prefab = null;
+
     @property(cc.Node)
     rds: cc.Node[] = [];
     @property(cc.Sprite)
@@ -62,7 +65,7 @@ export default class RichHelpPanel extends cc.Component {
         for (let i = 0; i < this.rewardData.length; i++) {
             this.rds[i].active = true;
             this.suc_rds[i].active = true;
-            cc.loader.loadRes("xiyou/icon/reward" + this.rewardData[i].type, cc.SpriteFrame, (err, res) => {
+            cc.loader.loadRes("module/icon/reward" + this.rewardData[i].type, cc.SpriteFrame, (err, res) => {
                 if (err) { console.log("img load err:" + JSON.stringify(err)); }
                 this.rd_imgs[i].spriteFrame = res;
                 this.suc_rd_imgs[i].spriteFrame = res;
@@ -99,7 +102,7 @@ export default class RichHelpPanel extends cc.Component {
     coolTime = false
     /** 点击教程 */
     async Click_TeachBtn() {
-        GameM.audioM.playEffect(AUDIO_TYPE.button)
+        mk.audio.playEffect('button');
         if (this.coolTime) {
             return
         }
@@ -107,9 +110,8 @@ export default class RichHelpPanel extends cc.Component {
         this.coolTime = true
 
         console.log('clickTeach')
-        GameM.commonData.teachVideoType = 2;
-        let temp = await Utils.loadResPromise('prefabs/VideoNode')
-        this.videoNode = cc.instantiate(temp)
+        gData.redCodeData.teachVideoType = 2;
+        this.videoNode = cc.instantiate(this.videoPre)
         this.videoNode.getChildByName('video').on("completed", this.onCompleted, this)
         this.node.addChild(this.videoNode)
     }
@@ -117,89 +119,79 @@ export default class RichHelpPanel extends cc.Component {
     onCompleted() {
         this.videoNode.getChildByName('video').off("completed", this.onCompleted, this)
         this.videoNode.destroy()
-        //西游
-        GameM.audioM.setTempEffect(true)
-        GameController.Ins.SwitchAudio(1)
-        //GameM.audioM.setResumeMusic()
+        // GameM.audioM.setResumeMusic()
         this.coolTime = false
     }
 
     /** 点击复制公众号 */
     clickCopyOfficial() {
-        GameM.audioM.playEffect(AUDIO_TYPE.button)
-        AdM.setClipboard("白羊游戏社")
+        mk.audio.playEffect('button');
+        // AdM.setClipboard("白羊游戏社")
     }
 
     /** 点击复制礼包名 */
     clickCopyInfo() {
-        GameM.audioM.playEffect(AUDIO_TYPE.button)
-        AdM.setClipboard(this.txtTitle.string)
-    }
-
-    Click_CloseBtn() {
-        UiM.Instance.offPanel(PANEL_NAME.RedeemNode);
-
-        //let classnew: any = cc.js.getClassByName("CashOut");
-        //console.log("-->: " + classnew);
+        mk.audio.playEffect('button');
+        // AdM.setClipboard(this.txtTitle.string)
     }
 
     async Click_GetBtn() {
         this.suc_node.active = false;
         let richDice: any = null;
 
-        for (let i = 0; i < this.rewardData.length; i++) {
-            if (this.rewardData[i].type == "10001") {
-                let coinNum = Sciencen_M.instance.accMul(GameM.commonData.goldSecond.toString(), (Number(this.rewardData[i].count) * 60).toString());
-                GameM.commonData.updateGold(coinNum);
-                GameM.audioM.playEffect(AUDIO_TYPE.getGold, false);
-                EffectNode.instance.PlayCoinAnim(0, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "10002") {
-                GameM.commonData.updateRedMoney(Number(this.rewardData[i].count))
-                EffectNode.instance.PlayCoinAnim(1, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "20002") {
-                GameM.commonData.roleData.turntableCard += Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(11, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "20001") {
-                GameM.commonData.roleData.speedCard += Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(10, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "20003") {
-                GameM.commonData.roleData.ticket += Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(12, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "20006") {
-                MateData.Ins.talentCoin += Number(this.rewardData[i].count)
-                GameM.httpM.SendData(HTTP_TYPE.updateBattleStoneCount, { "count": MateData.Ins.talentCoin })
-                EffectNode.instance.PlayCoinAnim(13, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "30001") {
-                if (richDice == null) richDice = {};
-                richDice.diceAdNum = Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(6, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "30002") {
-                if (richDice == null) richDice = {};
-                richDice.remoteCtrlNum = Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(7, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "30004") {
-                if (richDice == null) richDice = {};
-                richDice.scriptureNum = Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(9, 5, cc.v2(0, -300));
-            } else if (this.rewardData[i].type == "30005") {
-                if (richDice == null) richDice = {};
-                richDice.doubleNum = Number(this.rewardData[i].count);
-                EffectNode.instance.PlayCoinAnim(8, 5, cc.v2(0, -300));
-            }
-        }
+        // for (let i = 0; i < this.rewardData.length; i++) {
+        //     if (this.rewardData[i].type == "10001") {
+        //         let coinNum = Sciencen_M.instance.accMul(GameM.commonData.goldSecond.toString(), (Number(this.rewardData[i].count) * 60).toString());
+        //         GameM.commonData.updateGold(coinNum);
+        //         GameM.audioM.playEffect(AUDIO_TYPE.getGold, false);
+        //         EffectNode.instance.PlayCoinAnim(0, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "10002") {
+        //         GameM.commonData.updateRedMoney(Number(this.rewardData[i].count))
+        //         EffectNode.instance.PlayCoinAnim(1, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "20002") {
+        //         GameM.commonData.roleData.turntableCard += Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(11, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "20001") {
+        //         GameM.commonData.roleData.speedCard += Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(10, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "20003") {
+        //         GameM.commonData.roleData.ticket += Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(12, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "20006") {
+        //         MateData.Ins.talentCoin += Number(this.rewardData[i].count)
+        //         GameM.httpM.SendData(HTTP_TYPE.updateBattleStoneCount, { "count": MateData.Ins.talentCoin })
+        //         EffectNode.instance.PlayCoinAnim(13, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "30001") {
+        //         if (richDice == null) richDice = {};
+        //         richDice.diceAdNum = Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(6, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "30002") {
+        //         if (richDice == null) richDice = {};
+        //         richDice.remoteCtrlNum = Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(7, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "30004") {
+        //         if (richDice == null) richDice = {};
+        //         richDice.scriptureNum = Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(9, 5, cc.v2(0, -300));
+        //     } else if (this.rewardData[i].type == "30005") {
+        //         if (richDice == null) richDice = {};
+        //         richDice.doubleNum = Number(this.rewardData[i].count);
+        //         EffectNode.instance.PlayCoinAnim(8, 5, cc.v2(0, -300));
+        //     }
+        // }
 
-        if (richDice != null) {
-            //进入取经战斗 前提就是满足奖励条件下
-            RichData.Ins.UpdateItemCard2(richDice, null, false);
-        }
+        // if (richDice != null) {
+        //     //进入取经战斗 前提就是满足奖励条件下
+        //     RichData.Ins.UpdateItemCard2(richDice, null, false);
+        // }
 
         let response = await gData.redeem.redeemGetRedemption();
-        if (response && response.data.code == 1) {
-            this.InitData();
-        }
-        else {
+        // if (response && response.data.code == 1) {
+        //     this.InitData();
+        // }
+        // else {
 
-        }
+        // }
 
         // HttpM.Instance.SendData(HTTP_TYPE.redeemGetRedemption, {}, (res) => {
         //     console.log("--->RedeemGift RedeemPanel:", res);

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

@@ -0,0 +1,81 @@
+/** 
+ * @description 获取道具特效
+ * @author kaka 
+ * */
+const { ccclass } = cc._decorator;
+
+@ccclass
+export default class FlySystem extends cc.Component {
+    onLoad() {
+        mk.fly = this;
+    }
+
+    /**
+     * @param type 类型 道具id  10001,10002
+     * @param num 特效数量
+     * @param pos 起始位置
+     * @param endpos 飞行的目标坐标 或目标对象路径
+     * @param cb 动画结束回调
+    */
+    public async PlayCoinAnim(type: number = 0, num: number, pos: cc.Vec2, endpos: cc.Vec2 | string, cb: Function = null) {
+        for (let i = 0; i < num; i++) {
+            let copyCoin = await mk.pool.getPrefab('game/prefab/coin');
+            let url = 'module/icon/reward' + type;
+            let sf = await mk.loader.load(url, cc.SpriteFrame);
+            copyCoin.getComponent(cc.Sprite).spriteFrame = sf;
+            copyCoin.setParent(this.node);
+            copyCoin.scale = mk.math.random(0.8, 1.2, 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 initPos = pos.add(deltaInit);
+            copyCoin.setPosition(pos);
+
+            this.FlyIn(copyCoin, initPos, endpos, cb);
+        }
+    }
+
+    private FlyIn(target: cc.Node, end: cc.Vec2, endpos: cc.Vec2 | string = null, cb: Function = null) {
+        cc.tween(target)
+            .to(mk.math.random(0.3, 0.6, false), { position: cc.v3(end) }, cc.easeSineInOut())
+            .call(() => {
+                this.FlyOut(target, endpos, cb);
+            })
+            .start();
+    }
+
+    private FlyOut(target: cc.Node, end: cc.Vec2 | string, cb: Function = null) {
+        let dur = mk.math.random(0.3, 1, false);
+        cc.tween(target)
+            .to(dur, { scale: 0.8 })
+            .start();
+
+        let end_pos: cc.Vec2 = null;
+        let end_node: cc.Node = null;
+        if (typeof end === 'string') {
+            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 = end as cc.Vec2;
+        }
+
+        cc.tween(target)
+            .to(dur, { position: cc.v3(end_pos) }, cc.easeSineOut())
+            .call(() => {
+                console.log('end_pos  ', target.position)
+                mk.pool.return('game/prefab/coin', target);
+                if (end_node) {
+                    cc.tween(end_node).to(0.1, { scale: 1.2 }).to(0.05, { scale: 1 }).start();
+                }
+
+                if (cb != null) {
+                    cb();
+                }
+            })
+            .start();
+    }
+}
+

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

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6ac056f9-505e-413f-8ca3-85bc3e7347f4",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

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

@@ -19,6 +19,7 @@ import AudioSystem from "./AudioSystem";
 import TipSystem from "./TipSystem";
 import PoolSystem from "./PoolSystem";
 import TweenUtil from "../utils/TweenUtil";
+import FlySystem from "./FlySystem";
 
 /**
  * @description mk系统
@@ -123,6 +124,14 @@ class MKSystem {
     public set tip(v: TipSystem) {
         this._tip = v;
     }
+
+    private _fly: FlySystem;
+    public get fly(): FlySystem {
+        return this._fly;
+    }
+    public set fly(v: FlySystem) {
+        this._fly = v;
+    }
 }
 
 declare global {

+ 1 - 0
assets/script/mk/system/PoolSystem.ts

@@ -54,6 +54,7 @@ export default class PoolSystem {
      * @param node 
      */
     return(name, node: cc.Node) {
+        node.destroy();
         let pool = this.poolList[name];
         if (pool) {
             pool.put(node);

Some files were not shown because too many files changed in this diff