|
@@ -173,6 +173,13 @@ cc.Class({
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
isPlaying: false,
|
|
isPlaying: false,
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //拿到申请列表的节点
|
|
|
|
|
+ applySnbView: {
|
|
|
|
|
+ default: null,
|
|
|
|
|
+ type: cc.Node,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
HiddenAll() {
|
|
HiddenAll() {
|
|
|
if (this.Seed.active) this.Seed.active = false
|
|
if (this.Seed.active) this.Seed.active = false
|
|
@@ -222,7 +229,7 @@ cc.Class({
|
|
|
_seedScript.Price = ''
|
|
_seedScript.Price = ''
|
|
|
_seedScript.CNT = this.mySeedList[i].priceCnt
|
|
_seedScript.CNT = this.mySeedList[i].priceCnt
|
|
|
_seedScript.SNB = this.mySeedList[i].priceSnb
|
|
_seedScript.SNB = this.mySeedList[i].priceSnb
|
|
|
- _seedScript.Mature = this.mySeedList[i].maturity + '天'
|
|
|
|
|
|
|
+ _seedScript.Mature = "成熟期:" + this.mySeedList[i].maturity + '天'
|
|
|
_seedScript.Synopsis = this.mySeedList[i].seedDescribe
|
|
_seedScript.Synopsis = this.mySeedList[i].seedDescribe
|
|
|
|
|
|
|
|
//设置一个生成点
|
|
//设置一个生成点
|
|
@@ -285,10 +292,10 @@ cc.Class({
|
|
|
let _equipScript = _equip.getComponent('Content_Button')
|
|
let _equipScript = _equip.getComponent('Content_Button')
|
|
|
_equipScript.Name = this.equipmentList[i].name
|
|
_equipScript.Name = this.equipmentList[i].name
|
|
|
// _equipScript.Price = ''
|
|
// _equipScript.Price = ''
|
|
|
- // _equipScript.CNT = 0;
|
|
|
|
|
|
|
+ _equipScript.CNT = this.equipmentList[i].priceCnt;
|
|
|
_equipScript.SNB = this.equipmentList[i].priceSnb
|
|
_equipScript.SNB = this.equipmentList[i].priceSnb
|
|
|
- // _equipScript.Mature = this.equipmentList[i].maturity + '天'
|
|
|
|
|
- _equipScript.Synopsis = this.equipmentList[i].itemDescribe
|
|
|
|
|
|
|
+ _equipScript.Mature = "有效期:" + this.equipmentList[i].effectiveDay + '天'
|
|
|
|
|
+ _equipScript.Synopsis = this.equipmentList[i].itemDescribe;
|
|
|
|
|
|
|
|
//设置一个生成点
|
|
//设置一个生成点
|
|
|
let _spawnScript = _equip.getComponent('Content_equip')
|
|
let _spawnScript = _equip.getComponent('Content_equip')
|
|
@@ -300,9 +307,19 @@ cc.Class({
|
|
|
switch (this.equipmentList[i].picture) {
|
|
switch (this.equipmentList[i].picture) {
|
|
|
case 'dog':
|
|
case 'dog':
|
|
|
_equipScript.bgSprite.spriteFrame = this.equipIconList[0];
|
|
_equipScript.bgSprite.spriteFrame = this.equipIconList[0];
|
|
|
|
|
+ _equipScript.showConsumeType = 2;
|
|
|
break
|
|
break
|
|
|
case 'beatDogStick':
|
|
case 'beatDogStick':
|
|
|
_equipScript.bgSprite.spriteFrame = this.equipIconList[1];
|
|
_equipScript.bgSprite.spriteFrame = this.equipIconList[1];
|
|
|
|
|
+ _equipScript.showConsumeType = 2;
|
|
|
|
|
+ break
|
|
|
|
|
+ case 'natural':
|
|
|
|
|
+ _equipScript.bgSprite.spriteFrame = this.equipIconList[2];
|
|
|
|
|
+ _equipScript.showConsumeType = 1;
|
|
|
|
|
+ break
|
|
|
|
|
+ case 'beast':
|
|
|
|
|
+ _equipScript.bgSprite.spriteFrame = this.equipIconList[3];
|
|
|
|
|
+ _equipScript.showConsumeType = 1;
|
|
|
break
|
|
break
|
|
|
default:
|
|
default:
|
|
|
break
|
|
break
|
|
@@ -409,6 +426,49 @@ cc.Class({
|
|
|
// console.log('res=', res)
|
|
// console.log('res=', res)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提交申请
|
|
|
|
|
+ */
|
|
|
|
|
+ onApplyingTran() {
|
|
|
|
|
+ //限制相关人员交易
|
|
|
|
|
+ if (1 === GlobalD.UserInfo.limitTran) {
|
|
|
|
|
+ GlobalD.GameData.showToast(
|
|
|
|
|
+ cc.find('Canvas/UICamera'),
|
|
|
|
|
+ '转换CNT通道关闭,请联系相关管理人员!',
|
|
|
|
|
+ 1
|
|
|
|
|
+ )
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (0 === Number(this.snbAmount) || 0 != Number(this.snbAmount) % 5) {
|
|
|
|
|
+ GlobalD.GameData.showToast(
|
|
|
|
|
+ cc.find('Canvas/UICamera'),
|
|
|
|
|
+ '请输入5的倍数兑换!',
|
|
|
|
|
+ 1
|
|
|
|
|
+ )
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log('申请兑换:' + Number(this.snbAmount))
|
|
|
|
|
+ GlobalD.GameData.onPostApplySnbToCnt(Number(this.snbAmount), (value) => {
|
|
|
|
|
+ console.log("兑换", value);
|
|
|
|
|
+ if (0 === value.code) {
|
|
|
|
|
+ this.ExchangePopView.active = false
|
|
|
|
|
+ GlobalD.GameData.showToast(
|
|
|
|
|
+ cc.find('Canvas/UICamera'),
|
|
|
|
|
+ '已提交申请,详情见申请列表兑换CNT。',
|
|
|
|
|
+ 2
|
|
|
|
|
+ )
|
|
|
|
|
+ }else{
|
|
|
|
|
+ GlobalD.GameData.showToast(
|
|
|
|
|
+ cc.find('Canvas/UICamera'),
|
|
|
|
|
+ value.msg,
|
|
|
|
|
+ 2
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
onPayCNTPopView(myIndex) {
|
|
onPayCNTPopView(myIndex) {
|
|
|
this.buySeedIndex = myIndex
|
|
this.buySeedIndex = myIndex
|
|
|
this.PayCNTPopView.active = true
|
|
this.PayCNTPopView.active = true
|
|
@@ -689,7 +749,7 @@ cc.Class({
|
|
|
},
|
|
},
|
|
|
PayEquipSNB() {
|
|
PayEquipSNB() {
|
|
|
console.log(
|
|
console.log(
|
|
|
- '支付价格:' + this.equipmentList[this.buyEquipIndex].priceSnb
|
|
|
|
|
|
|
+ '支付价格Snb:' + this.equipmentList[this.buyEquipIndex].priceSnb
|
|
|
)
|
|
)
|
|
|
if (this.isPlaying) {
|
|
if (this.isPlaying) {
|
|
|
GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), '购买过快!', 1)
|
|
GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), '购买过快!', 1)
|
|
@@ -736,6 +796,91 @@ cc.Class({
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
},
|
|
},
|
|
|
|
|
+ //用cnt购买
|
|
|
|
|
+ PayEquipCNT() {
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ '支付价格Cnt:' + this.equipmentList[this.buyEquipIndex].priceCnt + ",购买类型:" + this.equipmentList[this.buyEquipIndex].otherType
|
|
|
|
|
+ )
|
|
|
|
|
+ return;
|
|
|
|
|
+ // if (this.isPlaying) {
|
|
|
|
|
+ // GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), '购买过快!', 1)
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ // GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), '支付处理中...', 10)
|
|
|
|
|
+ // this.isPlaying = true
|
|
|
|
|
+
|
|
|
|
|
+ // //购买防护包也要使用轮询
|
|
|
|
|
+ // let currentAmount = 0;
|
|
|
|
|
+
|
|
|
|
|
+ // for (let i = 0; i < this.myWareHouseSeedList.length; i++) {
|
|
|
|
|
+ // if (
|
|
|
|
|
+ // this.myWareHouseSeedList[i].id == this.mySeedList[this.buySeedIndex].id
|
|
|
|
|
+ // ) {
|
|
|
|
|
+ // currentAmount = this.myWareHouseSeedList[i].amount
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // //当前背包的数量
|
|
|
|
|
+ // console.log('currentAmount:', {
|
|
|
|
|
+ // seedId: this.mySeedList[this.buySeedIndex].id,
|
|
|
|
|
+ // currentAmount: currentAmount, //把当前背包的数据传进去
|
|
|
|
|
+ // })
|
|
|
|
|
+ // let playAmount =
|
|
|
|
|
+ // this.playAmount * parseInt(this.mySeedList[this.buySeedIndex].priceCnt)
|
|
|
|
|
+ // if (0 === playAmount) {
|
|
|
|
|
+ // GlobalD.GameData.showToast(
|
|
|
|
|
+ // cc.find('Canvas/UICamera'),
|
|
|
|
|
+ // '请输入购买数量',
|
|
|
|
|
+ // 1
|
|
|
|
|
+ // )
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ // GlobalD.GameData.payCNT(
|
|
|
|
|
+ // playAmount,
|
|
|
|
|
+ // 4,
|
|
|
|
|
+ // this.mySeedList[this.buySeedIndex].id + '',
|
|
|
|
|
+ // (data) => {
|
|
|
|
|
+ // const [err, tx] = data
|
|
|
|
|
+ // // this.isPlaying = false;
|
|
|
|
|
+ // if (err === null) {
|
|
|
|
|
+ // // TODO 成功, 支付为链上操作,需要提供回调接口给这边服务端确认交易成功后修改购买订单结果
|
|
|
|
|
+ // console.log(tx) // 交易hash,唯一标识符
|
|
|
|
|
+ // //todo 种子
|
|
|
|
|
+ // if (this.AutoGetSeedsData) {
|
|
|
|
|
+ // this.unschedule(this.AutoGetSeedsData)
|
|
|
|
|
+ // this.AutoGetSeedsData = null
|
|
|
|
|
+ // }
|
|
|
|
|
+ // this.AutoGetSeedsData = () => {
|
|
|
|
|
+ // // getSeedCount ++;
|
|
|
|
|
+ // GlobalD.GameData.onGetSeedState(
|
|
|
|
|
+ // {
|
|
|
|
|
+ // seedId: this.mySeedList[this.buySeedIndex].id,
|
|
|
|
|
+ // currentAmount: currentAmount, //把当前背包的数据传进去
|
|
|
|
|
+ // },
|
|
|
|
|
+ // (value) => {
|
|
|
|
|
+ // console.log('轮询种子:' + JSON.stringify(value))
|
|
|
|
|
+ // if (0 === value.code) {
|
|
|
|
|
+ // this.unschedule(this.AutoGetSeedsData)
|
|
|
|
|
+ // console.log('轮询种子购买成功')
|
|
|
|
|
+ // GlobalD.GameData.showToast(
|
|
|
|
|
+ // cc.find('Canvas/UICamera'),
|
|
|
|
|
+ // '种子购买成功!',
|
|
|
|
|
+ // 1
|
|
|
|
|
+ // )
|
|
|
|
|
+ // // this.PayCNTPopView.active = false;
|
|
|
|
|
+ // //直接重新初始化一下列表,
|
|
|
|
|
+ // this.buildingViewScript.onUpdateList()
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // )
|
|
|
|
|
+ // }
|
|
|
|
|
+ // this.schedule(this.AutoGetSeedsData, 5)
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // console.log(err)
|
|
|
|
|
+ // GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), err, 2)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // )
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
onDestory() {
|
|
onDestory() {
|
|
|
if (this.AutoGetSeedsData) {
|
|
if (this.AutoGetSeedsData) {
|
|
@@ -744,7 +889,10 @@ cc.Class({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //申请列表
|
|
|
|
|
+ OpenApplyList() {
|
|
|
|
|
+ this.applySnbView.active = true;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
})
|