浏览代码

商店种子下架

yu 3 年之前
父节点
当前提交
3a681c5e88
共有 2 个文件被更改,包括 24 次插入10 次删除
  1. 11 6
      assets/Script/UI/BuildingView.js
  2. 13 4
      assets/Script/UI/StoreView.js

+ 11 - 6
assets/Script/UI/BuildingView.js

@@ -144,18 +144,18 @@ cc.Class({
             this.mySeedList = vaule.data.seed;
             this.myFruitList = vaule.data.fruit;
 
-            // console.log(this.mySeedList, this.myFruitList);
+            console.log(this.mySeedList, this.myFruitList);
             for (let i = 0; i < this.mySeedList.length; i++) {
                 //没有种子数量不显示 todo 看看后续需不需要处理删除
-                //if (this.mySeedList[i].amount < 1) continue;
+                if (this.mySeedList[i].amount < 1) continue;
                 
                 let _seed = cc.instantiate(this.seedPrefab);
                 _seed.parent = this.Seed;
                
-                if (this.mySeedList[i].amount == 0)
-                {
-                    _seed.getChildByName("SellOut").active = 0;
-                }
+                //if (this.mySeedList[i].amount == 0)
+                //{
+                //    _seed.getChildByName("SellOut").active = 0;
+                //}
 
                 let _seedScript = _seed.getComponent("Content_Button");
                 _seedScript.Name = this.mySeedList[i].name;
@@ -227,6 +227,11 @@ cc.Class({
                 _fruitScript.SNB = this.myFruitList[i].priceSnb;
                 _fruitScript.Synopsis = this.myFruitList[i].fruitDescribe;
 
+                //if (this.myFruitList[i].amount == 0)
+                //{
+                //    _fruit.getChildByName("SellOut").active = 0;
+                //}
+
                 //设置果实信息
                 let _contentFruit = _fruit.getComponent("Content_fruit");
                 _contentFruit.fruitInfo = this.myFruitList[i];

+ 13 - 4
assets/Script/UI/StoreView.js

@@ -130,16 +130,25 @@ cc.Class({
         });
         //获取种子和果实
         GlobalD.GameData.getMallSeed((res, vaule) => {
-            console.log('vaule111111111=', vaule)
+            //console.log('vaule111111111=', vaule)
             this.mySeedList = vaule.data;
 
-
+            console.log('this.mySeedList[i]=', this.mySeedList);
             for (let i = 0; i < this.mySeedList.length; i++) {
                 //没有种子数量不显示 todo 看看后续需不需要处理删除
-                if (this.mySeedList[i].amount < 1) continue;
-
+                //if (this.mySeedList[i].amount < 1) continue;
+                
                 let _seed = cc.instantiate(this.seedPrefab);
 
+                //if (this.mySeedList[i].amount < 1)
+                if (this.mySeedList[i].amount < 1)
+                {
+                    //_seed.getChildByName("SellOut").active = true;
+                }
+                else{
+                    _seed.getChildByName("SellOut").active = false;
+                }
+
                 // _seed.getChildByName("buy_button").active = true;
                 // _seed.getChildByName("Name").active = false;
                 // _seed.getChildByName("Name").getChildByName("Num").getComponent(cc.Label).strng = '';//'x'+this.mySeedList[i].amount;