聊天相关fix
This commit is contained in:
@@ -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 接口实现 ===
|
||||
|
||||
Reference in New Issue
Block a user