This commit is contained in:
2025-09-19 11:10:20 +08:00
parent ad0e80ecda
commit a5859af3b4
14 changed files with 3596 additions and 881 deletions
@@ -25,6 +25,7 @@ import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { ViewManager } from "../../../Main/Manager/ViewManager";
import { TipsPanel } from "./TipsPanel";
import ResManager from "../../../Main/Manager/ResManager";
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
const { ccclass, property } = _decorator;
@ccclass("GirlListPopupPanel")
@@ -36,6 +37,7 @@ export class GirlListPopupPanel extends li_BaseView {
private girlName: Label;
private girlTag: Label;
private balanceCount: Label;
base: GirlListItem;
img: Sprite;
@@ -56,6 +58,7 @@ export class GirlListPopupPanel extends li_BaseView {
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
this.girlName = this._nodeTab.Name.getComponent(Label);
this.girlTag = this._nodeTab.Tag.getComponent(Label);
this.balanceCount = this._nodeTab.balanceCount.getComponent(Label);
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
this.priceLabel = this._nodeTab.Price.getComponent(Label);
@@ -72,11 +75,11 @@ export class GirlListPopupPanel extends li_BaseView {
);
const path = girlData.getGrilAvatar(this.category.toString(), this.girlId);
this.refreshCoinNum();
//console.log(path);
// 加载远程资源
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
let newPath = envData.cdn + "/" + "Girls/" + path + ".png";
let newPath = envData.cdn + "/" + "Girls/" + path + ".png";
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
this.scaleToFillItem();
});
@@ -84,10 +87,15 @@ export class GirlListPopupPanel extends li_BaseView {
registerListener() {
GButton.BandClick(this._nodeTab.BuyBtn, this.buyCharacter, this);
GButton.BandClick(this._nodeTab.CloseBtn, this.Close, this);
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
}
Close() {
this.close();
}
onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
}
async buyCharacter() {
// 购买id为girlId的女生
console.log(this.girlId);
@@ -116,6 +124,15 @@ export class GirlListPopupPanel extends li_BaseView {
// TipsPanel.show("Insufficient balance, need to purchase");
}
// 刷新余额
private refreshCoinNum() {
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
const balance = walletData.getOriginalBalance();
this.balanceCount.string = balance.toString();
}
onBalanceChange = () => {
this.refreshCoinNum();
};
scaleToFillItem() {
if (!this.img || !this.img.spriteFrame) return;
@@ -33,6 +33,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
private resId: number;
private type: proto.cs.EnmResType;
private base: DetailImageItem | ImagePopup;
private balanceCount: Label;
private desc: Label;
@@ -56,6 +57,8 @@ export class PopupGirlDetailPanel extends li_BaseView {
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
this.img = this._nodeTab.img.getComponent(Sprite);
let descText = LanguageUtils.getText("popupgirldetailpanel.content");
this.balanceCount = this._nodeTab.balanceCount.getComponent(Label);
this.refreshCoinNum();
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
@@ -95,7 +98,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
// 加载远程资源
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
const path = url + "_thumbnail_blur";
let newPath = envData.cdn + "/" + "Girls/" + path + ".jpg";
let newPath = envData.cdn + "/" + "Girls/" + path + ".jpg";
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
this.scaleToFillItem();
});
@@ -147,7 +150,12 @@ export class PopupGirlDetailPanel extends li_BaseView {
TipsPanel.show("Insufficient balance, need to purchase");
}
}
// 刷新余额
private refreshCoinNum() {
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
const balance = walletData.getOriginalBalance();
this.balanceCount.string = balance.toString();
}
scaleToFillItem() {
if (!this.img || !this.img.spriteFrame) return;
@@ -174,6 +174,7 @@ export class PurchasePanel extends li_BaseView {
}
createOrRefreshWeb3PayPanel(param: any) {
if (param.payType == proto.cs.EnmPayType.EPT_Cash_INR) return;
let data = {
orderId: param.orderId,
payType: param.payType,
@@ -10,6 +10,7 @@ import { PurchasePanel } from "./PurchasePanel";
import { QRCodeGenerator } from "db://assets/utils/qrcodeGenerator";
import { TipsPanel } from "./TipsPanel";
import { SDKManager } from "../../../Main/Channel/SDKManager";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
const { ccclass, property } = _decorator;
@@ -108,8 +109,11 @@ export class Web3PopPanel extends li_BaseView {
const walletUrl = OrderData.getWalletById(this.orderId);
const expireTime = OrderData.getExpireById(this.orderId);
const retCode = OrderData.getRetCodeById(this.orderId);
// const retCode = OrderData.getRetCodeById(this.orderId);
// if (retCode != 0) {
// TipsPanel.show(LanguageUtils.getText("error_code_"+retCode));
// return;
// }
this.expireTimeText.string = expireTime.toString();
this.amount.string = amount;
this.address.string = walletUrl;