协议调试

This commit is contained in:
chen wei bo
2025-09-10 10:18:34 +08:00
parent 6c1f564f03
commit ce39270ebb
4 changed files with 41 additions and 20 deletions
@@ -176,24 +176,24 @@ export class GirlDetailPanel extends li_BaseView {
let resIds = girlData.getAllDisplayGrilPhotoId(this.category.toString(), this.id);
// 也立即尝试调整(以防已经加载完成)
this.adjustVideoScale();
this.refreshImgs(1, this.category, this.id, resIds);
this.refreshImgs(proto.cs.EnmResType.ERT_Image, this.category, this.id, resIds);
}
}
bindImgToggle() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let resIds = girlData.getAllDisplayGrilPhotoId(this.category.toString(), this.id);
this.refreshImgs(1, this.category, this.id, resIds);
this.refreshImgs(proto.cs.EnmResType.ERT_Image, this.category, this.id, resIds);
}
bindVideoToggle() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let resIds = girlData.getAllDisplayGrilVideoId(this.category.toString(), this.id);
this.refreshImgs(2, this.category, this.id, resIds);
this.refreshImgs(proto.cs.EnmResType.ERT_Video, this.category, this.id, resIds);
}
refreshImgs(
type: number,
type: proto.cs.EnmResType,
category: number,
id: number,
resIds: number[]
@@ -47,7 +47,7 @@ export class GirlListPopupPanel extends li_BaseView {
id: this.girlId,
};
let res = await GirlService.I.reqUnlockGirl(reqData);
console.log("请求解锁响应数据:", res);
console.log("请求解锁技师响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
// 保存数据
@@ -17,7 +17,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
private category: number;
private girlId: number;
private resId: number;
private type: number;
private type: proto.cs.EnmResType;
private base: DetailImageItem;
openUIDataCT(data) {
this.category = data.category;
@@ -31,10 +31,10 @@ export class PopupGirlDetailPanel extends li_BaseView {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
this.priceLabel = this._nodeTab.Price.getComponent(Label);
if (this.type === 1) {
if (this.type === proto.cs.EnmResType.ERT_Image) {
// 图片
this.priceLabel.string = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
} else if (this.type === 2) {
} else if (this.type === proto.cs.EnmResType.ERT_Video) {
// 视频
this.priceLabel.string = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
}
@@ -47,14 +47,35 @@ export class PopupGirlDetailPanel extends li_BaseView {
Close() {
this.close();
}
buyCharacter() {
async buyCharacter() {
// 购买id为girlId的女生
console.log(this.girlId + "---" + this.resId);
const success = true;
if (success) {
this.close();
// 请求解锁
const reqData = {
girlId: this.girlId,
resId: this.resId,
type: this.type,
};
let res = await GirlService.I.reqUnlockGirlRes(reqData);
console.log("请求解锁资源响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
if (this.type === proto.cs.EnmResType.ERT_Image) {
// 图片
girlData.unlockImage(this.category.toString(), this.girlId, this.resId);
} else if (this.type === proto.cs.EnmResType.ERT_Video) {
// 视频
girlData.unlockVideo(this.category.toString(), this.girlId, this.resId);
}
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refreshVideoBuy(true);
this.close();
}
}
}
@@ -44,7 +44,7 @@ export class DetailImageItem extends Component {
girlId: number;
resId: number;
type: number;
type: proto.cs.EnmResType;
onLoad() {
GButton.BandClick(this.node, this.onClickThis, this);
@@ -64,10 +64,10 @@ export class DetailImageItem extends Component {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 是否可见,不可见代表需要解锁
let isVisible = false;
if (this.type === 1) {
if (this.type === proto.cs.EnmResType.ERT_Image) {
// 图片
isVisible = girlData.isGirlPhotoVisible(this.category.toString(), this.girlId, this.resId);
} else if (this.type === 2) {
} else if (this.type === proto.cs.EnmResType.ERT_Video) {
// 视频
isVisible = girlData.isGirlVideoVisible(this.category.toString(), this.girlId, this.resId);
}
@@ -137,7 +137,7 @@ export class DetailImageItem extends Component {
refresh(
base: GirlDetailPanel,
type: number,
type: proto.cs.EnmResType,
category: number,
id: number,
resId: number
@@ -151,12 +151,12 @@ export class DetailImageItem extends Component {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let imgPath = "";
this.video.enabled = type === 2;
this.priceFrame.active = type === 2;
this.video.enabled = type === proto.cs.EnmResType.ERT_Video;
this.priceFrame.active = type === proto.cs.EnmResType.ERT_Video;
let price = 0;
// 是否可见,不可见代表需要解锁
let isVisible = false;
if (type === 1) {
if (type === proto.cs.EnmResType.ERT_Image) {
// 图片
price = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId);
this.url = girlData.getGrilPhotoPic(
@@ -167,7 +167,7 @@ export class DetailImageItem extends Component {
imgPath = this.url;
this.isImage = true;
isVisible = girlData.isGirlPhotoVisible(this.category.toString(), this.girlId, this.resId);
} else if (type === 2) {
} else if (type === proto.cs.EnmResType.ERT_Video) {
// 视频
price = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId);
this.isImage = false;