聊天相关fix

This commit is contained in:
2025-09-20 20:37:31 +08:00
parent 86282eec31
commit b8a417632a
22 changed files with 2423 additions and 398 deletions
+14 -4
View File
@@ -73,7 +73,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
categoryId: string;
id: number;
private _nodeTab: any = {};
private waitingAI: Node;
nameKey: string;
private currentEmotion: VideoEmotion | null = null;
@@ -87,6 +87,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
this.waitingAI = this._nodeTab.waitingAI;
// 获取 videoArea 的尺寸和位置
this.targetSize = this.videoArea.contentSize;
this.videoAreaPos = new Vec3(540, 1170, 0);
@@ -150,7 +151,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
async refresh() {
const newRoleId = NavigationManager.Instance.getSelectedGirlId();
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
this.waitingAI.active = false;
// 检查是否是切换角色
const isRoleSwitch = this.id && this.id !== newRoleId;
@@ -399,18 +400,27 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.refresh();
}
isWaiting: boolean = false;
public async OnClickSend() {
const str = this.editBox.string;
if (!str || str == "") {
TipsPanel.show("请输入内容");
TipsPanel.show(LanguageUtils.getText("chat_error_code_1002"));
return;
}
if (this.isWaiting) {
TipsPanel.show(LanguageUtils.getText("chat_error_code_1003"));
}
// 通过ChatController发送消息
this.isWaiting = true;
this.waitingAI.active = true;
const succeed = await this.chatController.sendMessage(str);
if (succeed)
if (succeed) {
// 清空输入框
this.editBox.string = "";
}
this.isWaiting = false;
this.waitingAI.active = false;
}
// === IChatPanelCallback 接口实现 ===