浏览代码

1.添加兑换接口
2.阐释修复黑色遮挡问题

slambb 3 年之前
父节点
当前提交
d30bdc7dcb

文件差异内容过多而无法显示
+ 154 - 217
assets/Scene/MyCityScene - 004.fire


+ 6 - 6
assets/Script/Lease/LeaseInfo.js

@@ -121,16 +121,16 @@ cc.Class({
         //this.inputInviteValue 默认是1倍
         // console.log( this.inputInviteValue);
         switch (this.toggleInputValue) {
-            case "1":
-                this.totalPriceValue = 700 * this.inputInviteValue;
+            case "1": //700
+                this.totalPriceValue = GlobalD.ConfigLand.rental1 * this.inputInviteValue;
                 this.totalPriceLabel.string = this.totalPriceValue + "CNT";
                 break;
-            case "2":
-                this.totalPriceValue = 2500 * this.inputInviteValue;
+            case "2": //2500
+                this.totalPriceValue = GlobalD.ConfigLand.rental2 * this.inputInviteValue;
                 this.totalPriceLabel.string = this.totalPriceValue + "CNT";
                 break;
-            case "3":
-                this.totalPriceValue = 5000 * this.inputInviteValue;
+            case "3": //5000
+                this.totalPriceValue = GlobalD.ConfigLand.rental3 * this.inputInviteValue;
                 this.totalPriceLabel.string = this.totalPriceValue + "CNT";
                 break;
             default:

+ 1 - 2
assets/Script/Network/dapp.js

@@ -75,8 +75,7 @@ cc.Class({
                     // };
 
                     utils.post(utils.api.loginTokenAndVerification, dappLoginData, (res, value) => {
-                        // console.log("loginTokenAndVerification========>", _temp);
-                        // console.log(value);
+                        // console.log("loginTokenAndVerification========>", value);
                         if (value.code == 0) {
                             /** 登录成功获取token */
                             utils.setToken(value.data.token);

+ 10 - 1
assets/Script/Network/netUtils.ts

@@ -30,7 +30,10 @@ var utils = {
         playerInfo: 'comPlayers/getPlayerAndBattleAttribute',
         playerPushInfo: 'comPlayers/playerPushInfo',
         playerPullInfo: 'comPlayers/playerPullInfo',
-
+        /**
+         * 获取是否租赁过的状态
+         */
+        playerExchangeState: 'comPlayers/getPlayerExchangeState',
         //获取游戏config土地列表
         landConfig: 'configLand/getList',
         //获取用户已经租赁的土地
@@ -41,6 +44,12 @@ var utils = {
         plant: 'comPlayerLand/plant',
         //种子
         mallSeed: 'comMallSeed/getMallSeed',
+        /**
+       * 用钻石兑换一包种子
+       */
+        exchangeSeeds: 'comMallSeed/exchangeSeeds',
+
+
         //仓库种子和果实
         getSeedAndFruit: 'comPlayerGoods/getSeedAndFruit',
         //背包的种子数量

+ 41 - 3
assets/Script/public/GameData.js

@@ -91,7 +91,10 @@ cc.Class({
         //现在多次触发
         isOnAddFruit: false,
         isOnSaleFruit: false,
-        isOnGrantFruit: false
+        isOnGrantFruit: false,
+
+        //自动存储数据
+        AutoSaveData:null
 
     },
     onLoad() {
@@ -154,7 +157,7 @@ cc.Class({
             this.AutoSaveData = function () {
                 this.pushData(true);
             };
-            this.schedule(this.AutoSaveData, 20);
+            this.schedule(this.AutoSaveData, 15);
         } else {
             // 清除
             cc.log("本地数据重新开始,并且不初始化");
@@ -164,7 +167,7 @@ cc.Class({
             this.AutoSaveData = function () {
                 this.pushData(false);
             };
-            this.schedule(this.AutoSaveData, 20);
+            this.schedule(this.AutoSaveData, 10);
         }
     },
 
@@ -956,6 +959,41 @@ cc.Class({
 
     },
 
+    /**
+     * 兑换种子时候,特殊处理数据
+     * 扣除相应的钻石
+     */
+    exchangeSeed(){
+        //先暂停存储
+        this.unschedule(this.AutoSaveData);
+
+        utils.get(utils.api.exchangeSeeds, {diamondAmount}, (res, value) => {
+            console.log("兑换种子",value);
+            callback(res, value);
+            //兑换成功后
+            if(0 === value.code){
+                //更新一次数据
+                let _playerData = JSON.parse(value.data.playerData);
+                //更新本地钻石数据
+                this.SetDiamond(_playerData.Diamond);
+                
+                //重新开启存储
+                this.schedule(this.AutoSaveData, 15);
+            }else{
+                //兑换失败
+            }
+        })
+    },
+    /**
+     * 获取是否租赁过的状态
+     */
+    getPlayerExchangeState(callback){
+        utils.get(utils.api.playerExchangeState, {}, (res, vaule) => {
+            console.log("租赁状态:",value);
+            callback(res, vaule);
+        })
+    },
+
     /**
      * 暂时不需要从这里读取
      */

部分文件因为文件数量过多而无法显示