Переглянути джерело

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

zouyong 5 роки тому
батько
коміт
0ac0dfb358

+ 2 - 2
assets/resources/module/sign/prefab/signIconItem.prefab

@@ -312,7 +312,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        -128.189,
+        -128,
         0,
         0,
         0,
@@ -950,7 +950,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        -128.189,
+        -128,
         0,
         0,
         0,

+ 103 - 16
assets/resources/module/sign/sign.prefab

@@ -24,26 +24,26 @@
         "__id__": 5
       },
       {
-        "__id__": 40
+        "__id__": 42
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 45
+        "__id__": 47
       },
       {
-        "__id__": 46
+        "__id__": 48
       },
       {
-        "__id__": 47
+        "__id__": 49
       },
       {
-        "__id__": 48
+        "__id__": 50
       }
     ],
     "_prefab": {
-      "__id__": 49
+      "__id__": 51
     },
     "_opacity": 255,
     "_color": {
@@ -226,11 +226,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 38
+        "__id__": 40
       }
     ],
     "_prefab": {
-      "__id__": 39
+      "__id__": 41
     },
     "_opacity": 255,
     "_color": {
@@ -1030,10 +1030,13 @@
       },
       {
         "__id__": 36
+      },
+      {
+        "__id__": 37
       }
     ],
     "_prefab": {
-      "__id__": 37
+      "__id__": 39
     },
     "_opacity": 255,
     "_color": {
@@ -1372,6 +1375,90 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Button",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 27
+    },
+    "_enabled": true,
+    "_normalMaterial": null,
+    "_grayMaterial": null,
+    "duration": 0.1,
+    "zoomScale": 1.2,
+    "clickEvents": [
+      {
+        "__id__": 38
+      }
+    ],
+    "_N$interactable": true,
+    "_N$enableAutoGrayEffect": false,
+    "_N$transition": 0,
+    "transition": 0,
+    "_N$normalColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$pressedColor": {
+      "__type__": "cc.Color",
+      "r": 211,
+      "g": 211,
+      "b": 211,
+      "a": 255
+    },
+    "pressedColor": {
+      "__type__": "cc.Color",
+      "r": 211,
+      "g": 211,
+      "b": 211,
+      "a": 255
+    },
+    "_N$hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$disabledColor": {
+      "__type__": "cc.Color",
+      "r": 124,
+      "g": 124,
+      "b": 124,
+      "a": 255
+    },
+    "_N$normalSprite": null,
+    "_N$pressedSprite": null,
+    "pressedSprite": null,
+    "_N$hoverSprite": null,
+    "hoverSprite": null,
+    "_N$disabledSprite": null,
+    "_N$target": {
+      "__id__": 27
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 1
+    },
+    "component": "",
+    "_componentId": "92c1epESLhJSLrId9Dkn6Wd",
+    "handler": "clickReceiveReward",
+    "customEventData": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -1431,17 +1518,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 41
+        "__id__": 43
       },
       {
-        "__id__": 42
+        "__id__": 44
       },
       {
-        "__id__": 43
+        "__id__": 45
       }
     ],
     "_prefab": {
-      "__id__": 44
+      "__id__": 46
     },
     "_opacity": 255,
     "_color": {
@@ -1495,7 +1582,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 40
+      "__id__": 42
     },
     "_enabled": true,
     "_materials": [
@@ -1527,7 +1614,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 40
+      "__id__": 42
     },
     "_enabled": true,
     "_normalMaterial": null,
@@ -1595,7 +1682,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 40
+      "__id__": 42
     },
     "_enabled": true,
     "node_panel": {

+ 1 - 0
assets/script/game/component/TableView.ts

@@ -76,6 +76,7 @@ export default class TableView extends cc.Component {
         if (!itemData[0]) {
             return false;
         }
+        this.clearItem();
 
         this.itemData = itemData; //item数据
         this.firstItemIndex = 0;

+ 2 - 2
assets/script/game/data/g.ts

@@ -41,7 +41,7 @@ class g {
     public fission: FissionData;
     public pigbank: PigBankData;
     public luckybag: LuckyBagData;
-    public signData: SignData;
+    public sign: SignData;
     public cashNormal: CashNormalData;
     public cashPig: CashPigData;
 
@@ -61,7 +61,7 @@ class g {
         this.fission = new FissionData();
         this.pigbank = new PigBankData();
         this.luckybag = new LuckyBagData();
-        this.signData = new SignData();
+        this.sign = new SignData();
         this.cashNormal = new CashNormalData();
         this.cashPig = new CashPigData();
     }

+ 25 - 6
assets/script/game/data/module/PigBankData.ts

@@ -6,25 +6,44 @@
  *  不可提判断存款是否满足提现最低限制
  *      满足显示:“明日提现”,
  *      不满足显示:“满x可提”
- * @author 
+ * @author 薛鸿潇
  */
 export class PigBankData {
     /** 标志位:是否需要刷新数据 */
-    public init_cash_data: boolean = true;
+    public init_data: boolean = true;
     /** 是否可提现 */
-    public cash_enable: boolean = true;
+    private _cash_enable: boolean = true;
+    set cash_enable(bool: boolean) {
+        if (this._cash_enable != bool) {
+            this._cash_enable = bool;
+            this.init_data = true;
+        }
+    }
+    get cash_enable(): boolean {
+        return this._cash_enable;
+    }
+
     /** 当前存款 */
-    public cur_cash_count: number = 0.36;
+    private _cur_cash_count: number = 0.36;
+    set cur_cash_count(value: number) {
+        if (this._cur_cash_count != value) {
+            this._cur_cash_count = value;
+            this.init_data = true;
+        }
+    }
+    get cur_cash_count(): number {
+        return this._cur_cash_count;
+    }
 
     /** 提现最低限制 */
     public cash_min_limit: number = 0.3;
     /** 存款最高限制 */
-    public cash_max_limit: number = 0.45;
+    // public cash_max_limit: number = 0.45;
     /** 
      * 视频数最低限制 
      * 存钱罐提现次数*10【配置】,未满足视频数要求则不打款
     */
-    public ad_count_min_limit: number = 0;
+    // public ad_count_min_limit: number = 0;
 
     /** 
      * 提现操作

+ 51 - 3
assets/script/game/data/module/SignData.ts

@@ -1,8 +1,56 @@
 /**
  * @description 签到数据
- * @author 邹勇
+ * @author 邹勇 薛鸿潇
  */
- export class SignData{
+export class SignData {
+    /** 标志位:是否需要刷新数据 */
+    public init_data: boolean = false;
 
-    
+    /** 获取列表数据 */
+    public initListData() {
+        if (!this.c_sign.length) {
+            this.c_sign = this.getSignConfig();
+        } else {
+            this.c_sign = this.c_sign
+        }
+        let list_data = [];
+        for (let i = 0; i < 30;) {
+            let item_data = [];
+            for (let j = 0; j < 3; j++) {
+                let data = this.c_sign[i];
+                item_data.push(data);
+                i++;
+            }
+            list_data.push(item_data);
+        }
+        this.list_data = list_data;
+    }
+    /** 签到列表数据 */
+    public list_data = [];
+
+    /** 签到配置 */
+    private _c_sign = [];
+    set c_sign(value: Array<any>) {
+        this._c_sign = value;
+        this.init_data = true;
+    }
+    get c_sign(): Array<any> {
+        return this._c_sign;
+    }
+
+    /** 客户端造的假配置 */
+    private getSignConfig() {
+        let c_sign = [];
+        for (let i = 0; i < 30; i++) {
+            const id = i + 1;
+            let data: any = {};
+            data.id = id;
+            data.reward_type = i % 3;
+            data.count = id;
+            data.login_day = id;
+            data.video_limit = 0;
+            c_sign.push(data);
+        }
+        return c_sign;
+    }
 }

+ 2 - 2
assets/script/game/module/module/pigBank/PigBank.ts

@@ -25,8 +25,8 @@ export default class PigBank extends cc.Component {
     }
 
     update(dt) {
-        if (g.pigbank.init_cash_data) {
-            g.pigbank.init_cash_data = false;
+        if (g.pigbank.init_data) {
+            g.pigbank.init_data = false;
             this.initCashDesc();
         }
     }

+ 16 - 30
assets/script/game/module/module/sign/Sign.ts

@@ -15,47 +15,33 @@ export default class Sign extends cc.Component {
     }
 
     start() {
-        this.initScollView();
+        g.sign.initListData();
+        // 数据刷新测试
+        // this.scheduleOnce(() => {
+        //     g.sign.c_sign[0].login_day = 666
+        //     g.sign.initListData();
+        // }, 5)
     }
 
     /**
      * 初始化滚动视图
      */
     private initScollView() {
-        let list_data = this.getListData();
+        let list_data = g.sign.list_data;
         this.scroll_view.node.emit('srollview-init', list_data)
         cc.log(list_data)
     }
 
-    private getListData() {
-        let c_sign = this.getSignConfig();
-        let list_data = [];
-        for (let i = 0; i < 30;) {
-            let item_data = [];
-            for (let j = 0; j < 3; j++) {
-                let data = c_sign[i];
-                item_data.push(data);
-                i++;
-            }
-            list_data.push(item_data);
-        }
-        return list_data;
-    }
+    /**
+     * 点击领取按钮
+     */
+    private clickReceiveReward() {
 
-    /** 客户端造的假配置 */
-    private getSignConfig() {
-        let c_sign = [];
-        for (let i = 0; i < 30; i++) {
-            const id = i + 1;
-            let data: any = {};
-            data.id = id;
-            data.reward_type = i % 2;
-            data.count = id;
-            data.login_day = id;
-            data.video_limit = 0;
-            c_sign.push(data);
+    }
+    update(dt) {
+        if (g.sign.init_data) {
+            g.sign.init_data = false;
+            this.initScollView();
         }
-        return c_sign;
     }
-    // update (dt) {}
 }

+ 11 - 15
assets/script/game/module/module/sign/SignIconItem.ts

@@ -1,12 +1,5 @@
 
 const { ccclass, property } = cc._decorator;
-/** 天数描边 */
-enum DayOutLineColor {
-    /** 红包 */
-    red_bag = '#EB3A0E' as any,
-    /** 提现 */
-    cash = '#2AB718' as any,
-}
 /**
  * 签到icon组件
  * @author 薛鸿潇
@@ -28,12 +21,7 @@ export default class SignIconItem extends cc.Component {
         login_day: 0,
         video_limit: 0,
     }
-    // onLoad () {}
-
-    // start() {
-
-    // }
-
+    
     /**
      * 初始化数据
      */
@@ -62,8 +50,11 @@ export default class SignIconItem extends cc.Component {
         }
         this.icon_data = icon_data;
     }
+
     /**
      * 领取奖励
+     * - 检查点击的icon是否是正确的icon
+     * - 是正确的icon,奖励检查类型
      */
     private clickReceiveReward() {
         if (this.icon_data.reward_type) {
@@ -72,7 +63,12 @@ export default class SignIconItem extends cc.Component {
             
         }
     }
+}
 
-
-    // update (dt) {}
+/** 天数描边 */
+enum DayOutLineColor {
+    /** 红包 */
+    red_bag = '#EB3A0E' as any,
+    /** 提现 */
+    cash = '#2AB718' as any,
 }