12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import { _decorator, Component, Node } from "cc";
- import BaseUI from "../../scripts/base/BaseUI";
- import { Tips } from "../../scripts/mgr/Tips";
- import { IPayListener, PayItems, PayType } from "../common/PayItems";
- import { Event } from "cc";
- import ShopM, { ShopDto } from "../../scripts/api/ShopM";
- import Utils from "../../scripts/utils/Utils";
- import { instantiate } from "cc";
- import UIUtils from "../../scripts/base/UIUtils";
- import { Vec3 } from "cc";
- import ConfigM, { ConfigShopItem } from "../../scripts/api/ConfigM";
- const { ccclass, property } = _decorator;
- @ccclass("GamePassItem")
- export class GamePassItem extends BaseUI implements IPayListener {
- showAnim(to: Node) {
- let from = this.FindNode("icon_game_pass");
- if (to == null || from == null) {
- return;
- }
- let node = instantiate(from);
- node.setParent(from);
- node.setPosition(0, 0, 0);
- UIUtils.moveToNewParent(to, node);
- UIUtils.AnimBezierMoveAndScale(node, new Vec3(0, 0, 0), 1, 1, () => {
- node.destroy();
- });
- }
- onPay(type: PayType, price: number) {
- // this.FindNode("activate").active = true;
- switch (type) {
- case PayType.USDT:
- this.buyUseUSD();
- break;
- case PayType.Gem:
- break;
- }
- }
- buyUseUSD() {
- let result = ShopM.ins.createOrder(this._data.id, PayType.USDT);
- }
- private PaysItem: PayItems;
- private _data: ShopDto;
- protected onLoad(): void {
- super.onLoad();
- this.setTitles();
- }
- setTitles() {}
- init(data: ShopDto) {
- this._data = data;
-
- this.setText(
- "lbl_title",
- Utils.setI18nLabel("Shop.GamePassItemTitle", "" + data.seasonId)
- );
- this.PaysItem = this.getComponentInChildren(PayItems);
- let payList = [
- {
- price: 30.0,
- type: PayType.USDT,
- },
- ];
- // this.setText(
- // "lbl_season_end_time",
- // "End Time:" + Utils.formattedOnlyDate(data.endTimeAt)
- // );
- this.setText(
- "lbl_season_end_time",
- ""
- );
- let c = ConfigM.ins.getShopListByStoreId(1)[0];
- this.setText(
- "lbl_desc4",
- Utils.setI18nLabel(
- "Shop.GamePassSalesInfo",
- data.totalSell + "/" +c.total,
- data.freeAirdropSell + "/" + data.freeAirdropTotal
- )
- );
- this.PaysItem.init(payList, this);
- }
- }
|