| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { AppKernel } from '@scripts/app/AppKernel';
- import { UIPopup } from '@scripts/framework/ui/UIPopup';
- import { IFirstPack } from '@scripts/store/payStore/data';
- import { formatGCNum, formatSCNum } from '@scripts/utils/Helper';
- import { addBtnClick } from '@scripts/utils/UIHelper';
- import { formatVip } from '@scripts/utils/VipHelper';
- import { _decorator, Button, Component, Label, Node } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('UIFirstPack')
- export class UIFirstPack extends UIPopup {
- @property(Label)
- lblGC: Label;
- @property(Label)
- lblSC: Label;
- @property(Label)
- lblVIP: Label;
- @property(Label)
- lblButton: Label;
- @property(Button)
- btnClose: Button;
- @property(Button)
- btnPay: Button;
- private _packInfo: IFirstPack;
- protected onCreate(): void | Promise<void> {
- addBtnClick(this.btnClose, this.closeSelf, this);
- addBtnClick(this.btnPay, this.onBtnPayClick, this);
- }
- protected async onBeforeOpen(_params: unknown) {
- const payStore = AppKernel.stores.payStore;
- const pack = await payStore.reqFirstPackInfo();
- this._packInfo = pack;
- return !!pack;
- }
- private onBtnPayClick() {
- }
- protected onOpen(_params: unknown): void | Promise<void> {
- if (!this._packInfo) {
- this.lblGC.string = "";
- this.lblSC.string = "";
- this.lblVIP.string = "";
- return;
- }
- const next_sequence = this._packInfo.next_sequence;
- const current = next_sequence - 1;
- const data = this._packInfo.list[current];
- this.lblGC.string = formatGCNum(data.gc);
- this.lblSC.string = formatSCNum(data.sc);
- this.lblVIP.string = data.cp.toString();
- this.lblButton.string = AppKernel.i18n.t("store.buynow", Number(data.money));
- }
- }
|