UIBirthdayGift.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { AppKernel } from '@scripts/app/AppKernel';
  2. import { UIViewID } from '@scripts/define/UIDefine';
  3. import { UIPopup } from '@scripts/framework/ui/UIPopup';
  4. import { formatGoodsNum } from '@scripts/utils/Helper';
  5. import { addBtnClick } from '@scripts/utils/UIHelper';
  6. import { _decorator, Component, Label, Node } from 'cc';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('UIBirthdayGift')
  9. export class UIBirthdayGift extends UIPopup {
  10. readonly viewId: UIViewID = UIViewID.UIBirthdayGift;
  11. @property(Node)
  12. btnClose: Node;
  13. @property(Node)
  14. btnReceive: Node;
  15. @property(Label)
  16. lblSC: Label;
  17. @property(Label)
  18. lblGC: Label;
  19. @property(Label)
  20. lblPoint: Label;
  21. @property(Label)
  22. lblTimes: Label;
  23. protected onCreate() {
  24. addBtnClick(this.btnClose, this.closeSelf, this);
  25. addBtnClick(this.btnReceive, this.onBtnReceiveClick, this);
  26. }
  27. private async onBtnReceiveClick() {
  28. AppKernel.ui.loading(true);
  29. const res = await AppKernel.stores.vipStore.reqVipClaim('birthday_gift');
  30. if (res) {
  31. }
  32. AppKernel.ui.loading(false);
  33. }
  34. protected onOpen(_params: unknown): void | Promise<void> {
  35. const vipConfig = AppKernel.stores.vipStore.vipConfig;
  36. const birthday_gift = vipConfig.rewards.birthday_gift;
  37. this.lblSC.string = formatGoodsNum(birthday_gift.reward.sc);
  38. this.lblGC.string = formatGoodsNum(birthday_gift.reward.gc);
  39. this.lblPoint.string = formatGoodsNum(birthday_gift.reward.clubpoint);
  40. }
  41. }