WalletPageTOG.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { _decorator, Component, Node, Event } from "cc";
  2. import BaseUI from "../../scripts/base/BaseUI";
  3. import { Tips } from "../../scripts/mgr/Tips";
  4. import WalletM, { TogHomeDto } from "../../scripts/api/WalletM";
  5. import UserM from "../../scripts/api/UserM";
  6. import { GoodsId } from "../../scripts/api/GoodsId";
  7. import Utils from "../../scripts/utils/Utils";
  8. import { TipsData, TipsLayer } from "../layer/TipsLayer";
  9. const { ccclass, property } = _decorator;
  10. @ccclass("WalletPageTOG")
  11. export class WalletPageTOG extends BaseUI {
  12. public onShow(): void {
  13. this.init();
  14. }
  15. async init() {
  16. this.setText("lbl_pog_balance", UserM.ins.getPogDisplay());
  17. this.setText("lbl_tog_balance", UserM.ins.getTogDisplay());
  18. let data: TogHomeDto = await WalletM.ins.togHome();
  19. // this.setText(
  20. // "lbl_tog_next_refresh_time",
  21. // "Next Refresh Time:" + "00:00:00"
  22. // );
  23. this.setText("lbl_obtain_pog", Utils.formatNumber(data.rewardTog, 0));
  24. this.setText("lbl_my_pog", Utils.formatNumber(data.myPog, 0));
  25. this.setText(
  26. "lbl_platform_total_pog",
  27. Utils.formatNumber(data.totalPog, 0)
  28. );
  29. this.setText(
  30. "lbl_pog_grade_tog_total",
  31. Utils.formatNumber(data.totalTog, 0)
  32. );
  33. }
  34. protected simpleOnBtnClick(name: string): void {
  35. switch (name) {
  36. case "btn_utility":
  37. let content = Utils.setI18nLabel("Wallet.TOGUtilityDesc");
  38. let data = TipsLayer.build(content);
  39. data.title = "";
  40. data.link = "https://telgather.gitbook.io/telgather-litepaper/telgather-economy";
  41. data.show();
  42. break;
  43. case "btn_claim_tog":
  44. let tipsData = TipsLayer.build(`Are you sure you want to claim TOG?`);
  45. tipsData.onConfirm = () => {
  46. Tips.show("Claim TOG Coming Soon");
  47. };
  48. tipsData.show();
  49. break;
  50. case "btn_history":
  51. Tips.show("TOG History Coming Soon");
  52. break;
  53. case "btn_top_up":
  54. Tips.show("TOG Top Up Coming Soon");
  55. break;
  56. case "btn_withdraw":
  57. Tips.show("TOG Withdraw Coming Soon");
  58. break;
  59. case "btn_staking":
  60. Tips.show("TOG Staking Coming Soon");
  61. break;
  62. case "btn_go_1":
  63. Tips.show("Coming Soon");
  64. break;
  65. case "btn_go_2":
  66. let url = "https://t.me/Telgatherminigames";
  67. window.open(url, "_blank");
  68. break;
  69. case "btn_go_3":
  70. Tips.show("Coming Soon");
  71. }
  72. }
  73. }