diff --git a/assets/Scripts/chat18x/data/GirlData.ts b/assets/Scripts/chat18x/data/GirlData.ts index 887a769a..e417b5bc 100644 --- a/assets/Scripts/chat18x/data/GirlData.ts +++ b/assets/Scripts/chat18x/data/GirlData.ts @@ -285,19 +285,52 @@ export class GirlData extends BaseData { return oneData.getAllGrilPhotoDataCount(); } - /** 获取所有技师图片数据的id */ - public getAllGrilPhotoDataId(categoryId: string, girlId: number): number[] { + /** 获取所有技师图片的id */ + public getAllGrilPhotoId(categoryId: string, girlId: number): number[] { let oneData = this.getGrilDetail(categoryId, girlId); if (!oneData) return []; - return oneData.getAllGrilPhotoDataId(); - } + return oneData.getAllGrilPhotoId(); + } + + /** 获取所有用来展示在列表的技师图片的id */ + public getAllDisplayGrilPhotoId(categoryId: string, girlId: number): number[] { + let oneData = this.getGrilDetail(categoryId, girlId); + if (!oneData) return []; + // 所有id + let allId = oneData.getAllGrilPhotoId(); + // 总聊天次数 + let chatTotalCount = this.getChatTotalCount(categoryId, girlId); + // 用来展示的id + let displayIds = []; + for (let id of allId) { + let unlockCounts = oneData.getGrilPhotoUnlockCounts(id); + let price = oneData.getGrilPhotoPrice(id); + if (price <= 0) { + // 价格为0,代表免费 + displayIds.push(id); + } else { + // 价格大于0,代表付费 + let isUnlock = this.isImageUnlock(categoryId, girlId, id); + if (isUnlock) { + // 已经解锁 + displayIds.push(id); + } else { + // 总聊天次数 大于等于 触发次数 + if (chatTotalCount >= unlockCounts) { + displayIds.push(id); + } + } + } + } + return displayIds; + } /** 获取第一个技师图片的资源路径 */ public getFirstGrilPhotoPath(categoryId: string, girlId: number): string { let oneData = this.getGrilDetail(categoryId, girlId); if (!oneData) return ""; // 第一个 id - const ids = this.getAllGrilPhotoDataId(categoryId, girlId); + const ids = this.getAllGrilPhotoId(categoryId, girlId); const length = ids.length; if (length <= 0) return ""; // 返回数据 @@ -339,19 +372,44 @@ export class GirlData extends BaseData { return oneData.getAllGrilVideoDataCount(); } - /** 获取所有技师视频数据的id */ - public getAllGrilVideoDataId(categoryId: string, girlId: number): number[] { + /** 获取所有技师视频的id */ + public getAllGrilVideoId(categoryId: string, girlId: number): number[] { let oneData = this.getGrilDetail(categoryId, girlId); if (!oneData) return []; - return oneData.getAllGrilVideoDataId(); + return oneData.getAllGrilVideoId(); } + + /** 获取所有用来展示在列表的技师视频的id */ + public getAllDisplayGrilVideoId(categoryId: string, girlId: number): number[] { + let oneData = this.getGrilDetail(categoryId, girlId); + if (!oneData) return []; + // 所有id + let allId = oneData.getAllGrilVideoId(); + // 用来展示的id + let displayIds = []; + for (let id of allId) { + let price = oneData.getGrilVideoPrice(id); + if (price <= 0) { + // 价格为0,代表免费 + displayIds.push(id); + } else { + // 价格大于0,代表付费 + let isUnlock = this.isVideoUnlock(categoryId, girlId, id); + if (isUnlock) { + // 已经解锁 + displayIds.push(id); + } + } + } + return displayIds; + } /** 获取第一个技师视频的资源路径 */ public getFirstGrilVideoPath(categoryId: string, girlId: number): string { let oneData = this.getGrilDetail(categoryId, girlId); if (!oneData) return ""; // 第一个 id - const ids = this.getAllGrilVideoDataId(categoryId, girlId); + const ids = this.getAllGrilVideoId(categoryId, girlId); const length = ids.length; if (length <= 0) return ""; // 返回数据 diff --git a/assets/Scripts/chat18x/data/GirlDetailData.ts b/assets/Scripts/chat18x/data/GirlDetailData.ts index 43cc5fb1..85b617b5 100644 --- a/assets/Scripts/chat18x/data/GirlDetailData.ts +++ b/assets/Scripts/chat18x/data/GirlDetailData.ts @@ -98,7 +98,7 @@ export class GirlDetailData extends BaseData { } /** 获取所有技师图片数据的id */ - public getAllGrilPhotoDataId(): number[] { + public getAllGrilPhotoId(): number[] { if (!this.photoData) return []; // 获取所有 id let allId = []; @@ -182,7 +182,7 @@ export class GirlDetailData extends BaseData { } /** 获取所有技师视频数据的id */ - public getAllGrilVideoDataId(): number[] { + public getAllGrilVideoId(): number[] { if (!this.videoData) return []; // 获取所有 id let allId = []; diff --git a/assets/Scripts/chat18x/network/services/MockGirlService.ts b/assets/Scripts/chat18x/network/services/MockGirlService.ts index a444d05e..511d2bde 100644 --- a/assets/Scripts/chat18x/network/services/MockGirlService.ts +++ b/assets/Scripts/chat18x/network/services/MockGirlService.ts @@ -198,12 +198,14 @@ export class MockGirlService implements IGirlService { } // 详细数据 let detail = this.genDetail(girlId, detailDesc, photoData, videoData); - // 图片解锁数据 + // 付费图片解锁数据 let unlockImageData: proto.cs.IResourceUnlock[] = []; for (let id of photoIds) { + // 价格大于0才为付费 + let imagePrice = girlDetailConfig.getImagePriceById(girlId, id); // 偶数才解锁 let isUnlock = (id % 2 === 0); - if (isUnlock) { + if (imagePrice > 0 && isUnlock) { let oneData = { girlId: girlId, resId: id, @@ -211,12 +213,14 @@ export class MockGirlService implements IGirlService { unlockImageData.push(oneData); } } - // 视频解锁数据 + // 付费视频解锁数据 let unlockVideoData: proto.cs.IResourceUnlock[] = []; for (let id of videoIds) { + // 价格大于0才为付费 + let videoPrice = girlDetailConfig.getVideoPriceById(girlId, id); // 偶数才解锁 let isUnlock = (id % 2 === 0); - if (isUnlock) { + if (videoPrice > 0 && isUnlock) { let oneData = { girlId: girlId, resId: id, diff --git a/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts b/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts index e9ab1ada..1f531d68 100644 --- a/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts @@ -173,7 +173,7 @@ export class GirlDetailPanel extends li_BaseView { "Chat18x" ); - let resIds = girlData.getAllGrilPhotoDataId(this.category.toString(), this.id); + let resIds = girlData.getAllDisplayGrilPhotoId(this.category.toString(), this.id); // 也立即尝试调整(以防已经加载完成) this.adjustVideoScale(); this.refreshImgs(1, this.category, this.id, resIds); @@ -182,13 +182,13 @@ export class GirlDetailPanel extends li_BaseView { bindImgToggle() { const girlData = DataManager.I.getDataById(DataId.Girl); - let resIds = girlData.getAllGrilPhotoDataId(this.category.toString(), this.id); + let resIds = girlData.getAllDisplayGrilPhotoId(this.category.toString(), this.id); this.refreshImgs(1, this.category, this.id, resIds); } bindVideoToggle() { const girlData = DataManager.I.getDataById(DataId.Girl); - let resIds = girlData.getAllGrilVideoDataId(this.category.toString(), this.id); + let resIds = girlData.getAllDisplayGrilVideoId(this.category.toString(), this.id); this.refreshImgs(2, this.category, this.id, resIds); }