Forráskód Böngészése

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

kaka 5 éve
szülő
commit
43898e5c92

+ 12 - 0
assets/resources/module/guideWeak.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "ab5e8500-43f4-483b-a621-6ddbaaf94257",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 241 - 0
assets/resources/module/guideWeak/GuideWeak.prefab

@@ -0,0 +1,241 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "asyncLoadAssets": false,
+    "readonly": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "GuideWeak",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 5
+      },
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_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": [
+        375,
+        667,
+        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.Node",
+    "_name": "New Label",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      }
+    ],
+    "_prefab": {
+      "__id__": 4
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 240,
+      "height": 50.4
+    },
+    "_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.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_string": "若引导运行中",
+    "_N$string": "若引导运行中",
+    "_fontSize": 40,
+    "_lineHeight": 40,
+    "_enableWrapText": true,
+    "_N$file": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_batchAsBitmap": false,
+    "_styleFlags": 0,
+    "_underlineHeight": 0,
+    "_N$horizontalAlign": 1,
+    "_N$verticalAlign": 1,
+    "_N$fontFamily": "Arial",
+    "_N$overflow": 0,
+    "_N$cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "ba2e33b2-5a64-424b-8b08-247fed4be0f0"
+    },
+    "fileId": "9bpVbHl+FJeqHz4I/c2T/+",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_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": 0,
+    "_originalHeight": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "f13f5zT97NMpINpXOCogVAt",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "label": null,
+    "text": "hello",
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "ba2e33b2-5a64-424b-8b08-247fed4be0f0"
+    },
+    "fileId": "",
+    "sync": false
+  }
+]

+ 8 - 0
assets/resources/module/guideWeak/GuideWeak.prefab.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "1.2.9",
+  "uuid": "ba2e33b2-5a64-424b-8b08-247fed4be0f0",
+  "optimizationPolicy": "AUTO",
+  "asyncLoadAssets": false,
+  "readonly": false,
+  "subMetas": {}
+}

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

@@ -64,6 +64,7 @@ export class GameData {
         mk.console.logSingle("getInfoCrypt", response.data);
         this.initPlayerProp(response.data)
         this.initProps(response.data.gameUserData);
+        gData.guideData.init();
         gData.moduleData.forEach(element => {
             element.init();
         });
@@ -104,6 +105,7 @@ export class GameData {
         this.gameData.turntableTimes = res_data.turntableTimes;
         this.gameData.userTuCaoInfo = res_data.userTuCaoInfo;
         this.gameData.versioncfg = res_data.versioncfg;
+        this.gameData.isFirstRedMoney = res_data.isFirstRedMoney;
     }
 
     /**
@@ -176,6 +178,8 @@ export class GameData {
     public resetProps() {
         let arr = [];
         arr.push({ key: GameProp.sign_can, value: 1 });
+        arr.push({ key: GameProp.isAutoOpenPanel, value: 1 });
+        arr.push({ key: GameProp.isOpenBankOnCloseCash, value: 0 });
 
         this.setProps(arr);
     }
@@ -196,6 +200,10 @@ export enum GameProp {
     newPlayer = 1,
     /** 当前新手引导步骤 */
     guideID = 2,
+    /** 需要自动弹界面 每天一次 除首次 表示今日是否要自动开 1自动开 2不自动开 其他不处理*/
+    isAutoOpenPanel = 3,
+    /** 关闭常规提现时需要自动开存钱罐 每天一次 表示今日有没有开过 */
+    isOpenBankOnCloseCash = 4,
 
     /** ------------------ 游戏核心数据 --------------------------- */
     /** 关卡数 */
@@ -315,6 +323,8 @@ class PlayerProp {
     resetPropNum = 0;
     /** 变色道具数目 */
     changePropNum = 0;
+    /** 能免费领红包 1 表示是新人第一次产出红包币,不用看视频*/
+    isFirstRedMoney = 0;
 }
 
 /**

+ 1 - 5
assets/script/game/data/LoginData.ts

@@ -45,13 +45,9 @@ export class LoginData {
         if (result && result.json) {
             this.rule_data = result.json.server;
             this.privacy_data = result.json.privacy;
-        }
-
-        result = await mk.loader.load("data/guide_data", cc.JsonAsset);
-        if (result && result.json) {
-            gData.guideData.init(result.json);
             this.loadResCompelete = true;
         }
+
     }
 
     /**

+ 17 - 7
assets/script/game/data/module/GuideData.ts

@@ -1,3 +1,5 @@
+import { Data } from "../../../mk/data/Data";
+
 /**
  * @description 新手引导
  * @author 邹勇
@@ -10,7 +12,15 @@ export class GuideData {
     /** 当前引导id */
     public crtID: number = null;
 
-    public init(config) {
+    public async init() {
+        let config = gData.gameData.configs.Guide
+        if (!config) {
+            let result = await mk.loader.load("data/guide_data", cc.JsonAsset);
+            if (result && result.json) {
+                config = result.json;
+            }
+            cc.log('无远程引导数据,使用本地测试数据');
+        }
         this.data = new Map<number, GuideVO[]>();
         let arr = [];
         let id = 1;
@@ -21,13 +31,13 @@ export class GuideData {
             guide.id = parseInt(a[0]);
             guide.step = parseInt(a[1]);
             guide.trigger = o.trigger;
-            guide.tr_num = o.tr_num;
-            guide.tr_form = o.tr_form;
+            guide.tr_num = o.tr_num || o.trNum;
+            guide.tr_form = o.tr_form || o.trForm;
             guide.dialog = o.dialog;
-            guide.display_rect = o.display_rect;
-            guide.click_rect = o.click_rect;
-            guide.finger = o.finger;
-            guide.lag_next = o.lag_next;
+            guide.display_rect = o.display_rect || o.displayRect;
+            guide.click_rect = o.click_rect || o.clickRect;
+            guide.finger = o.finger || '';
+            guide.lag_next = o.lag_next || o.lagNext;
             if (id != guide.id) {
                 this.data.set(id, arr);
                 arr = [];

+ 17 - 0
assets/script/game/data/module/GuideWeakData.ts

@@ -0,0 +1,17 @@
+import { Data } from "../../../mk/data/Data";
+
+const { ccclass, property } = cc._decorator;
+/**
+ * 弱引导数据
+ * @author 薛鸿潇
+ */
+@ccclass
+export default class GuideWeakData extends Data {
+
+    /**
+     * 数据初始化
+     */
+    public init() {
+
+    }
+}

+ 9 - 0
assets/script/game/data/module/GuideWeakData.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "8cbac365-032d-482a-a894-53d83ede033c",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

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

@@ -49,6 +49,7 @@ export default class Game extends cc.Component {
         this.initBtns();
         this.initQiPaos();
         this.initInfo();
+        this.autoOpenPanel();
 
         // if(gData.gameData.isNewPlayer()){
         //     this.initGuide();
@@ -117,6 +118,20 @@ export default class Game extends cc.Component {
         this.img_head.spriteFrame = new cc.SpriteFrame(result);
     }
 
+    /**
+     * 自动打开面板
+     * - isAutoOpenPanel 1自动开 2不自动开 其他不处理
+     */
+    private autoOpenPanel() {
+        const isAutoOpenPanel = gData.gameData.getProp(GameProp.isAutoOpenPanel);
+        if (isAutoOpenPanel == 1) {
+            mk.ui.openPanel('module/pigBank/pigBank');
+        } else if (isAutoOpenPanel != 2) {
+            // 未定义,给初始值
+            gData.gameData.setProp(GameProp.isAutoOpenPanel, 1)
+        }
+    }
+
     //测试道具获取效果
     private testFly() {
         mk.fly.PlayCoinAnim(1, 20, cc.v2(0, -300), cc.v2(0, 0));

+ 12 - 0
assets/script/game/module/guideWeak.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "e5435836-5de8-4f99-82ac-2ba5fa3b30ea",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 28 - 0
assets/script/game/module/guideWeak/GuideWeak.ts

@@ -0,0 +1,28 @@
+// Learn TypeScript:
+//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
+// Learn Attribute:
+//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
+// Learn life-cycle callbacks:
+//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
+
+const {ccclass, property} = cc._decorator;
+
+@ccclass
+export default class NewClass extends cc.Component {
+
+    @property(cc.Label)
+    label: cc.Label = null;
+
+    @property
+    text: string = 'hello';
+
+    // LIFE-CYCLE CALLBACKS:
+
+    // onLoad () {}
+
+    start () {
+
+    }
+
+    // update (dt) {}
+}

+ 9 - 0
assets/script/game/module/guideWeak/GuideWeak.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "f13f5cd3-f7b3-4ca4-8369-5ce0a881502d",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/script/game/module/pigBank/PigBank.ts

@@ -1,4 +1,5 @@
 import JsbSystem from "../../../mk/system/JsbSystem";
+import { GameProp } from "../../data/GameData";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -109,4 +110,15 @@ export default class PigBank extends cc.Component {
     onClickClose() {
         mk.ad.checkShowInterByChance();
     }
+
+    onDestroy() {
+        const isAutoOpenPanel = gData.gameData.getProp(GameProp.isAutoOpenPanel);
+        if (isAutoOpenPanel === 1) {
+            // 必须是可签到才弹
+            if (!gData.gameData.gameData.isSignInToday && gData.sign.haveSignDay()) {
+                mk.ui.openPanel('module/sign/sign');
+            }
+            gData.gameData.setProp(GameProp.isAutoOpenPanel, 2);
+        }
+    }
 }

+ 10 - 0
assets/script/game/module/redBagCash/RedBagCash.ts

@@ -1,4 +1,5 @@
 import TableView from "../../component/TableView";
+import { GameProp } from "../../data/GameData";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -74,4 +75,13 @@ export default class RedBagCash extends cc.Component {
         rmb = rmb > 1 ? Math.floor(rmb) : parseFloat(rmb.toFixed(2));
         this.lbl_rmb.string = `${rmb}`;
     }
+
+    onDestroy() {
+        // 是否需要打开存钱罐
+        const isOpenBankOnCloseCash = gData.gameData.getProp(GameProp.isOpenBankOnCloseCash);
+        if (!isOpenBankOnCloseCash) {
+            mk.ui.openPanel('module/pigBank/pigBank');
+            gData.gameData.setProp(GameProp.isOpenBankOnCloseCash, 1);
+        }
+    }
 }

+ 22 - 15
assets/script/game/module/reward/Reward.ts

@@ -1,6 +1,6 @@
 import GamePlay from "../../../before/GamePlay";
 import { AdFun } from "../../data/AdData";
-import { RewardType } from "../../data/GameData";
+import { GameProp, RewardType } from "../../data/GameData";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -137,8 +137,21 @@ export default class Reward extends cc.Component {
     /**
      * 看广告
      */
-    private clickWatchVideo() {
+    private async clickWatchVideo() {
         cc.log('看广告请求');
+        if (gData.gameData.gameData.isFirstRedMoney) {
+            gData.gameData.gameData.isFirstRedMoney = 0;
+            // 用户第一次看此视频时,可不需要看直接领取奖励
+            let response = await mk.http.sendData('getFreeRedMoney', {});
+            if (response.errcode != 0) {
+                mk.tip.pop(response.errmsg);
+                return;
+            }
+            gData.reward.adData = {}
+            gData.reward.adData.videoRedMoney = {}
+            gData.reward.adData.videoRedMoney.videoRewardList = [{ rewardType: RewardType.redBag, rewardNum: response.data.freeRedMoney }]
+            return;
+        }
         if (this.lid_type === LidType.mission) {
             // 关卡结算红包
             mk.ad.watchAd((success: boolean) => {
@@ -148,19 +161,13 @@ export default class Reward extends cc.Component {
                 }
             });
         } else {
-            if (true) {
-                mk.ad.watchAd((success: boolean) => {
-                    mk.console.log("watchAD:" + success);
-                    if (success) {
-                        gData.adData.watchVideo(gData.reward.subType === 2 ? AdFun.checkpoint : AdFun.bubble);
-                        gData.reward.subType = null;
-                    }
-                });
-            } else {
-                // 用户第一次看此视频时,可不需要看直接领取奖励
-                gData.adData.watchVideo(gData.reward.subType === 2 ? AdFun.checkpoint : AdFun.bubble);
-                gData.reward.subType = null;
-            }
+            mk.ad.watchAd((success: boolean) => {
+                mk.console.log("watchAD:" + success);
+                if (success) {
+                    gData.adData.watchVideo(gData.reward.subType === 2 ? AdFun.checkpoint : AdFun.bubble);
+                    gData.reward.subType = null;
+                }
+            });
         }
         // gData.reward.adData = {}
         // gData.reward.adData.videoRedMoney = {}

+ 1 - 1
assets/script/game/module/sign/Sign.ts

@@ -59,7 +59,6 @@ export default class Sign extends cc.Component {
     }
 
     lateUpdate() {
-        gData.sign.init_data = false;
         gData.sign.adData = null;
     }
 
@@ -114,6 +113,7 @@ export default class Sign extends cc.Component {
             this.anim_btn.node.scale = 1;
             this.anim_btn.getComponent('SetGray').setGray(true);
         }
+        gData.sign.init_data = false;
     }
 
     onClickClose() {