| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- const { ccclass, property } = cc._decorator;
- /**
- * 存钱罐界面样式
- * @author 薛鸿潇
- */
- @ccclass
- export default class PigBank extends cc.Component {
- @property({ type: cc.Label, displayName: '按钮描述' })
- private lbl_get_desc: cc.Label = null!;
- @property({ type: cc.Label, displayName: '存款数量' })
- private lbl_deposit: cc.Label = null!;
- @property({ type: cc.Node, displayName: '提示动画' })
- private node_tip_anim: cc.Node = null!;
- @property({ type: cc.Animation, displayName: '提现动画' })
- private anim_btn_cash: cc.Animation = null!;
- onLoad() {
- }
- start() {
- this.initCashDesc();
- mk.audio.playEffect("pigBank", false);
- }
- update(dt) {
- if (gData.pigbank.init_data) {
- this.initCashDesc();
- }
- if (gData.pigbank.adData) {
- cc.log('存钱罐提现', gData.pigbank.adData)
- }
- }
- lateUpdate() {
- gData.pigbank.init_data = false;
- gData.pigbank.adData = null;
- }
- /**
- * 提现描述展示
- */
- private initCashDesc() {
- if (gData.pigbank.cash_enable) {
- this.lbl_get_desc.string = '直接提现';
- this.node_tip_anim.active = false;
- this.anim_btn_cash.play();
- } else {
- if (gData.pigbank.cur_cash_count >= gData.pigbank.cash_min_limit) {
- this.lbl_get_desc.string = '明日可提现';
- } else {
- this.lbl_get_desc.string = '满' + gData.pigbank.cash_min_limit + '元可提';
- }
- this.node_tip_anim.active = true;
- this.anim_btn_cash.stop();
- this.anim_btn_cash.node.scale = 1;
- }
- this.initDeposit()
- }
- /**
- * 初始化存钱罐金额
- * - 精确到分
- */
- private initDeposit() {
- const new_count = gData.pigbank.cur_cash_count.toFixed(2)
- this.lbl_deposit.string = new_count + '元';
- }
- /**
- * 提现操作
- */
- private clickCashOP() {
- mk.audio.playEffect("button");
- if (!gData.pigbank.cash_enable) {
- mk.tip.pop('满' + gData.pigbank.cash_min_limit + '元可提现')
- return;
- }
- gData.pigbank.cashOP();
- mk.ui.closePanel(this.node.name);
- }
- /**
- * 打开帮助界面完成回调
- */
- private async clickOpenHelpCall() {
- let des = "1、游戏内观看任意视频,都会获得现金。\n\n2、存款达到0.3元后,次日登陆,可无门槛提现。\n\n3、提现后,存款清零,可重新开始。";
- gData.help.des = des;
- }
- }
|