测试反馈修复

This commit is contained in:
2025-09-23 11:23:17 +08:00
parent e5c2c4f7ed
commit 568d360f49
7 changed files with 938 additions and 701 deletions
+120 -25
View File
@@ -402,7 +402,11 @@ export class GirlData extends BaseData {
} }
/** 用来展示在列表的技师图片是否可见 */ /** 用来展示在列表的技师图片是否可见 */
public isGirlPhotoVisible(categoryId: string, girlId: number, id: number): boolean { public isGirlPhotoVisible(
categoryId: string,
girlId: number,
id: number
): boolean {
// 免费 // 免费
const isFreeType = this.isGirlPhotoFreeType(categoryId, girlId, id); const isFreeType = this.isGirlPhotoFreeType(categoryId, girlId, id);
// 付费 // 付费
@@ -442,7 +446,7 @@ export class GirlData extends BaseData {
// 遍历 // 遍历
for (let id of allId) { for (let id of allId) {
let count = this.getGrilPhotoUnlockCounts(categoryId, girlId, id); let count = this.getGrilPhotoUnlockCounts(categoryId, girlId, id);
if (chatTotalCount >= count) return id; if (chatTotalCount == count) return id;
} }
return 0; return 0;
} }
@@ -460,21 +464,33 @@ export class GirlData extends BaseData {
} }
/** 图片展示类型:在详情页展示 */ /** 图片展示类型:在详情页展示 */
public isGirlPhotoShowInList(categoryId: string, girlId: number, id: number): boolean { public isGirlPhotoShowInList(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilDetail(categoryId, girlId); let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return false; if (!oneData) return false;
return oneData.isGirlPhotoShowInList(id); return oneData.isGirlPhotoShowInList(id);
} }
/** 图片展示类型:在聊天触发 */ /** 图片展示类型:在聊天触发 */
public isGirlPhotoShowInChat(categoryId: string, girlId: number, id: number): boolean { public isGirlPhotoShowInChat(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilDetail(categoryId, girlId); let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return false; if (!oneData) return false;
return oneData.isGirlPhotoShowInChat(id); return oneData.isGirlPhotoShowInChat(id);
} }
/** 图片是否免费 */ /** 图片是否免费 */
public isGirlPhotoFreeType(categoryId: string, girlId: number, id: number): boolean { public isGirlPhotoFreeType(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilDetail(categoryId, girlId); let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return false; if (!oneData) return false;
// 价格 // 价格
@@ -483,7 +499,11 @@ export class GirlData extends BaseData {
} }
/** 图片是否需要付费 */ /** 图片是否需要付费 */
public isGirlPhotoPayType(categoryId: string, girlId: number, id: number): boolean { public isGirlPhotoPayType(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilDetail(categoryId, girlId); let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return true; if (!oneData) return true;
// 价格 // 价格
@@ -571,7 +591,11 @@ export class GirlData extends BaseData {
} }
/** 用来展示在列表的技师视频是否可见 */ /** 用来展示在列表的技师视频是否可见 */
public isGirlVideoVisible(categoryId: string, girlId: number, id: number): boolean { public isGirlVideoVisible(
categoryId: string,
girlId: number,
id: number
): boolean {
// 免费 // 免费
const isFreeType = this.isGirlVideoFreeType(categoryId, girlId, id); const isFreeType = this.isGirlVideoFreeType(categoryId, girlId, id);
// 付费 // 付费
@@ -590,7 +614,11 @@ export class GirlData extends BaseData {
} }
/** 视频是否免费 */ /** 视频是否免费 */
public isGirlVideoFreeType(categoryId: string, girlId: number, id: number): boolean { public isGirlVideoFreeType(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilDetail(categoryId, girlId); let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return false; if (!oneData) return false;
// 价格 // 价格
@@ -599,7 +627,11 @@ export class GirlData extends BaseData {
} }
/** 视频是否需要付费 */ /** 视频是否需要付费 */
public isGirlVideoPayType(categoryId: string, girlId: number, id: number): boolean { public isGirlVideoPayType(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilDetail(categoryId, girlId); let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return true; if (!oneData) return true;
// 价格 // 价格
@@ -667,7 +699,13 @@ export class GirlData extends BaseData {
/** --------------------------------------------------------- 技师的解锁数据 --------------------------------------------------------- */ /** --------------------------------------------------------- 技师的解锁数据 --------------------------------------------------------- */
// 创建一个技师解锁数据 // 创建一个技师解锁数据
private createOneGirlUnlock(id: number, isRelease: boolean, unlockTime: number, unlockedImageIds: number[], unlockedVideoIds: number[]): GirlUnlockData { private createOneGirlUnlock(
id: number,
isRelease: boolean,
unlockTime: number,
unlockedImageIds: number[],
unlockedVideoIds: number[]
): GirlUnlockData {
let oneData = new GirlUnlockData(); let oneData = new GirlUnlockData();
oneData.init?.(DataId.GirlUnlock); oneData.init?.(DataId.GirlUnlock);
oneData.setId(id); oneData.setId(id);
@@ -697,7 +735,13 @@ export class GirlData extends BaseData {
unlockedVideoIds.push(one.resId); unlockedVideoIds.push(one.resId);
} }
} }
let oneData = this.createOneGirlUnlock(data.id, data.isRelease, Number(data.unlockTime), unlockedImageIds, unlockedVideoIds); let oneData = this.createOneGirlUnlock(
data.id,
data.isRelease,
Number(data.unlockTime),
unlockedImageIds,
unlockedVideoIds
);
return oneData; return oneData;
} }
@@ -726,7 +770,13 @@ export class GirlData extends BaseData {
} else { } else {
// 不存在数据,创建 // 不存在数据,创建
const bucket = this.ensureBucket(categoryId.toString()); const bucket = this.ensureBucket(categoryId.toString());
let oneData = this.createOneGirlUnlock(data.id, data.isRelease, Number(data.unlockTime), [], []); let oneData = this.createOneGirlUnlock(
data.id,
data.isRelease,
Number(data.unlockTime),
[],
[]
);
if (oneData) { if (oneData) {
bucket.unlocks.set(data.id, oneData); bucket.unlocks.set(data.id, oneData);
} }
@@ -776,7 +826,11 @@ export class GirlData extends BaseData {
} }
/** 保存 角色解锁时间,时间戳,秒 */ /** 保存 角色解锁时间,时间戳,秒 */
public setUnlockTime(categoryId: string, girlId: number, value: number): void { public setUnlockTime(
categoryId: string,
girlId: number,
value: number
): void {
let oneData = this.getGrilUnlock(categoryId, girlId); let oneData = this.getGrilUnlock(categoryId, girlId);
if (!oneData) return; if (!oneData) return;
oneData.setUnlockTime(value); oneData.setUnlockTime(value);
@@ -853,7 +907,11 @@ export class GirlData extends BaseData {
/** --------------------------------------------------------- 技师的聊天数据 --------------------------------------------------------- */ /** --------------------------------------------------------- 技师的聊天数据 --------------------------------------------------------- */
// 创建一个技师聊天数据 // 创建一个技师聊天数据
private createOneGirlChat(id: number, chatTotalCount: number, chatRemainCount: number): GirlChatData { private createOneGirlChat(
id: number,
chatTotalCount: number,
chatRemainCount: number
): GirlChatData {
let oneData = new GirlChatData(); let oneData = new GirlChatData();
oneData.init?.(DataId.GirlChat); oneData.init?.(DataId.GirlChat);
oneData.setId(id); oneData.setId(id);
@@ -865,7 +923,11 @@ export class GirlData extends BaseData {
// 解析技师聊天数据,一个 // 解析技师聊天数据,一个
private parseOneGirlChat(data: proto.cs.IGirlData): GirlChatData | null { private parseOneGirlChat(data: proto.cs.IGirlData): GirlChatData | null {
if (!data) return null; if (!data) return null;
let oneData = this.createOneGirlChat(data.id, data.chatTotalCount, data.chatRemainCount); let oneData = this.createOneGirlChat(
data.id,
data.chatTotalCount,
data.chatRemainCount
);
return oneData; return oneData;
} }
@@ -895,7 +957,11 @@ export class GirlData extends BaseData {
} else { } else {
// 不存在数据,创建 // 不存在数据,创建
const bucket = this.ensureBucket(categoryId.toString()); const bucket = this.ensureBucket(categoryId.toString());
let oneData = this.createOneGirlChat(data.id, data.chatTotalCount, data.chatRemainCount); let oneData = this.createOneGirlChat(
data.id,
data.chatTotalCount,
data.chatRemainCount
);
if (oneData) { if (oneData) {
oneData.setChatRecord(data.msgs); oneData.setChatRecord(data.msgs);
bucket.chats.set(data.id, oneData); bucket.chats.set(data.id, oneData);
@@ -968,7 +1034,11 @@ export class GirlData extends BaseData {
} }
/** 保存聊天记录 */ /** 保存聊天记录 */
public setChatRecord(categoryId: string, girlId: number, data: proto.cs.IChatMsg[]): void { public setChatRecord(
categoryId: string,
girlId: number,
data: proto.cs.IChatMsg[]
): void {
let oneData = this.getGrilChat(categoryId, girlId); let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return; if (!oneData) return;
oneData.setChatRecord(data); oneData.setChatRecord(data);
@@ -982,28 +1052,42 @@ export class GirlData extends BaseData {
} }
/** 获取最新的聊天记录的id */ /** 获取最新的聊天记录的id */
public getLatestChatRecordId(categoryId: string, girlId: number): number | null { public getLatestChatRecordId(
categoryId: string,
girlId: number
): number | null {
let oneData = this.getGrilChat(categoryId, girlId); let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return null; if (!oneData) return null;
return oneData.getLatestChatRecordId(); return oneData.getLatestChatRecordId();
} }
/** 获取最新的聊天记录的时间戳(毫秒) */ /** 获取最新的聊天记录的时间戳(毫秒) */
public getLatestChatRecordTimestamp(categoryId: string, girlId: number): number | null { public getLatestChatRecordTimestamp(
categoryId: string,
girlId: number
): number | null {
let oneData = this.getGrilChat(categoryId, girlId); let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return null; if (!oneData) return null;
return oneData.getLatestChatRecordTimestamp(); return oneData.getLatestChatRecordTimestamp();
} }
/** 获取聊天记录,根据 id,是否是 ai 聊天数据 */ /** 获取聊天记录,根据 id,是否是 ai 聊天数据 */
public getChatRecordIsAi(categoryId: string, girlId: number, id: number): boolean { public getChatRecordIsAi(
categoryId: string,
girlId: number,
id: number
): boolean {
let oneData = this.getGrilChat(categoryId, girlId); let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return false; if (!oneData) return false;
return oneData.getChatRecordIsAi(id); return oneData.getChatRecordIsAi(id);
} }
/** 获取聊天记录,根据 id,聊天内容 */ /** 获取聊天记录,根据 id,聊天内容 */
public getChatRecordMsg(categoryId: string, girlId: number, id: number): string { public getChatRecordMsg(
categoryId: string,
girlId: number,
id: number
): string {
let oneData = this.getGrilChat(categoryId, girlId); let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return ""; if (!oneData) return "";
return oneData.getChatRecordMsg(id); return oneData.getChatRecordMsg(id);
@@ -1071,7 +1155,10 @@ export class GirlData extends BaseData {
/** --------------------------------------------------------- 技师的好感度数据 --------------------------------------------------------- */ /** --------------------------------------------------------- 技师的好感度数据 --------------------------------------------------------- */
// 创建一个技师好感度数据 // 创建一个技师好感度数据
private createOneGirlFavorability(id: number, star: number): GirlFavorabilityData { private createOneGirlFavorability(
id: number,
star: number
): GirlFavorabilityData {
let oneData = new GirlFavorabilityData(); let oneData = new GirlFavorabilityData();
oneData.init?.(DataId.GirlFavorability); oneData.init?.(DataId.GirlFavorability);
oneData.setId(id); oneData.setId(id);
@@ -1080,14 +1167,19 @@ export class GirlData extends BaseData {
} }
// 解析技师好感度数据,一个 // 解析技师好感度数据,一个
private parseOneGirlFavorability(data: proto.cs.IGirlData): GirlFavorabilityData | null { private parseOneGirlFavorability(
data: proto.cs.IGirlData
): GirlFavorabilityData | null {
if (!data) return null; if (!data) return null;
let oneData = this.createOneGirlFavorability(data.id, data.star); let oneData = this.createOneGirlFavorability(data.id, data.star);
return oneData; return oneData;
} }
/** 保存技师的好感度数据 */ /** 保存技师的好感度数据 */
private setGirlFavorability(categoryId: string,data: proto.cs.IGirlData[]): void { private setGirlFavorability(
categoryId: string,
data: proto.cs.IGirlData[]
): void {
if (!data) return; if (!data) return;
const bucket = this.ensureBucket(categoryId); const bucket = this.ensureBucket(categoryId);
for (const g of data) { for (const g of data) {
@@ -1118,7 +1210,10 @@ export class GirlData extends BaseData {
} }
/** 取某分类 + girlId 的好感度数据 */ /** 取某分类 + girlId 的好感度数据 */
private getGrilFavorability(categoryId: string,girlId: number): GirlFavorabilityData | null { private getGrilFavorability(
categoryId: string,
girlId: number
): GirlFavorabilityData | null {
const b = this.ensureCategories().get(categoryId); const b = this.ensureCategories().get(categoryId);
if (!b) return null; if (!b) return null;
return b.favorability.get(girlId) ?? null; return b.favorability.get(girlId) ?? null;
@@ -286,6 +286,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
let triggerId = girlData.getTriggerGrilPhotoId(this.categoryId, this.id); let triggerId = girlData.getTriggerGrilPhotoId(this.categoryId, this.id);
if (triggerId == 0) return; if (triggerId == 0) return;
logger.log("Trigger pop up Image id:" + this.id + "--" + triggerId); logger.log("Trigger pop up Image id:" + this.id + "--" + triggerId);
this.popUpImage.refresh(this.categoryId, this.id, triggerId); this.popUpImage.refresh(this.categoryId, this.id, triggerId);
@@ -8,6 +8,8 @@ import {
Size, Size,
Vec3, Vec3,
tween, tween,
view,
screen,
} from "cc"; } from "cc";
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView"; import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import ResManager from "db://assets/Scripts/Main/Manager/ResManager"; import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
@@ -82,12 +84,30 @@ export class GirlDetailPanel extends li_BaseView {
@property(Node) @property(Node)
sendMsgText: Node; sendMsgText: Node;
private _nodeTab: any = {};
ImgVidSelect: Node;
ImgVidFakePos: Node;
// 跟随控制相关属性
private isFollowing: boolean = true; // 当前是否处于跟随状态
private lastFakePosPosition: Vec3 = new Vec3(); // 记录上次的位置
protected onEnable(): void { protected onEnable(): void {
this.refresh(); this.refresh();
} }
onLoadCT() { onLoadCT() {
super.onLoadCT(); super.onLoadCT();
Utils.parseNode(this.node, this._nodeTab);
this.ImgVidSelect = this._nodeTab.ImgVidSelect;
this.ImgVidFakePos = this._nodeTab.ImgVidFakePos;
// 初始化位置跟随
if (this.ImgVidFakePos) {
this.lastFakePosPosition = this.ImgVidFakePos.position.clone();
}
DetailImageItemPool.Instance.setTemplate(this.imgItemInst.node); DetailImageItemPool.Instance.setTemplate(this.imgItemInst.node);
@@ -360,6 +380,75 @@ export class GirlDetailPanel extends li_BaseView {
super.onClose(); super.onClose();
} }
/**
* 检测节点是否在屏幕可见区域内
* @param node 要检测的节点
* @returns 是否在屏幕内
*/
private isNodeInScreen(node: Node): boolean {
if (!node) return false;
const uiTransform = node.getComponent(UITransform);
if (!uiTransform) return false;
// 获取屏幕尺寸
const screenSize = screen.windowSize;
const designResolution = view.getDesignResolutionSize();
// 获取节点的世界坐标
const worldPos = uiTransform.convertToWorldSpaceAR(Vec3.ZERO);
// 获取节点的尺寸
const nodeSize = uiTransform.contentSize;
// 计算节点的边界
const left = worldPos.x - nodeSize.width * uiTransform.anchorX;
const right = worldPos.x + nodeSize.width * (1 - uiTransform.anchorX);
const bottom = worldPos.y - nodeSize.height * uiTransform.anchorY;
const top = worldPos.y + nodeSize.height * (1 - uiTransform.anchorY);
// 检测是否完全在屏幕内
const isInScreen =
left >= 0 &&
right <= designResolution.width &&
bottom >= 0 &&
top <= designResolution.height - 160;
return isInScreen;
}
/**
* 实时更新ImgVidSelect跟随ImgVidFakePos的逻辑
*/
lateUpdate(dt: number) {
if (!this.ImgVidSelect || !this.ImgVidFakePos) {
return;
}
// 检测ImgVidFakePos是否在屏幕内
const isInScreen = this.isNodeInScreen(this.ImgVidFakePos);
if (isInScreen) {
// 在屏幕内,开始或继续跟随
if (!this.isFollowing) {
this.isFollowing = true;
logger.log("ImgVidSelect开始跟随ImgVidFakePos");
}
// 更新ImgVidSelect的位置到ImgVidFakePos的位置
this.ImgVidSelect.worldPosition =
this.ImgVidFakePos.worldPosition.clone();
this.lastFakePosPosition = this.ImgVidFakePos.worldPosition.clone();
} else {
// 超出屏幕,停止跟随
if (this.isFollowing) {
this.isFollowing = false;
logger.log("ImgVidSelect停止跟随ImgVidFakePos(超出屏幕)");
// ImgVidSelect保持在最后的跟随位置
}
}
}
/** /**
* 面板销毁时的清理工作 * 面板销毁时的清理工作
*/ */
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -4062,7 +4062,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "ENT_BEP", "_name": "ENT_ETH",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@@ -4511,7 +4511,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "ENT_ETH", "_name": "ENT_BEP",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
Binary file not shown.