|
|
@@ -1,3 +1,5 @@
|
|
|
+import { PigBankData } from "../../../data/module/PigBankData";
|
|
|
+import { OpenActionType, PanelType } from '../../../../mk/system/UISystem';
|
|
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
/**
|
|
|
@@ -11,47 +13,62 @@ export default class PigBank extends cc.Component {
|
|
|
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!;
|
|
|
+
|
|
|
+ private ui_data: PigBankData = new PigBankData();
|
|
|
onLoad() {
|
|
|
|
|
|
}
|
|
|
|
|
|
start() {
|
|
|
- this.initGetDesc();
|
|
|
+ this.initCashDesc();
|
|
|
}
|
|
|
|
|
|
- update(dt) {
|
|
|
-
|
|
|
- }
|
|
|
+ // update(dt) {
|
|
|
+ // }
|
|
|
|
|
|
- /** 按钮描述展示 */
|
|
|
- private initGetDesc() {
|
|
|
- if (false) {
|
|
|
- this.lbl_get_desc.string = '明日可提现';
|
|
|
+ /**
|
|
|
+ * 提现描述展示
|
|
|
+ */
|
|
|
+ private initCashDesc() {
|
|
|
+ if (this.ui_data.cur_cash_count) {
|
|
|
+ if (this.ui_data.cur_cash_count >= this.ui_data.cash_min_limit) {
|
|
|
+ this.lbl_get_desc.string = '直接提现';
|
|
|
+ this.node_tip_anim.active = false;
|
|
|
+ } else {
|
|
|
+ this.lbl_get_desc.string = '满' + 0.3 + '元可提';
|
|
|
+ this.node_tip_anim.active = true;
|
|
|
+ }
|
|
|
+ this.initDeposit(this.ui_data.cur_cash_count)
|
|
|
} else {
|
|
|
- this.lbl_get_desc.string = '满' + 0.3 + '元可提现';
|
|
|
+ this.lbl_get_desc.string = '明日可提现';
|
|
|
+ this.initDeposit(this.ui_data.next_cash_count)
|
|
|
+ this.node_tip_anim.active = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 提现操作
|
|
|
*/
|
|
|
- private cashOP() {
|
|
|
-
|
|
|
+ private clickCashOP() {
|
|
|
+ this.ui_data.cashOP();
|
|
|
+ mk.ui.closePanel(this.node.name);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 初始化存钱罐金额
|
|
|
* - 精确到分
|
|
|
*/
|
|
|
- private initDeposit() {
|
|
|
- const count = 0
|
|
|
- this.lbl_deposit.string = 0 + '元';
|
|
|
+ private initDeposit(count = 0) {
|
|
|
+ const new_count = count.toFixed(2)
|
|
|
+ this.lbl_deposit.string = new_count + '元';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 打开帮助界面
|
|
|
*/
|
|
|
- private openHelpPanel() {
|
|
|
-
|
|
|
+ private ClockOpenHelpPanel() {
|
|
|
+ mk.ui.openPanel('help', PanelType.module, OpenActionType.normal);
|
|
|
}
|
|
|
}
|