WalletPageTOG.ts 2.5 KB

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