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"; 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 = new TipsData(); data.title = ""; data.forceConfirm = true; data.content = Utils.setI18nLabel("Wallet.POGUtilityDesc"); TipsLayer.show(data); 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); shopPageNode.getComponent(PageShop).switchTab(PageShop.TAB_POG_BOX); } }