ソースを参照

红包提现数据

薛鸿潇 5 年 前
コミット
13df543e09

+ 7 - 1
assets/resources/module/redBagCash/redBagCash.prefab

@@ -1098,7 +1098,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "多少元",
+    "_name": "lbl毛币数量",
     "_objFlags": 0,
     "_parent": {
       "__id__": 23
@@ -2198,6 +2198,12 @@
     "sroll_view": {
       "__id__": 50
     },
+    "lbl_redbag": {
+      "__id__": 15
+    },
+    "lbl_rmb": {
+      "__id__": 28
+    },
     "_id": ""
   },
   {

+ 6 - 6
assets/resources/module/redBagCash/redBagCashItem.prefab

@@ -502,7 +502,7 @@
         1,
         1,
         1,
-        1
+        0
       ]
     },
     "_eulerAngles": {
@@ -696,8 +696,8 @@
     "clickEvents": [],
     "_N$interactable": true,
     "_N$enableAutoGrayEffect": false,
-    "_N$transition": 0,
-    "transition": 0,
+    "_N$transition": 3,
+    "transition": 3,
     "_N$normalColor": {
       "__type__": "cc.Color",
       "r": 255,
@@ -1249,7 +1249,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -54.633,
+        -40,
         -49.34,
         0,
         0,
@@ -1749,7 +1749,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -41.211,
+        -40,
         -102.007,
         0,
         0,
@@ -1856,7 +1856,7 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -39.93,
+        -40,
         -100.375,
         0,
         0,

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

@@ -150,6 +150,9 @@ export enum GameProp {
     sign_last_bar = 120,
     /** 当前能否签到 */
     sign_can = 121,
+    /** ------------------ 红包提现 ----------------------------- */
+    /** 提现进度 */
+    redBag_cash_bar = 220,
 }
 
 /**

+ 30 - 13
assets/script/game/data/module/RedBagCashData.ts

@@ -1,7 +1,9 @@
 
 import { Data } from "../../../mk/data/Data";
+import { GameProp } from "../GameData";
 /**
  * 红包提现数据
+ * - 跨Index不可提现,提示:请按顺序提现。
  * @author 薛鸿潇
  */
 export class RedBagCashData extends Data {
@@ -21,6 +23,7 @@ export class RedBagCashData extends Data {
             this.c_data = gData.gameData.configs.cashcfg;
             this.init_list = true;
         }
+        this.cash_bar = gData.gameData.getProp(GameProp.redBag_cash_bar);
     }
     /** 标志位:初始化列表 */
     public init_list: boolean = false;
@@ -28,34 +31,48 @@ export class RedBagCashData extends Data {
     /** 配置表数据 */
     public c_data: Array<CDataType> = [];
 
+    /** 标志位:初始化指定列表 */
+    /** 提现进度 */
+    cash_bar: number = 0;
+
+    /**
+     * 提现操作
+     */
+    public cashOP() {
+        this.cash_bar++;
+        gData.gameData.setProp(GameProp.redBag_cash_bar, this.cash_bar);
+    }
+
     /** 客户端造的假数据 */
     private initCData() {
-        for (let i = 0; i < 10; i++) {
+        for (let i = 0; i < 20; i++) {
+            const id = i + 1;
             let obj = {
-                index: i,
+                index: id,
                 /** 毛币数量? */
-                money: i,
-                type_value: i,
-                time: i,
-                directVideoTime: i,
-                delayVideoTimes: i,
-                money_type: i,
-                num: i,
-                moneyshow: i,
-                summoney: i
+                money: id,
+                /** 红包数量 */
+                type_value: id * 10000,
+                time: id,
+                directVideoTime: id,
+                delayVideoTimes: id,
+                money_type: id,
+                num: id,
+                moneyshow: id,
+                summoney: id
             };
             this.c_data.push(obj)
         }
         this.init_list = true;
-
     }
 }
 /** 配置表数据内容 */
 export type CDataType = {
     /** id */
     index: number,
-    /** 毛币数量 */
+    /** 毛币数量,单位分 */
     money: number,
+    /** 红包币数量 */
     type_value: number,
     time: number,
     directVideoTime: number,

+ 18 - 3
assets/script/game/module/module/redBagCash/RedBagCash.ts

@@ -1,3 +1,4 @@
+import TableView from "../../../component/TableView";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -10,14 +11,19 @@ export default class RedBagCash extends cc.Component {
     @property({ displayName: '滚动视图', type: cc.ScrollView })
     sroll_view: cc.ScrollView = null!;
 
-    onLoad() {
+    @property({ displayName: 'lbl红包数量', type: cc.Label })
+    private lbl_redbag: cc.Label = null!;
+    @property({ displayName: 'lbl毛币数量', type: cc.Label })
+    private lbl_rmb: cc.Label = null!;
 
+    private tableview: TableView = null;
+    onLoad() {
+        this.tableview = this.sroll_view.getComponent('TableView');
     }
 
     start() {
+        this.initMoney();
         this.initScrollView();
-        // 请求记录
-        // gData.cashNormal.getRecord()
     }
 
     // update (dt) {}
@@ -27,4 +33,13 @@ export default class RedBagCash extends cc.Component {
     private initScrollView() {
         this.sroll_view.node.emit('srollview-init', gData.redBagCash.c_data);
     }
+    /**
+     * 初始化货币数量
+     */
+    private initMoney() {
+        this.lbl_redbag.string = `${gData.gameData.gameData.redMoney}`;
+        let rmb = gData.gameData.gameData.redMoney / 10000;
+        rmb = rmb > 1 ? Math.floor(rmb) : parseFloat(rmb.toFixed(2));
+        this.lbl_rmb.string = `${rmb}`;
+    }
 }

+ 38 - 1
assets/script/game/module/module/redBagCash/RedBagCashItem.ts

@@ -36,9 +36,46 @@ export default class RedBagCashItem extends cc.Component {
     public async setItemData(item_data) {
         await this.initStyle(item_data);
     }
+
+    /**
+     * 初始化样式
+     * @param item_data 条目数据 
+     */
     private initStyle(item_data) {
         this.item_data = item_data;
-        // this.item_data.
+        this.lbl_red_value.string = `${this.item_data.type_value}`;
+        this.lbl_rmb_value.string = this.item_data.money + '元';
+
+        if (this.item_data.index <= gData.redBagCash.cash_bar) {
+            // 已提现
+            this.node_none.active = true;
+            this.node_lock.active = false;
+            this.node_unlock.active = false;
+        } else {
+            // 可提现
+            if (gData.gameData.gameData.redMoney >= this.item_data.type_value) {
+                this.node_none.active = false;
+                this.node_lock.active = false;
+                this.node_unlock.active = true;
+            } else {
+                // 未达成
+                this.node_none.active = false;
+                this.node_lock.active = true;
+                this.node_unlock.active = false;
+            }
+        }
+    }
+
+    /**
+     * 提现操作
+     */
+    private clickCashOP() {
+        // if (!gData.redBagCash.cash_enable) return;
+        if (this.item_data.index > gData.redBagCash.cash_bar) {
+            mk.tip.pop('请按顺序提现');
+            return;
+        }
+        gData.redBagCash.cashOP();
     }
 
 }