This commit is contained in:
2025-09-20 13:47:44 +08:00
parent f4b08616fc
commit 62cad1ca15
8 changed files with 1179 additions and 891 deletions
@@ -13,7 +13,10 @@ import { DataManager, DataId } from "../../data/DataManager";
import { WalletData } from "../../data/WalletData";
import { ShopData } from "../../data/ShopData";
import { GirlData } from "../../data/GirlData";
import proto from 'db://assets/Scripts/proto/proto.pb.js';
import proto from "db://assets/Scripts/proto/proto.pb.js";
import { ConfigId, ConfigManager } from "../../manager/ConfigManager";
import { PurchaseConfig } from "../../config/PurchaseConfig";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
const { ccclass, property } = _decorator;
@ccclass("PayToTalkSubpanel")
@@ -42,6 +45,13 @@ export class PayToTalkSubpanel extends Component {
this.base.opacity = 0;
this.categoryId = Number(categoryId);
this.girlId = girlId;
const cfg = ConfigManager.I.getDataById<PurchaseConfig>(ConfigId.Purchase);
const count = cfg.getCountById(cfg.getChatIds()[0]);
this.timeBtnLabel.string =
count + LanguageUtils.getText("chatpanel.buy10times");
tween(this.base).to(0.3, { opacity: 255 }).start();
}
@@ -93,12 +103,16 @@ export class PayToTalkSubpanel extends Component {
const resData = res.data;
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setChatRemainCount(this.categoryId.toString(), girlId, resData.chatRemainCount);
girlData.setChatRemainCount(
this.categoryId.toString(),
girlId,
resData.chatRemainCount
);
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.hide();
}
}
}
}
@@ -124,7 +124,7 @@ export class PersonalPanel extends li_BaseView {
private updateBalance(): void {
if (this.balanceLabel && this.walletData) {
const balance = this.walletData.getOriginalBalance();
this.balanceLabel.string = `余额: ${balance}`;
this.balanceLabel.string = `${balance}`;
}
}
@@ -133,9 +133,14 @@ export class PersonalPanel extends li_BaseView {
const vipExpire = this.walletData.vipExpire;
if (vipExpire && vipExpire > Date.now()) {
const expireDate = new Date(vipExpire);
this.vipStatusLabel.string = `VIP至: ${expireDate.toLocaleDateString()}`;
this.vipStatusLabel.string = `${LanguageUtils.getText(
"purchasepanel.vip_left"
)} ${expireDate.toLocaleDateString()}`;
} else {
this.vipStatusLabel.string = "普通用户";
this.vipStatusLabel.string = LanguageUtils.getText(
"purchasepanel.notvip"
);
}
}
}
@@ -471,6 +471,7 @@ export class ThemePanel extends li_BaseView {
// 事件回调函数(避免匿名函数导致的内存泄漏)
private onLanguageChange = () => {
this.recName.string = LanguageUtils.getText(this.rectNameKey);
this.refreshVipExpire();
};
private onBalanceChange = () => {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.