WalletPagePOG.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. import { _decorator, Component, Node, Event } from "cc";
  2. import BaseUI from "../../scripts/base/BaseUI";
  3. import { Tips } from "../../scripts/mgr/Tips";
  4. import UserM from "../../scripts/api/UserM";
  5. import { GoodsId } from "../../scripts/api/GoodsId";
  6. import Utils from "../../scripts/utils/Utils";
  7. import ConfigM from "../../scripts/api/ConfigM";
  8. import WalletM, { PogHomeDto } from "../../scripts/api/WalletM";
  9. import { TipsData, TipsLayer } from "../layer/TipsLayer";
  10. import { Label } from "cc";
  11. import { Hall } from "../hall/Hall";
  12. import { PageShop } from "../hall/PageShop";
  13. const { ccclass, property } = _decorator;
  14. @ccclass("WalletPagePOG")
  15. export class WalletPagePOG extends BaseUI {
  16. protected onLoad(): void {
  17. super.onLoad();
  18. this.initTitles();
  19. }
  20. initTitles() {
  21. this.setText("lbl_my_assets_title", Utils.setI18nLabel("Wallet.MyAssets"));
  22. this.setText("lbl_pog_tips", Utils.setI18nLabel("Wallet.POGDesc"));
  23. this.setText(
  24. "lbl_booster_title",
  25. Utils.setI18nLabel("Wallet.CurrentPOGBoosterTitle")
  26. );
  27. this.setText(
  28. "lbl_game_pass_desc",
  29. Utils.setI18nLabel("Wallet.GamePassDesc")
  30. );
  31. this.setText(
  32. "lbl_game_pass_tips",
  33. Utils.setI18nLabel("Wallet.GamePassTips")
  34. );
  35. this.setText("lbl_rank_tips", Utils.setI18nLabel("Wallet.RankTips"));
  36. this.setText(
  37. "lbl_game_pass_tips",
  38. Utils.setI18nLabel("Wallet.GamePassTips")
  39. );
  40. }
  41. public onShow(): void {
  42. this.init();
  43. }
  44. async init() {
  45. let data: PogHomeDto = await WalletM.ins.pogHome();
  46. // let gradeName = UserM.ins.getGradeName();
  47. // let my_rank_desc = Utils.setI18nLabel(
  48. // "Wallet.MyRankDesc",
  49. // "" + gradeName,
  50. // "" + data.booster.seasonRank
  51. // );
  52. // this.setText("lbl_my_rank", my_rank_desc);
  53. this.setText(
  54. "lbl_booster_desc",
  55. Utils.setI18nLabel(
  56. "Wallet.TotalBoosterValue",
  57. "" + data.booster.rankAddition
  58. )
  59. );
  60. this.FindNode("i_up_rank")
  61. .getChildByName("value")
  62. .getComponent(Label).string = data.booster.totalRank + "%";
  63. this.setText("lbl_pog_balance", UserM.ins.getPogDisplay());
  64. this.setText("lbl_tog_balance", UserM.ins.getTogDisplay());
  65. this.setText(
  66. "lbl_game_pass",
  67. "Game Pass x" + "" + data.booster.gamePassNum
  68. );
  69. this.FindNode("i_up_game_pass")
  70. .getChildByName("value")
  71. .getComponent(Label).string = data.booster.gamePassAddition + "%";
  72. // this.SetSprite(
  73. // "icon_my_grade",
  74. // "texture/common/grade" + UserM.ins.getGrade() + ""
  75. // );
  76. this.setText(
  77. "lbl_tip_how_earn_pog",
  78. Utils.setI18nLabel("Wallet.HowToEarnPOGTitle")
  79. );
  80. this.setText(
  81. "lbl_how_earn_pog_1",
  82. Utils.setI18nLabel("Wallet.HowToEarnPOG1")
  83. );
  84. this.setText(
  85. "lbl_how_earn_pog_2",
  86. Utils.setI18nLabel("Wallet.HowToEarnPOG2")
  87. );
  88. this.setText(
  89. "lbl_how_earn_pog_3",
  90. Utils.setI18nLabel("Wallet.HowToEarnPOG3")
  91. );
  92. this.setText(
  93. "lbl_how_earn_pog_4",
  94. Utils.setI18nLabel("Wallet.HowToEarnPOG4")
  95. );
  96. }
  97. protected async simpleOnBtnClick(name: string) {
  98. switch (name) {
  99. case "btn_history":
  100. Tips.show("POG History Coming Soon");
  101. break;
  102. case "btn_utility":
  103. let data = new TipsData();
  104. data.title = "";
  105. data.forceConfirm = true;
  106. data.content = Utils.setI18nLabel("Wallet.POGUtilityDesc");
  107. TipsLayer.show(data);
  108. break;
  109. case "btn_go_1":
  110. await Hall.ins.switchPage(Hall.PagePlay);
  111. break;
  112. case "btn_go_2":
  113. this.jumpToPogShop();
  114. break;
  115. case "btn_go_3":
  116. Tips.show("Coming Soon");
  117. break;
  118. case "btn_go_4":
  119. this.jumpToPogShop();
  120. break;
  121. }
  122. }
  123. async jumpToPogShop() {
  124. let shopPageNode = await Hall.ins.switchPage(Hall.PageShop);
  125. shopPageNode.getComponent(PageShop).switchTab(PageShop.TAB_POG_BOX);
  126. }
  127. }