|
|
@@ -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);
|