协议调试

This commit is contained in:
chen wei bo
2025-09-09 18:16:37 +08:00
parent f9f2077665
commit e89d515bde
10 changed files with 468 additions and 32 deletions
@@ -4,16 +4,24 @@ import Utils from "../../../Main/Common/Utils";
import { GButton } from "../../../Main/Common/GButton";
import { PopupGirlDetailPanel } from "./PopupGirlDetailPanel";
import { GirlListItem } from "../../uiitems/GirlListItem";
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { PlayerDataService } from "db://assets/Scripts/chat18x/network/services/PlayerDataService";
import { PlayerData } from "../../data/PlayerData";
import { WalletData } from "../../data/WalletData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
const { ccclass, property } = _decorator;
@ccclass("GirlListPopupPanel")
export class GirlListPopupPanel extends li_BaseView {
private _nodeTab: any = {};
private category: number;
private girlId: number;
base: GirlListItem;
openUIDataCT(data) {
this.category = data.category;
this.girlId = data.id;
this.base = data.base;
}
@@ -28,13 +36,26 @@ export class GirlListPopupPanel extends li_BaseView {
Close() {
this.close();
}
buyCharacter() {
async buyCharacter() {
// 购买id为girlId的女生
console.log(this.girlId);
if (true) {
// 请求解锁
const reqData = {
id: this.girlId,
};
let res = await GirlService.I.reqUnlockGirl(reqData);
console.log("请求解锁响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setIsRelease(this.category.toString(), this.girlId, true);
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refreshBuy(true);
this.close();
this.close();
}
}
}