This commit is contained in:
2025-09-21 10:35:27 +08:00
parent 9559e436e6
commit 8e82ebf724
8 changed files with 569 additions and 309 deletions
+5 -10
View File
@@ -194,13 +194,6 @@ export class ChatController {
TipsPanel.show(LanguageUtils.getText("chat_error_code_1004")); TipsPanel.show(LanguageUtils.getText("chat_error_code_1004"));
} }
// 添加用户消息到模型
this.chatModel.addDialog(true, message);
// 更新对话显示 - 用户消息
this.dialogManager?.updateDialog(true, message, true);
this.callback?.onDialogUpdated(true);
// 通知界面消息发送开始 // 通知界面消息发送开始
this.callback?.onMessageSent(message); this.callback?.onMessageSent(message);
@@ -215,12 +208,14 @@ export class ChatController {
); );
if (response) { if (response) {
// 移除加载中的对话 // 添加用户消息到模型
//this.dialogManager?.removeLoadingDialog(); this.chatModel.addDialog(true, message);
// 更新对话显示 - 用户消息
this.dialogManager?.updateDialog(true, message, true);
this.callback?.onDialogUpdated(true);
// 添加AI回复到模型 (保持完整消息) // 添加AI回复到模型 (保持完整消息)
this.chatModel.addDialog(false, response); this.chatModel.addDialog(false, response);
// 更新对话显示 - AI回复 (使用分段显示) // 更新对话显示 - AI回复 (使用分段显示)
this.dialogManager?.updateDialogWithSegments(false, response); this.dialogManager?.updateDialogWithSegments(false, response);
this.callback?.onDialogUpdated(false); this.callback?.onDialogUpdated(false);
@@ -30,7 +30,7 @@ export class ChatContentsLayout extends Component {
// 缓存池 // 缓存池
private cachedBubbles: DialogBubble[] = []; private cachedBubbles: DialogBubble[] = [];
// 等待回复气泡的引用 // 等待回复气泡的引用
private waitingBubble: DialogBubble = null; //private waitingBubble: DialogBubble = null;
// 延时任务ID数组 // 延时任务ID数组
private delayedTasks: number[] = []; private delayedTasks: number[] = [];
// ScrollView组件引用 // ScrollView组件引用
@@ -52,13 +52,22 @@ export class ChatContentsLayout extends Component {
this.fixMaxWidth = 730; this.fixMaxWidth = 730;
// 获取或添加UIOpacity组件到content节点 // 获取或添加UIOpacity组件到content节点
this.contentOpacity = this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity); this.contentOpacity =
this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity);
// 注册触摸事件 // 注册触摸事件
if (this.scrollView && this.scrollView.node) { if (this.scrollView && this.scrollView.node) {
this.scrollView.node.on(NodeEventType.TOUCH_START, this.onTouchStart, this); this.scrollView.node.on(
NodeEventType.TOUCH_START,
this.onTouchStart,
this
);
this.scrollView.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this); this.scrollView.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this);
this.scrollView.node.on(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this); this.scrollView.node.on(
NodeEventType.TOUCH_CANCEL,
this.onTouchEnd,
this
);
} }
} }
@@ -85,11 +94,11 @@ export class ChatContentsLayout extends Component {
this.bubbles.push(playerBubble); this.bubbles.push(playerBubble);
// 创建等待回复气泡(插入到首位,显示在玩家消息上面) // 创建等待回复气泡(插入到首位,显示在玩家消息上面)
this.waitingBubble = this.createOrGetBubble(false); // this.waitingBubble = this.createOrGetBubble(false);
this.waitingBubble.node.active = true; // this.waitingBubble.node.active = true;
this.waitingBubble.updateBubbleContent("...", false, undefined, true); // this.waitingBubble.updateBubbleContent("...", false, undefined, true);
this.waitingBubble.node.setSiblingIndex(0); // this.waitingBubble.node.setSiblingIndex(0);
this.bubbles.push(this.waitingBubble); // this.bubbles.push(this.waitingBubble);
this.node.position = Vec3.ZERO; this.node.position = Vec3.ZERO;
// 滚动到底部(等待下一帧Layout更新完成) // 滚动到底部(等待下一帧Layout更新完成)
this.scheduleOnce(() => { this.scheduleOnce(() => {
@@ -102,9 +111,9 @@ export class ChatContentsLayout extends Component {
*/ */
updateAIDialogs(dialogs: Dialog[]): void { updateAIDialogs(dialogs: Dialog[]): void {
// 清除等待回复气泡 // 清除等待回复气泡
if (this.waitingBubble) { // if (this.waitingBubble) {
this.removeWaitingBubble(); // this.removeWaitingBubble();
} // }
// 清理之前的延时任务 // 清理之前的延时任务
this.clearDelayedTasks(); this.clearDelayedTasks();
@@ -124,7 +133,7 @@ export class ChatContentsLayout extends Component {
} }
} }
this.bubbles = []; this.bubbles = [];
this.waitingBubble = null; //this.waitingBubble = null;
// 清理多余的缓存气泡 // 清理多余的缓存气泡
this.cleanupExcessCachedBubbles(); this.cleanupExcessCachedBubbles();
@@ -164,19 +173,19 @@ export class ChatContentsLayout extends Component {
/** /**
* 移除等待回复气泡 * 移除等待回复气泡
*/ */
private removeWaitingBubble(): void { // private removeWaitingBubble(): void {
if (this.waitingBubble && this.waitingBubble.node) { // if (this.waitingBubble && this.waitingBubble.node) {
this.waitingBubble.node.active = false; // this.waitingBubble.node.active = false;
this.cachedBubbles.push(this.waitingBubble); // this.cachedBubbles.push(this.waitingBubble);
// 从当前气泡列表中移除 // // 从当前气泡列表中移除
const index = this.bubbles.indexOf(this.waitingBubble); // const index = this.bubbles.indexOf(this.waitingBubble);
if (index > -1) { // if (index > -1) {
this.bubbles.splice(index, 1); // this.bubbles.splice(index, 1);
} // }
} // }
this.waitingBubble = null; // this.waitingBubble = null;
} // }
/** /**
* 带延时地添加AI对话 * 带延时地添加AI对话
@@ -316,9 +325,17 @@ export class ChatContentsLayout extends Component {
protected onDestroy(): void { protected onDestroy(): void {
// 清理事件监听 // 清理事件监听
if (this.scrollView && this.scrollView.node) { if (this.scrollView && this.scrollView.node) {
this.scrollView.node.off(NodeEventType.TOUCH_START, this.onTouchStart, this); this.scrollView.node.off(
NodeEventType.TOUCH_START,
this.onTouchStart,
this
);
this.scrollView.node.off(NodeEventType.TOUCH_END, this.onTouchEnd, this); this.scrollView.node.off(NodeEventType.TOUCH_END, this.onTouchEnd, this);
this.scrollView.node.off(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this); this.scrollView.node.off(
NodeEventType.TOUCH_CANCEL,
this.onTouchEnd,
this
);
} }
// 清理计时器 // 清理计时器
@@ -3,13 +3,10 @@ import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import Utils from "db://assets/Scripts/Main/Common/Utils"; import Utils from "db://assets/Scripts/Main/Common/Utils";
import { GButton } from "db://assets/Scripts/Main/Common/GButton"; import { GButton } from "db://assets/Scripts/Main/Common/GButton";
import { GirlListItem } from "../../uiitems/GirlListItem"; import { GirlListItem } from "../../uiitems/GirlListItem";
import { ConfigManager } from "../../manager/ConfigManager";
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService"; import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
import { DataManager, DataId } from "../../data/DataManager"; import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData"; import { GirlData } from "../../data/GirlData";
import proto from "db://assets/Scripts/proto/proto.pb.js"; import proto from "db://assets/Scripts/proto/proto.pb.js";
import GameRootUI from "../../../Main/Common/GameRootUI";
import { UITransitionHelper } from "../../utils/UITransitionHelper";
import { NavigationManager, PanelType } from "../../manager/NavigationManager"; import { NavigationManager, PanelType } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -28,7 +25,6 @@ export class GirlListPanel extends li_BaseView {
private maxPoolSize: number = 20; private maxPoolSize: number = 20;
category: number; category: number;
private parentPanelName: string = null;
onLoadCT() { onLoadCT() {
Utils.parseNode(this.node, this._nodeTab); Utils.parseNode(this.node, this._nodeTab);
@@ -319,11 +319,18 @@ export class ThemePanel extends li_BaseView {
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL); NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
} else { } else {
//未解锁 //未解锁
ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
NavigationManager.Instance.openSubPanel("GirlListPopupPanel", this.node, {
base: this, base: this,
category: girlData.getGrilCategoryById(this.recId), category: girlData.getGrilCategoryById(this.recId),
id: this.recId, id: this.recId,
}); });
// ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
// base: this,
// category: girlData.getGrilCategoryById(this.recId),
// id: this.recId,
// });
} }
} }
@@ -19,6 +19,7 @@ import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData"; import { GirlData } from "../data/GirlData";
import { EnvData } from "../data/EnvData"; import { EnvData } from "../data/EnvData";
import { TipsPanel } from "../ui/panels/TipsPanel"; import { TipsPanel } from "../ui/panels/TipsPanel";
import { NavigationManager } from "../manager/NavigationManager";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -72,13 +73,25 @@ export class DetailImageItem extends Component {
this.base.setVideEnable(false); this.base.setVideEnable(false);
} }
} else { } else {
ViewManager.I.openBundlesView("PopupGirlDetailPanel", { NavigationManager.Instance.openSubPanel(
category: this.category, "PopupGirlDetailPanel",
resId: this.resId, this.base.node,
girlId: this.girlId, {
base: this, category: this.category,
type: this.type, resId: this.resId,
}); girlId: this.girlId,
base: this,
type: this.type,
}
);
// ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
// category: this.category,
// resId: this.resId,
// girlId: this.girlId,
// base: this,
// type: this.type,
// });
} }
// if (!this.isImage) { // if (!this.isImage) {
// //判断是否已经解锁此资源 // //判断是否已经解锁此资源
@@ -216,11 +216,16 @@ export class GirlListItem extends Component {
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL); NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
} else { } else {
//未解锁 //未解锁
ViewManager.I.openBundlesPopupView("GirlListPopupPanel", { NavigationManager.Instance.openSubPanel("GirlListPopupPanel", this.baseNode, {
base: this, base: this,
category: this.category, category: this.category,
id: this.id, id: this.id,
}); });
// ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
// base: this,
// category: this.category,
// id: this.id,
// });
} }
} }
} }
File diff suppressed because it is too large Load Diff
@@ -1624,7 +1624,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 200.56799999999996, "x": 212.63599999999997,
"y": 109.65699999999993, "y": 109.65699999999993,
"z": 0 "z": 0
}, },
@@ -1707,7 +1707,7 @@
"_actualFontSize": 51, "_actualFontSize": 51,
"_fontSize": 50, "_fontSize": 50,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 51.7,
"_overflow": 2, "_overflow": 2,
"_enableWrapText": true, "_enableWrapText": true,
"_font": { "_font": {
@@ -1765,7 +1765,7 @@
"_alignFlags": 33, "_alignFlags": 33,
"_target": null, "_target": null,
"_left": 553.9668125000001, "_left": 553.9668125000001,
"_right": 37.06381250000004, "_right": 24.9958125,
"_top": 25.737000000000087, "_top": 25.737000000000087,
"_bottom": 0, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,