123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- import { _decorator, Component, Node, Event } from "cc";
- import BaseUI from "../../scripts/base/BaseUI";
- import { Tips } from "../../scripts/mgr/Tips";
- import UserM from "../../scripts/api/UserM";
- import { GoodsId } from "../../scripts/api/GoodsId";
- import Utils from "../../scripts/utils/Utils";
- import ConfigM from "../../scripts/api/ConfigM";
- import WalletM, { PogHomeDto } from "../../scripts/api/WalletM";
- import { TipsData, TipsLayer } from "../layer/TipsLayer";
- import { Label } from "cc";
- import { Hall } from "../hall/Hall";
- import { PageShop } from "../hall/PageShop";
- import { CommonTabsTitle } from "../common/CommonTabsTitle";
- const { ccclass, property } = _decorator;
- @ccclass("WalletPagePOG")
- export class WalletPagePOG extends BaseUI {
- protected onLoad(): void {
- super.onLoad();
- this.initTitles();
- }
- initTitles() {
- // this.setText("lbl_my_assets_title", Utils.setI18nLabel("Wallet.MyAssets"));
- this.setText("lbl_pog_tips", Utils.setI18nLabel("Wallet.POGDesc"));
- this.setText(
- "lbl_booster_title",
- Utils.setI18nLabel("Wallet.CurrentPOGBoosterTitle")
- );
- this.setText(
- "lbl_game_pass_desc",
- Utils.setI18nLabel("Wallet.GamePassDesc")
- );
- this.setText(
- "lbl_game_pass_tips",
- Utils.setI18nLabel("Wallet.GamePassTips")
- );
- this.setText("lbl_rank_tips", Utils.setI18nLabel("Wallet.RankTips"));
- this.setText(
- "lbl_game_pass_tips",
- Utils.setI18nLabel("Wallet.GamePassTips")
- );
- }
- public onShow(): void {
- this.init();
- }
- async init() {
- let data: PogHomeDto = await WalletM.ins.pogHome();
- // let gradeName = UserM.ins.getGradeName();
- // let my_rank_desc = Utils.setI18nLabel(
- // "Wallet.MyRankDesc",
- // "" + gradeName,
- // "" + data.booster.seasonRank
- // );
- // this.setText("lbl_my_rank", my_rank_desc);
- this.setText(
- "lbl_booster_desc",
- Utils.setI18nLabel(
- "Wallet.TotalBoosterValue",
- "" + data.booster.rankAddition
- )
- );
- this.FindNode("i_up_rank")
- .getChildByName("value")
- .getComponent(Label).string = data.booster.totalRank + "%";
- this.setText("lbl_pog_balance", UserM.ins.getPogDisplay());
- this.setText("lbl_tog_balance", UserM.ins.getTogDisplay());
- this.setText(
- "lbl_game_pass",
- "Game Pass x" + "" + data.booster.gamePassNum
- );
- this.FindNode("i_up_game_pass")
- .getChildByName("value")
- .getComponent(Label).string = data.booster.gamePassAddition + "%";
- // this.SetSprite(
- // "icon_my_grade",
- // "texture/common/grade" + UserM.ins.getGrade() + ""
- // );
- this.setText(
- "lbl_tip_how_earn_pog",
- Utils.setI18nLabel("Wallet.HowToEarnPOGTitle")
- );
- this.setText(
- "lbl_how_earn_pog_1",
- Utils.setI18nLabel("Wallet.HowToEarnPOG1")
- );
- this.setText(
- "lbl_how_earn_pog_2",
- Utils.setI18nLabel("Wallet.HowToEarnPOG2")
- );
- this.setText(
- "lbl_how_earn_pog_3",
- Utils.setI18nLabel("Wallet.HowToEarnPOG3")
- );
- this.setText(
- "lbl_how_earn_pog_4",
- Utils.setI18nLabel("Wallet.HowToEarnPOG4")
- );
- }
- protected async simpleOnBtnClick(name: string) {
- switch (name) {
- case "btn_history":
- Tips.show("POG History Coming Soon");
- break;
- case "btn_utility":
- let data = TipsLayer.build(Utils.setI18nLabel("Wallet.POGUtilityDesc"));
- data.title = "";
- data.forceConfirm = true;
- data.show();
- break;
- case "btn_go_1":
- await Hall.ins.switchPage(Hall.PagePlay);
- break;
- case "btn_go_2":
- this.jumpToPogShop();
- break;
- case "btn_go_3":
- Tips.show("Coming Soon");
- break;
- case "btn_go_4":
- this.jumpToPogShop();
- break;
- }
- }
- async jumpToPogShop() {
- let shopPageNode = await Hall.ins.switchPage(Hall.PageShop);
- let shop = shopPageNode.getComponent(PageShop);
- if (
- shop.getComponentInChildren(CommonTabsTitle).selectIndex ==
- PageShop.TAB_POG_BOX.index
- ) {
- return;
- }
- setTimeout(() => {
- shopPageNode.getComponent(PageShop).switchTab(PageShop.TAB_POG_BOX);
- }, 300);
- }
- }
|