wuwangdong 4 years ago
parent
commit
a288adf0bd

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

@@ -167,7 +167,8 @@ export class GameData {
         this.gameData.farmExpValue = res_data.userExp;
         this.gameData.farmGradeData = res_data.userFarmGrageRewardInfo;
         this.gameData.userNoviceWeFareInfo = res_data.userNoviceWeFareInfo;
-
+        this.gameData.redMoneyCashPayRecordList = res_data.redMoneyCashPayRecordList;
+        
         mk.data.setTAUserID(gData.loginData.uin);
 
         if (gData.loginData.isFirstIn) {
@@ -1110,8 +1111,24 @@ class PlayerProp {
     //提现新手数据
     userNoviceWeFareInfo: any = {};
 
-    //互推数据
-    public moreGameData = null;
+    //提现记录数据
+    redMoneyCashPayRecordList = null;
+
+    getRedMoneyCashOutTimesByIndex(index: number):number
+    {
+        if(this.redMoneyCashPayRecordList)
+        {
+            for(let i = 0; i != this.redMoneyCashPayRecordList.length; ++i)
+            {
+                if(index == this.redMoneyCashPayRecordList[i].index)
+                {
+                    return this.redMoneyCashPayRecordList[i].freuency;
+                }
+            }
+        }
+        
+        return 0;
+    }
 
     /** ABTest分组id */
     groupCode = 0;

+ 7 - 3
assets/script/game/data/module/WalletCashOutData.ts

@@ -9,6 +9,8 @@
 
     public init_novice = false;
 
+    public init_cashOut = false;
+
     public async HttpCashOut(value: number) {
 
         let data = {}; 
@@ -43,13 +45,15 @@
 
         mk.console.logSingle('wallet=>', response);
         if (response.errcode != 0) {
-            if(response.count > 0)
+            if(response.data.count > 0)
             {
                 gData.lineUpUIData.personCount = response.count;
                 mk.ui.openPanel("module/newNotice/LineUpUI");
             }
-            return null;
-        }     
+            return;
+        }  
+        gData.gameData.gameData.redMoneyCashPayRecordList = response.data.redMoneyCashPayRecordList;
+        this.init_cashOut = true;
     }
 
  }

+ 11 - 5
assets/script/game/module/newCashUI/CheckButton.ts

@@ -20,11 +20,13 @@ export default class Turnable extends cc.Component {
     private data = null;
 
    
-    public setShowUI(data)
+    public setShowUI(data):boolean
     {
         this.data = data;
-        this.lbl_times.string = data.cashFrequency.toString();
+        let haveTimes = data.cashFrequency - gData.gameData.gameData.getRedMoneyCashOutTimesByIndex(data.index);
+        this.lbl_times.string = haveTimes.toString();
         this.lbl_value.string = (data.money/100).toString();
+        return haveTimes > 0;
     }
 
     public setIsChoose(isChoose: boolean)
@@ -52,12 +54,16 @@ export default class Turnable extends cc.Component {
         return this.isCanNotChoose;
     }
 
-    public setRemaineTimes(times: number)
+    public setRemaineTimes(): boolean
     {
-        this.lbl_times.string = times.toString();
-        if(times <= 0)
+        let haveTimes = gData.gameData.gameData.getRedMoneyCashOutTimesByIndex(this.data.index);
+        let remainTimes = this.data.cashFrequency- haveTimes;
+        this.lbl_times.string = remainTimes.toString();
+        if(remainTimes <= 0)
         {
             this.setIsCanNotChoose();
+            return true;
         }
+        return false; 
     }
 }

+ 51 - 31
assets/script/game/module/newCashUI/WalletCashOut.ts

@@ -10,7 +10,7 @@ const { ccclass, property } = cc._decorator;
 @ccclass
 export default class WalletCashOut extends cc.Component {
 
-    @property({displayName:'公告组件', type: TweenCast})
+    @property({ displayName: '公告组件', type: TweenCast })
     private tc: TweenCast = null;
 
     @property({ displayName: '进度条', type: cc.Sprite })
@@ -38,7 +38,7 @@ export default class WalletCashOut extends cc.Component {
     @property({ displayName: '6个选择按钮', type: CheckButton })
     private check_button: CheckButton[] = [];
 
-    private curChooseIndex: number = 0;
+    private curChooseIndex: number = -1;
 
     private intV: number = 0;
 
@@ -73,16 +73,17 @@ export default class WalletCashOut extends cc.Component {
         }
     }
 
-    private initCashOutUI()
-    {
-        if(gData.gameData.configs.CashCfg)
-        {
+    private initCashOutUI() {
+        if (gData.gameData.configs.CashCfg) {
             let arr = [];
             let data = gData.gameData.configs.CashCfg
             for (let i = 0; i != this.check_button.length; ++i) {
                 if (i < data.length) {
-                    this.check_button[i].setShowUI(data[i]);
-                    arr.push(data[i].money/100);
+                    let isRemainTimes = this.check_button[i].setShowUI(data[i]);
+                    arr.push(data[i].money / 100);
+                    if (isRemainTimes && this.curChooseIndex == -1) {
+                        this.curChooseIndex = i;
+                    }
                 } else {
                     this.check_button[i].setShowUI(null);
                 }
@@ -93,24 +94,35 @@ export default class WalletCashOut extends cc.Component {
         }
     }
 
-    private initTip()
-    {
-        let data = gData.gameData.configs.CashCfg[this.curChooseIndex];
-        let isEnough = gData.gameData.gameData.redMoney - data.redMoney;
-        if(isEnough >= 0)
-        {
-            this.isCanCash = true;
-            this.btn_cashOut.setGray(false);
-            let needV = data.money/100;
-            let haveV = (gData.gameData.gameData.redMoney/10000).toFixed(2) + '元';
-            this.lbl_tip.string =`需要${needV}元,当前有` + haveV;
-        }else{          
+    private initTip() {
+        if (this.curChooseIndex != -1) {
+            let data = gData.gameData.configs.CashCfg[this.curChooseIndex];
+            let isEnough = gData.gameData.gameData.redMoney - data.redMoney;
+            if (isEnough >= 0) {
+                if (this.curChooseIndex != -1) {
+                    this.isCanCash = true;
+                    this.btn_cashOut.setGray(false);
+                } else {
+                    this.isCanCash = false;
+                    this.btn_cashOut.setGray(true);
+                }
+
+                let needV = data.money / 100;
+                let haveV = (gData.gameData.gameData.redMoney / 10000).toFixed(2) + '元';
+                this.lbl_tip.string = `需要${needV}元,当前有` + haveV;
+            } else {
+                this.isCanCash = false;
+                this.btn_cashOut.setGray(true);
+                let needV = data.money / 100;
+                let haveV = (gData.gameData.gameData.redMoney / 10000).toFixed(2) + '元';
+                this.lbl_tip.string = `需要${needV}元,当前只有` + haveV;
+            }
+        } else {
             this.isCanCash = false;
             this.btn_cashOut.setGray(true);
-            let needV = data.money/100;
-            let haveV = (gData.gameData.gameData.redMoney/10000).toFixed(2) + '元';
-            this.lbl_tip.string =`需要${needV}元,当前只有` + haveV;
+            this.lbl_tip.string = '';
         }
+
     }
 
     update(dt) {
@@ -118,19 +130,28 @@ export default class WalletCashOut extends cc.Component {
             this.initNoviceUI();
             gData.walletCashOutData.init_novice = false;
         }
-        
-        if(gData.walletCashOutData.adData)
-        {
+
+        if (gData.walletCashOutData.adData) {
             gData.reward.data = gData.walletCashOutData.adData.videoRedMoney.videoRewardList;
             mk.ui.openPanel("module/reward/reward");
             gData.walletCashOutData.adData = null;
         }
 
-        if(gData.gameData.init_wallet_redMoney)
-        {
+        if (gData.gameData.init_wallet_redMoney) {
             this.initTip();
             gData.gameData.init_wallet_redMoney = false;
         }
+
+        if (gData.walletCashOutData.init_cashOut) {
+            let isRemainTimes = this.check_button[this.curChooseIndex].setRemaineTimes();
+            if (isRemainTimes) {
+                this.curChooseIndex = -1;
+                this.isCanCash = false;
+                this.btn_cashOut.setGray(true);
+                this.lbl_tip.string = '';
+            }
+            gData.walletCashOutData.init_cashOut = false;
+        }
     }
 
     private clickChooseBtn(event, customEvenData) {
@@ -145,7 +166,7 @@ export default class WalletCashOut extends cc.Component {
             return;
         }
 
-    
+
         this.check_button[id].setIsChoose(true);
         this.check_button[this.curChooseIndex].setIsChoose(false);
 
@@ -163,8 +184,7 @@ export default class WalletCashOut extends cc.Component {
 
     private clickCashOutBtn() {
         mk.audio.playEffect("button");
-        if(this.isCanCash)
-        {
+        if (this.isCanCash) {
             gData.adData.checkPopCashFull();
             //this.check_button[this.curChooseIndex].setIsCanNotChoose();
             gData.walletCashOutData.HttpCashOut2(this.curChooseIndex + 1);