Explorar el Código

红包提现优化

薛鸿潇 hace 5 años
padre
commit
339f2261f1

+ 11 - 122
assets/resources/module/cashNormal/cashNormal.prefab

@@ -27,17 +27,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 44
+        "__id__": 41
       },
       {
-        "__id__": 45
+        "__id__": 42
       },
       {
-        "__id__": 46
+        "__id__": 43
       }
     ],
     "_prefab": {
-      "__id__": 47
+      "__id__": 44
     },
     "_opacity": 255,
     "_color": {
@@ -1281,19 +1281,16 @@
     "_children": [
       {
         "__id__": 36
-      },
-      {
-        "__id__": 39
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 42
+        "__id__": 39
       }
     ],
     "_prefab": {
-      "__id__": 43
+      "__id__": 40
     },
     "_opacity": 255,
     "_color": {
@@ -1318,7 +1315,7 @@
       "ctor": "Float64Array",
       "array": [
         -325,
-        604,
+        596.033,
         0,
         0,
         0,
@@ -1350,7 +1347,7 @@
       "__id__": 35
     },
     "_children": [],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 37
@@ -1369,8 +1366,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 26,
-      "height": 28
+      "width": 22,
+      "height": 36
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -1422,7 +1419,7 @@
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
     "_spriteFrame": {
-      "__uuid__": "fa5301d9-95e8-4f3a-9ca3-a3c714bc574b"
+      "__uuid__": "96791d9f-b2a7-406c-84c0-d63af62e60ea"
     },
     "_type": 0,
     "_sizeMode": 1,
@@ -1450,114 +1447,6 @@
     "sync": false
   },
   {
-    "__type__": "cc.Node",
-    "_name": "lbl描述",
-    "_objFlags": 0,
-    "_parent": {
-      "__id__": 35
-    },
-    "_children": [],
-    "_active": true,
-    "_components": [
-      {
-        "__id__": 40
-      }
-    ],
-    "_prefab": {
-      "__id__": 41
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 0,
-      "g": 0,
-      "b": 0,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 35.04,
-      "height": 100.8
-    },
-    "_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__": 39
-    },
-    "_enabled": true,
-    "_materials": [
-      {
-        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
-      }
-    ],
-    "_srcBlendFactor": 770,
-    "_dstBlendFactor": 771,
-    "_string": "<",
-    "_N$string": "<",
-    "_fontSize": 60,
-    "_lineHeight": 80,
-    "_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__": "18ca563c-e8dc-4633-bf04-5fdd65113bb0"
-    },
-    "fileId": "98tseSk3tBdIy20CSGEfgX",
-    "sync": false
-  },
-  {
     "__type__": "cdc50kCRVVBa5gcp4XXxVO+",
     "_name": "",
     "_objFlags": 0,

+ 4 - 4
assets/resources/module/cashNormal/cashNormalItem.prefab

@@ -443,19 +443,19 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 127.25,
+      "width": 159.06,
       "height": 50.4
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
-      "x": 0.5,
+      "x": 1,
       "y": 0.5
     },
     "_trs": {
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        281.342,
+        337.388,
         -82,
         0,
         0,
@@ -497,7 +497,7 @@
     "_dstBlendFactor": 771,
     "_string": "¥0.30元",
     "_N$string": "¥0.30元",
-    "_fontSize": 32,
+    "_fontSize": 40,
     "_lineHeight": 40,
     "_enableWrapText": true,
     "_N$file": {

BIN
assets/resources/module/cashNormal/texture/back.png


+ 36 - 0
assets/resources/module/cashNormal/texture/back.png.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.5",
+  "uuid": "b7cb96bb-093e-46de-92b7-68b3c7fd811c",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 22,
+  "height": 36,
+  "platformSettings": {},
+  "subMetas": {
+    "back": {
+      "ver": "1.0.4",
+      "uuid": "96791d9f-b2a7-406c-84c0-d63af62e60ea",
+      "rawTextureUuid": "b7cb96bb-093e-46de-92b7-68b3c7fd811c",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 22,
+      "height": 36,
+      "rawWidth": 22,
+      "rawHeight": 36,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

+ 16 - 8
assets/script/game/data/module/RedBagCashData.ts

@@ -12,6 +12,8 @@ export class RedBagCashData extends Data {
      * 数据初始化
      */
     public init() {
+        // 签到进度
+        this.cash_bar = gData.gameData.getProp(GameProp.redBag_cash_bar);
         // 签到配置表
         if (gData.gameData.configs.CashCfg) {
             gData.gameData.configs.CashCfg.forEach(item_data => {
@@ -23,7 +25,6 @@ export class RedBagCashData extends Data {
             this.sortList();
             this.init_list = true;
         }
-        this.cash_bar = gData.gameData.getProp(GameProp.redBag_cash_bar);
         // this.cash_bar = gData.gameData.gameData.cashIndex;// 服务端数据
     }
     /** 标志位:初始化列表 */
@@ -32,10 +33,15 @@ export class RedBagCashData extends Data {
     /** 配置表数据 */
     public c_data: Array<CDataType> = [];
 
-    /** 标志位:初始化指定列表 */
-    public old_index = null;
+    private _cash_bar: number = 0;
     /** 提现进度 */
-    cash_bar: number = 0;
+    set cash_bar(value: number) {
+        this._cash_bar = value;
+        this.init_list = true;
+    }
+    get cash_bar() {
+        return this._cash_bar;
+    }
 
     /**
      * 提现操作
@@ -43,7 +49,6 @@ export class RedBagCashData extends Data {
     public cashOP() {
         /** 提现档位 */
         const cash_index = this.cash_bar;
-        this.old_index = cash_index;
         this.cash_bar++;
         gData.gameData.setProp(GameProp.redBag_cash_bar, this.cash_bar);
 
@@ -60,11 +65,14 @@ export class RedBagCashData extends Data {
      */
     private sortList() {
         const l_count = this.c_data.length;
+        let index = 0;
         for (let i = 0; i < l_count; i++) {
-            if (this.c_data[i].index <= gData.redBagCash.cash_bar) {
-                let item_data = this.c_data.splice(i, 1) as any;
-                this.c_data.push(item_data);
+            if (this.c_data[index].index <= gData.redBagCash.cash_bar) {
+                let item_data = this.c_data.splice(index, 1);
+                this.c_data.push(item_data[0]);
+                index--;
             }
+            index++;
         }
     }
 

+ 6 - 9
assets/script/game/module/module/redBagCash/RedBagCash.ts

@@ -9,8 +9,7 @@ const { ccclass, property } = cc._decorator;
 export default class RedBagCash extends cc.Component {
 
     @property({ displayName: '滚动视图', type: cc.ScrollView })
-    sroll_view: cc.ScrollView = null!;
-
+    private sroll_view: cc.ScrollView = null!;
     @property({ displayName: 'lbl红包数量', type: cc.Label })
     private lbl_redbag: cc.Label = null!;
     @property({ displayName: 'lbl毛币数量', type: cc.Label })
@@ -18,7 +17,7 @@ export default class RedBagCash extends cc.Component {
 
     private tableview: TableView = null;
     onLoad() {
-        gData.gameData.gameData.redMoney = 3200
+        gData.gameData.gameData.redMoney = 10200
         this.tableview = this.sroll_view.getComponent('TableView');
     }
 
@@ -28,12 +27,9 @@ export default class RedBagCash extends cc.Component {
     }
 
     update(dt) {
-        if (gData.redBagCash.old_index) {
-            // 指定条目数据刷新
-            const last_index = gData.redBagCash.old_index;
-            const next_index = gData.redBagCash.old_index + 1;
-            this.tableview.resetItemData(last_index, gData.sign.list_data[last_index]);
-            if (gData.sign.list_data[next_index]) this.tableview.resetItemData(gData.redBagCash.old_index + 1, gData.sign.list_data[next_index]);
+        if (gData.redBagCash.init_list) {
+            this.initScrollView();
+            this.initMoney();
         }
     }
 
@@ -42,6 +38,7 @@ export default class RedBagCash extends cc.Component {
      */
     private initScrollView() {
         this.sroll_view.node.emit('srollview-init', gData.redBagCash.c_data);
+        gData.redBagCash.init_list = false;
     }
 
     /**