From 34d07ec143a1fd4f49a2f7d4c9230372274428f8 Mon Sep 17 00:00:00 2001 From: xlj <543978819@qq.com> Date: Tue, 14 Oct 2025 11:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=95=B0=E6=8D=AEbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scripts/chat18x/core/ChatController.ts | 10 +++++++++- assets/Scripts/chat18x/ui/panels/ChatPanel.ts | 16 ++++++++++++++- .../chat18x/ui/panels/GirlDetailPanel.ts | 3 +-- .../Scripts/chat18x/ui/panels/SettingPanel.ts | 2 +- assets/bundles/Chat18x/ChatPanel.prefab | 20 +++++++++---------- 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/assets/Scripts/chat18x/core/ChatController.ts b/assets/Scripts/chat18x/core/ChatController.ts index fa9a8717..33eccd0f 100644 --- a/assets/Scripts/chat18x/core/ChatController.ts +++ b/assets/Scripts/chat18x/core/ChatController.ts @@ -10,6 +10,10 @@ import { InnerMsgCode } from "../../Main/Config/InnerMsgCode"; import { TipsPanel } from "../ui/panels/TipsPanel"; import LanguageUtils from "../../Main/Common/LanguageUtils"; import { logger } from "db://assets/Scripts/Main/Common/Logger"; +import { GirlService } from "../network/services/GirlService"; +import { DataManager, DataId } from "../data/DataManager"; +import { GirlData } from "../data/GirlData"; +import proto from "db://assets/Scripts/proto/proto.pb.js"; /** * 聊天控制器接口 - 定义Panel和Controller之间的通信协议 @@ -152,12 +156,16 @@ export class ChatController { * @param roleId 角色ID * @returns 是否切换成功 */ - public switchRole(categoryId: string, roleId: number): boolean { + public async switchRole( + categoryId: string, + roleId: number + ): Promise { if (!this.chatModel.switchToRole(categoryId, roleId)) { logger.error(`Failed to switch to role ${roleId}`); return false; } + // 更新AI服务的当前角色 ChatAIService.Instance.setCurrentRole(roleId); diff --git a/assets/Scripts/chat18x/ui/panels/ChatPanel.ts b/assets/Scripts/chat18x/ui/panels/ChatPanel.ts index f765bcb1..8a93471c 100644 --- a/assets/Scripts/chat18x/ui/panels/ChatPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/ChatPanel.ts @@ -155,8 +155,10 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback { } } async refresh() { - const newRoleId = NavigationManager.Instance.getSelectedGirlId(); + // 请求详细数据 const girlData = DataManager.I.getDataById(DataId.Girl); + + const newRoleId = NavigationManager.Instance.getSelectedGirlId(); this.waitingAI.active = false; // 检查是否是切换角色 const isRoleSwitch = this.id && this.id !== newRoleId; @@ -165,6 +167,18 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback { this.categoryId = NavigationManager.Instance.getSelectedCategoryId().toString(); + const detail = girlData.getGrilDetail(this.categoryId, this.id); + if (!detail) { + const reqData = { + id: this.id, + }; + let res = await GirlService.I.reqGetGirlDetail(reqData); + if (res && res.code === proto.cs.EnmRetCode.SUCCESS) { + // 保存数据 + girlData.setGirlDetailData(this.categoryId.toString(), res.data); + } + } + // 获取ChatController单例并绑定当前Panel this.chatController = ChatController.Instance; this.chatController.bindView(this); diff --git a/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts b/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts index 6c2b9c13..19902177 100644 --- a/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts @@ -326,8 +326,7 @@ export class GirlDetailPanel extends li_BaseView { OnClickChatBtn() { const girlData = DataManager.I.getDataById(DataId.Girl); - const isRelease = girlData.getIsRelease(this.category.toString(), this.id); - const isFree = girlData.isGirlFreeType(this.category.toString(), this.id); + //if (isRelease || isFree) { // 直接在当前页面打开ChatPanel作为子页面 const currentPanel = NavigationManager.Instance.getCurrentActivePanelNode(); diff --git a/assets/Scripts/chat18x/ui/panels/SettingPanel.ts b/assets/Scripts/chat18x/ui/panels/SettingPanel.ts index 9fb68dbe..05223abe 100644 --- a/assets/Scripts/chat18x/ui/panels/SettingPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/SettingPanel.ts @@ -278,6 +278,6 @@ export class SettingPanel extends li_BaseView { } onClickClose() { - NavigationManager.Instance.closeSubPanel(this); + NavigationManager.Instance.closePopupPanel(this.node); } } diff --git a/assets/bundles/Chat18x/ChatPanel.prefab b/assets/bundles/Chat18x/ChatPanel.prefab index a8d1efbf..5f00295b 100644 --- a/assets/bundles/Chat18x/ChatPanel.prefab +++ b/assets/bundles/Chat18x/ChatPanel.prefab @@ -1337,7 +1337,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 123.22400000000005, + "y": 75.25150000000004, "z": 0 }, "_lrot": { @@ -1386,8 +1386,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 487.9770000000001, - "y": -383.09000000000003, + "x": 149.128, + "y": -537.486, "z": 0 }, "_lrot": { @@ -1456,9 +1456,9 @@ "_alignFlags": 36, "_target": null, "_left": 0, - "_right": 52.02299999999991, + "_right": 390.872, "_top": 0, - "_bottom": 73.75999999999999, + "_bottom": 38.46249999999998, "_horizontalCenter": 0, "_verticalCenter": 0, "_isAbsLeft": true, @@ -1524,7 +1524,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -456.85, + "y": -575.9485, "z": 0 }, "_lrot": { @@ -3733,7 +3733,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 1080, - "height": 913.7 + "height": 1151.897 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -3878,7 +3878,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 1080, - "height": 913.7 + "height": 1151.897 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -3949,8 +3949,8 @@ "_target": null, "_left": 0, "_right": 0, - "_top": 219.92599999999993, - "_bottom": 466.374, + "_top": 148.80000000000007, + "_bottom": 299.30300000000005, "_horizontalCenter": 0, "_verticalCenter": 0, "_isAbsLeft": true,