From 532a279088dbf3c42f086991abee8de5a150fbf9 Mon Sep 17 00:00:00 2001 From: chen wei bo <1025839511@qq.com> Date: Wed, 10 Sep 2025 20:58:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B9=E6=B3=95=EF=BC=9A?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=20=E5=9C=A8=E8=81=8A=E5=A4=A9=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E8=A7=A6=E5=8F=91=E6=8A=80=E5=B8=88=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scripts/Main/Config/InnerMsgCode.ts | 5 +++-- assets/Scripts/chat18x/data/GirlChatData.ts | 8 ++++++++ assets/Scripts/chat18x/data/GirlData.ts | 16 ++++++++++++++++ assets/Scripts/chat18x/data/GirlDetailData.ts | 14 ++++++++++++++ proto_cs | 2 +- 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/assets/Scripts/Main/Config/InnerMsgCode.ts b/assets/Scripts/Main/Config/InnerMsgCode.ts index 8d92cf88..c1f1ac73 100644 --- a/assets/Scripts/Main/Config/InnerMsgCode.ts +++ b/assets/Scripts/Main/Config/InnerMsgCode.ts @@ -27,8 +27,9 @@ export enum InnerMsgCode { Chat_EmotionUpdated, SimplePlayVide, LanguageChange, - BalanceChange, // 余额发生变化 - VipExpireChange, // vip失效时间戳发生变化 + BalanceChange, // 余额发生变化 + VipExpireChange, // vip失效时间戳发生变化 + ChatTotalCountChange, // 总聊天次数发生变化 } export enum InnerEventCode { diff --git a/assets/Scripts/chat18x/data/GirlChatData.ts b/assets/Scripts/chat18x/data/GirlChatData.ts index 215ce439..f7f98a23 100644 --- a/assets/Scripts/chat18x/data/GirlChatData.ts +++ b/assets/Scripts/chat18x/data/GirlChatData.ts @@ -3,6 +3,8 @@ */ import { BaseData } from "./BaseData"; import proto from 'db://assets/Scripts/proto/proto.pb.js'; +import Utils from "../../Main/Common/Utils"; +import { InnerMsgCode } from "../../Main/Config/InnerMsgCode"; export class GirlChatData extends BaseData { // id @@ -67,6 +69,12 @@ export class GirlChatData extends BaseData { /** 保存总聊天次数 */ public setChatTotalCount(value: number): void { this.chatTotalCount = value; + // 发出事件 + let msgData = { + girlId: this.id, + chatTotalCount: this.chatTotalCount, + }; + Utils.sendInnerMsg(InnerMsgCode.ChatTotalCountChange, msgData); console.log("当前技师 ", this.id, " ,总聊天次数:", this.chatTotalCount); } diff --git a/assets/Scripts/chat18x/data/GirlData.ts b/assets/Scripts/chat18x/data/GirlData.ts index 9c47d2f1..7aaac116 100644 --- a/assets/Scripts/chat18x/data/GirlData.ts +++ b/assets/Scripts/chat18x/data/GirlData.ts @@ -386,6 +386,22 @@ export class GirlData extends BaseData { return false; } + /** 获取 在聊天中,触发技师图片的id */ + public getTriggerGrilPhotoId(categoryId: string, girlId: number): number { + let oneData = this.getGrilDetail(categoryId, girlId); + if (!oneData) return 0; + // 所有图片 id,展示类型属于在聊天中触发 + let allId = oneData.getAllTriggerGrilPhotoId(); + // 总聊天次数 + let chatTotalCount = this.getChatTotalCount(categoryId, girlId); + // 遍历 + for (let id of allId) { + let count = this.getGrilPhotoUnlockCounts(categoryId, girlId, id); + if (chatTotalCount >= count) return id; + } + return 0; + } + /** 获取第一个技师图片的资源路径 */ public getFirstGrilPhotoPath(categoryId: string, girlId: number): string { let oneData = this.getGrilDetail(categoryId, girlId); diff --git a/assets/Scripts/chat18x/data/GirlDetailData.ts b/assets/Scripts/chat18x/data/GirlDetailData.ts index be35e788..17499726 100644 --- a/assets/Scripts/chat18x/data/GirlDetailData.ts +++ b/assets/Scripts/chat18x/data/GirlDetailData.ts @@ -107,7 +107,21 @@ export class GirlDetailData extends BaseData { } return allId; } + + /** 获取所有技师图片数据的id,展示类型属于在聊天中触发 */ + public getAllTriggerGrilPhotoId(): number[] { + if (!this.photoData) return []; + + // 筛选出类型为 2 的图片 + let triggerPhotos = this.photoData.filter(photo => photo.imageType === 2); + // 按 unlockCounts 从大到小排序 + triggerPhotos.sort((a, b) => b.unlockCounts - a.unlockCounts); + + // 返回排序后的 id 数组 + return triggerPhotos.map(photo => photo.id); + } + /** 获取技师图片数据,通过 id */ private getGrilPhotoData(id: number): proto.cs.IPurchaseCommercialImage | null { if (!this.photoData) return null; diff --git a/proto_cs b/proto_cs index f055100c..02474af6 160000 --- a/proto_cs +++ b/proto_cs @@ -1 +1 @@ -Subproject commit f055100cf0f378ddd96d8e153655b5166c65e6e8 +Subproject commit 02474af62a6831a909fa28fefa83afa382cc86ee