wuwangdong 4 лет назад
Родитель
Сommit
ffbc52dd4e

Разница между файлами не показана из-за своего большого размера
+ 242 - 131
assets/resources/module/newCashUI/walletCashOut.prefab


+ 4 - 0
assets/script/game/data/GData.ts

@@ -34,6 +34,8 @@ import PastureSystem from "../../before/main/PastureSystem";
 import FactorySystem from "../../before/main/FactorySystem";
 import { FarmMapData } from "./module/FarmMapData";
 import { GradeRewardData } from "./module/GradeRewardData";
+import WalletCashOut from "../module/newCashUI/WalletCashOut";
+import { WalletCashOutData } from "./module/WalletCashOutData";
 
 /**
  * 数据集合全局类
@@ -92,6 +94,7 @@ class GData {
     public factorySystem: FactorySystem;
     public farmMapData: FarmMapData;
     public farmGradeData: GradeRewardData;
+    public walletCashOutData: WalletCashOutData;
 
     public moduleData: Map<number, Data>;
 
@@ -134,6 +137,7 @@ class GData {
         this.farmSystem = new FarmSystem();
         this.farmMapData = new FarmMapData();
         this.farmGradeData = new GradeRewardData();
+        this.walletCashOutData = new WalletCashOutData();
 
         this.moduleData = new Map<number, Data>();
         this.moduleData.set(Fun.moreGame, this.moreGame);

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

@@ -112,7 +112,7 @@ export class GameData {
         gData.adData.initEcpmData();
 
         // data = {};
-        // response = await mk.http.sendData('welFare/getUserWelFareTaskInfo', data);
+        // response = await mk.http.sendData('noviceWeFare/getNoviceWeFareInfo', data);
         // if (response.errcode != 0) {
         //     return;
         // }
@@ -161,6 +161,7 @@ export class GameData {
         this.gameData.userTuCaoInfo = res_data.userWelFareTaskInfo;
         this.gameData.farmExpValue = res_data.userExp;
         this.gameData.farmGradeData = res_data.userFarmGrageRewardInfo;
+        this.gameData.userNoviceWeFareInfo = res_data.userNoviceWeFareInfo;
 
         mk.data.setTAUserID(gData.loginData.uin);
 
@@ -1061,6 +1062,9 @@ class PlayerProp {
         return this.farmExp;
     }
 
+    //提现新手数据
+    userNoviceWeFareInfo: any = {};
+
     /** ABTest分组id */
     groupCode = 0;
 }

+ 39 - 0
assets/script/game/data/module/WalletCashOutData.ts

@@ -0,0 +1,39 @@
+
+
+/**
+ * @description 提现数据
+ */
+ import { Data } from "../../../mk/data/Data";
+
+ export class WalletCashOutData extends Data {
+
+    public init_novice = false;
+
+    public async HttpCashOut(value: number) {
+
+        let data = {}; 
+        let response = await mk.http.sendData('noviceWeFare/noviceWeFareCash', data);
+
+        if (response.errcode != 0) {
+            return null;
+        }
+        this.init_novice = true;
+        gData.gameData.gameData.userNoviceWeFareInfo = response.data.userNoviceWeFareInfo;
+
+        gData.receiptNotice.receip_rmb = value;
+        mk.ui.openPanel('module/newNotice/newNotice');
+    }
+
+    async addProgress() {
+        let data = {};
+        let response = await mk.http.sendData('noviceWeFare/updateNoviceWeFareInfo', data);
+
+        if (response.errcode != 0) {
+            return;
+        }
+
+        gData.gameData.gameData.userNoviceWeFareInfo = response.data.userNoviceWeFareInfo;
+        this.init_novice = true;
+    }
+
+ }

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

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "cc63c1d1-caa8-48e1-8178-5fe04cba46c7",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 1 - 1
assets/script/game/module/gradeReward/GradeReward.ts

@@ -130,7 +130,7 @@ export class GradeReward extends cc.Component {
         for(let i = 0; i != len; ++i)
         {
             let per = gData.gameData.gameData.farmGradeData.farmGradeRewardList[i].progressRate;   
-            this.lbl_progress[i].string = per * 100 + '%';
+            this.lbl_progress[i].string = Math.round(per * 100) + '%';
             if(curIndex == -1)
             {
                 if(per < 1)

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

@@ -15,17 +15,30 @@ export default class WalletCashOut extends cc.Component {
     private lbl_redMoney: cc.Label = null;
     @property({ displayName: '金额', type: cc.Label })
     private lbl_value: cc.Label = null;
-    @property({ displayName: '提示', type: cc.Label })
+    @property({ displayName: '提示', type: cc.Label })
     private lbl_tip: cc.Label = null;
 
+    @property({displayName: '提现按钮文本', type: cc.Label})
+    private lbl_cashOut: cc.Label = null;
+    @property({displayName: '新手描述', type: cc.Label})
+    private lbl_noviceTitle: cc.Label = null;
+    @property({displayName: '新手金额', type: cc.Label})
+    private lbl_noviceValue: cc.Label = null;
+    @property({ displayName: '上提示', type: cc.Label })
+    private lbl_tipUp: cc.Label = null;
+
     @property({ displayName: '6个选择按钮', type: CheckButton })
     private check_button: CheckButton[] = [];
 
     private curChooseIndex: number = 0;
 
+    private intV: number = 0;
+
     start() {
         // mk.ad.showNative(4);
 
+        this.initNoviceUI();
+
         let data = [{}, {}, {}, {}, {}, {}];
         for (let i = 0; i != this.check_button.length; ++i) {
             if (i < data.length) {
@@ -36,6 +49,30 @@ export default class WalletCashOut extends cc.Component {
         }
     }
 
+    private initNoviceUI()
+    {
+        let data = gData.gameData.gameData.userNoviceWeFareInfo;
+        if(data)
+        {
+            this.lbl_noviceTitle.string = data.name + ':';
+            this.sp_progress.fillRange = data.progressRate;
+            let value = data.cashmoney / 100;
+            this.lbl_noviceValue.string = (value * data.progressRate).toFixed(1) + '元';
+            this.intV = Math.round(value);
+            this.lbl_tipUp.string = `进度加满后必得${this.intV}元现金`;
+            this.lbl_cashOut.string = `满${this.intV}元提现`;
+        }
+    }
+
+    update(dt)
+    {
+        if(gData.walletCashOutData.init_novice)
+        {
+            this.initNoviceUI();
+            gData.walletCashOutData.init_novice = false;
+        }
+    }
+
     private clickChooseBtn(event, customEvenData) {
         mk.audio.playEffect('button');
 
@@ -74,9 +111,7 @@ export default class WalletCashOut extends cc.Component {
         mk.ad.watchAd((success: boolean) => {
             mk.console.log("watchAD:" + success);
             if (success) {
-                gData.adData.watchVideo(AdFun.cashOutNoviceWelfare);
-
-                // mk.ad.destroyNativeAd();
+                gData.walletCashOutData.addProgress();
             }
         });
     }
@@ -100,6 +135,18 @@ export default class WalletCashOut extends cc.Component {
 
     private clickEnoughCashOutBtn() {
         mk.audio.playEffect("button");
+
+        let data = gData.gameData.gameData.userNoviceWeFareInfo;
+        if(data)
+        {
+            if(data.progressRate >= 1)
+            {
+                gData.walletCashOutData.HttpCashOut(this.intV);
+            }else{
+                mk.tip.pop(`满${this.intV}元提现`);
+            }
+
+        }
     }
 
     private clickCloseBtn() {

Некоторые файлы не были показаны из-за большого количества измененных файлов