- MVP架构重构聊天逻辑

- 优化聊天气泡体验
- 修复prompt bug
- 实现聊天次数限制功能(未接服务端)
- 实现情绪切视频功能
This commit is contained in:
2025-08-27 16:12:19 +08:00
parent 9004f77e8d
commit e57818d498
27 changed files with 1713 additions and 687 deletions
@@ -5,6 +5,7 @@ import {
Node,
UITransform,
Vec3,
view,
} from "cc";
import { DialogManager } from "../../manager/DialogManager";
import { DialogBubble } from "./DialogBubble";
@@ -31,7 +32,7 @@ export class ChatContentsLayout extends Component {
protected start(): void {
this.lBubble.node.active = false;
this.rBubble.node.active = false;
this.fixMaxWidth = this.node.getComponent(UITransform).contentSize.y * 0.6;
this.fixMaxWidth = view.getVisibleSize().width * 0.8;
}
protected onEnable(): void {
@@ -92,7 +93,7 @@ export class ChatContentsLayout extends Component {
? instantiate(this.rBubble.node)
: instantiate(this.lBubble.node);
newBubble = newBubbleNode.getComponent(DialogBubble);
newBubble.init(this.fixMaxWidth);
newBubble.init();
newBubbleNode.setParent(this.node);
}
@@ -109,7 +110,7 @@ export class ChatContentsLayout extends Component {
if (pendingUpdates === 0) {
updateNextBubble(index - 1);
}
});
}, dialog.isLoading || false);
this.bubbles.push(newBubble);
};