更新聊天次数购买弹窗

修复bug
This commit is contained in:
2025-10-14 11:00:49 +08:00
parent b4b1d347fc
commit 0088515f2a
21 changed files with 2473 additions and 2115 deletions
@@ -238,7 +238,6 @@ export class ChatController {
return false;
}
} catch (error) {
ErrorHandler.Instance.handleApiError(
error,
"ChatController.sendMessage",
@@ -16,12 +16,16 @@ export class ChargePopPanel extends li_BaseView {
Utils.parseNode(this.node, this._nodeTab);
GButton.BandClick(this._nodeTab.chargeBtn, this.gotoCharge, this);
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
GButton.BandClick(this._nodeTab.closeBtn, this.Close, this);
}
gotoCharge() {
NavigationManager.Instance.openPopupPanel("PurchasePanel");
this.close();
this.Close();
}
Close() {
NavigationManager.Instance.closePopupPanel(this.node);
}
}
@@ -22,7 +22,6 @@ import { ChatContentsLayout } from "../components/ChatContentsLayout";
import { ImagePopup } from "../components/ImagePopup";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { PriceType, VideoEmotion, purchase } from "../../../schema/schema";
import { PayToTalkSubpanel } from "./PayToTalkSubpanel";
import { DataId, DataManager } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { SceneBgVideoLayer } from "../../../Sub/UI/SceneBgVideoLayer";
@@ -39,9 +38,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
manager: DialogManager = null;
private chatController: ChatController = null;
@property(PayToTalkSubpanel)
payToTalkPanel: PayToTalkSubpanel = null;
@property(EditBox)
editBox: EditBox = null;
@@ -105,7 +101,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.register();
//this.refresh();
this.payToTalkPanel.node.active = false;
// 检查 SceneBgVideoLayer 是否可用
if (!this.videoLayer) {
@@ -470,7 +465,10 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
onChatLimitReached(): void {
this.payToTalkPanel.show(this.categoryId, this.id);
NavigationManager.Instance.openPopupPanel("PayToTalkPanel", {
categoryId: this.categoryId,
girlId: this.id,
});
TipsPanel.show(LanguageUtils.getText("chat_error_code_1001"));
}
/**
@@ -17,41 +17,33 @@ import { ConfigId, ConfigManager } from "../../manager/ConfigManager";
import { PurchaseConfig } from "../../config/PurchaseConfig";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import li_BaseView from "../../../Main/Common/li_BaseView";
import { TipsPanel } from "./TipsPanel";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@ccclass("PayToTalkSubpanel")
export class PayToTalkSubpanel extends Component {
@property(Label)
timeLabel: Label = null;
@property(Label)
timeBtnLabel: Label = null;
@property(Label)
vipLabel: Label = null;
@property(Label)
vipBtnLabel: Label = null;
@ccclass("PayToTalkPanel")
export class PayToTalkPanel extends li_BaseView {
base: UIOpacity;
categoryId: number;
girlId: number;
protected onLoad(): void {
categoryId: string;
girlId: number;
openUIDataCT(data) {
this.categoryId = data.categoryId;
this.girlId = data.girlId;
}
onLoadCT(): void {
this.base = this.getComponent(UIOpacity);
this.show();
}
show(categoryId: string, girlId: number) {
show() {
if (!this.base) this.base = this.getComponent(UIOpacity);
this.node.active = true;
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();
}
@@ -63,7 +55,7 @@ export class PayToTalkSubpanel extends Component {
{ opacity: 0 },
{
onComplete: () => {
this.base.node.active = false;
NavigationManager.Instance.closePopupPanel(this.node);
},
}
)
@@ -86,9 +78,13 @@ export class PayToTalkSubpanel extends Component {
onClick_BuyVip() {
//购买VIP
logger.log("购买vip");
const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
const memberId = shopData.get7DayMemberId();
this.reqBuyGood(memberId, this.girlId);
// const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
// const memberId = shopData.get7DayMemberId();
// this.reqBuyGood(memberId, this.girlId);
NavigationManager.Instance.openPopupPanel("PurchasePanel");
}
onClickClose() {
this.hide();
}
// 使用余额购买商品
@@ -105,7 +101,7 @@ export class PayToTalkSubpanel extends Component {
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setChatRemainCount(
this.categoryId.toString(),
this.categoryId,
girlId,
resData.chatRemainCount
);
@@ -113,7 +109,14 @@ export class PayToTalkSubpanel extends Component {
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
TipsPanel.show(LanguageUtils.getText("payment.succeed"));
this.hide();
} else {
if (res && res.code) {
const key = "error_code_" + res.code;
TipsPanel.show(LanguageUtils.getText(key));
}
}
}
}
@@ -107,7 +107,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
GButton.BandClick(this._nodeTab.CloseBtn, this.Close, this);
}
Close() {
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
}
async buyAsset() {
// 购买id为girlId的女生
@@ -145,7 +145,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
} else {
NavigationManager.Instance.openPopupPanel("ChargePopPanel");
}
this.close();
this.Close();
}
// 刷新余额
private refreshCoinNum() {
@@ -129,7 +129,7 @@ export class PurchasePanel extends li_BaseView {
GButton.BandClick(
this._nodeTab.ReturnBtn,
() => {
NavigationManager.Instance.closeSubPanel(this);
NavigationManager.Instance.closePopupPanel(this.node);
},
this
);
@@ -14,6 +14,7 @@ import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import { PersonalPanel } from "./PersonalPanel";
import { PaymentMethod } from "db://assets/Scripts/chat18x/payment/types";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@@ -260,7 +261,7 @@ export class Web3PopPanel extends li_BaseView {
onClickClose() {
this.stopCountdown();
this.payPanel.web3PopPanel = null;
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
}
private formatCountdownTime(seconds: number): string {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "7e0cd3ab-7316-4451-a30c-305baeb5a77d",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "PayToTalkPanel"
}
}
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 59 KiB

+9
View File
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "a77c2aa8-999c-4ace-a23b-4acd71574939",
"files": [],
"subMetas": {},
"userData": {}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "346261a9-723d-4a55-8044-1439a1cf456b",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "346261a9-723d-4a55-8044-1439a1cf456b@6c48a",
"displayName": "TS_an_fen",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "346261a9-723d-4a55-8044-1439a1cf456b",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "346261a9-723d-4a55-8044-1439a1cf456b@f9941",
"displayName": "TS_an_fen",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 170,
"height": 50,
"rawWidth": 170,
"rawHeight": 50,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-85,
-25,
0,
85,
-25,
0,
-85,
25,
0,
85,
25,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
50,
170,
50,
0,
0,
170,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-85,
-25,
0
],
"maxPos": [
85,
25,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "346261a9-723d-4a55-8044-1439a1cf456b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "346261a9-723d-4a55-8044-1439a1cf456b@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "f7ef4ba2-7e65-4a1d-b00c-050bd6d02ff2",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "f7ef4ba2-7e65-4a1d-b00c-050bd6d02ff2@6c48a",
"displayName": "TS_an_zi",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "f7ef4ba2-7e65-4a1d-b00c-050bd6d02ff2",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "f7ef4ba2-7e65-4a1d-b00c-050bd6d02ff2@f9941",
"displayName": "TS_an_zi",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 170,
"height": 50,
"rawWidth": 170,
"rawHeight": 50,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-85,
-25,
0,
85,
-25,
0,
-85,
25,
0,
85,
25,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
50,
170,
50,
0,
0,
170,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-85,
-25,
0
],
"maxPos": [
85,
25,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "f7ef4ba2-7e65-4a1d-b00c-050bd6d02ff2@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "f7ef4ba2-7e65-4a1d-b00c-050bd6d02ff2@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "b4c7bcd6-5382-49a2-971c-353e63133b7b",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "b4c7bcd6-5382-49a2-971c-353e63133b7b@6c48a",
"displayName": "TS_db_zs",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "b4c7bcd6-5382-49a2-971c-353e63133b7b",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "b4c7bcd6-5382-49a2-971c-353e63133b7b@f9941",
"displayName": "TS_db_zs",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 144,
"height": 32,
"rawWidth": 144,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-72,
-16,
0,
72,
-16,
0,
-72,
16,
0,
72,
16,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
32,
144,
32,
0,
0,
144,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-72,
-16,
0
],
"maxPos": [
72,
16,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "b4c7bcd6-5382-49a2-971c-353e63133b7b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "b4c7bcd6-5382-49a2-971c-353e63133b7b@6c48a"
}
}