fix
设置页面资源
This commit is contained in:
@@ -102,15 +102,19 @@ export class ChatContentsLayout extends Component {
|
||||
newBubble.node.position = new Vec3(pos.x, initPosY, pos.z);
|
||||
|
||||
pendingUpdates++;
|
||||
newBubble.updateBubbleContent(dialog.content, (actualHeight: number) => {
|
||||
initPosY += actualHeight + 20;
|
||||
pendingUpdates--;
|
||||
newBubble.updateBubbleContent(
|
||||
dialog.content,
|
||||
(actualHeight: number) => {
|
||||
initPosY += actualHeight + 40;
|
||||
pendingUpdates--;
|
||||
|
||||
// 当当前气泡更新完成后,处理下一个
|
||||
if (pendingUpdates === 0) {
|
||||
updateNextBubble(index - 1);
|
||||
}
|
||||
}, dialog.isLoading || false);
|
||||
// 当当前气泡更新完成后,处理下一个
|
||||
if (pendingUpdates === 0) {
|
||||
updateNextBubble(index - 1);
|
||||
}
|
||||
},
|
||||
dialog.isLoading || false
|
||||
);
|
||||
|
||||
this.bubbles.push(newBubble);
|
||||
};
|
||||
|
||||
@@ -31,12 +31,16 @@ export class DialogBubble extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
updateBubbleContent(str: string, callback?: (actualHeight: number) => void, isLoading: boolean = false) {
|
||||
updateBubbleContent(
|
||||
str: string,
|
||||
callback?: (actualHeight: number) => void,
|
||||
isLoading: boolean = false
|
||||
) {
|
||||
// 停止之前的加载动画
|
||||
this.stopLoadingAnimation();
|
||||
|
||||
|
||||
this.content.overflow = Overflow.NONE;
|
||||
|
||||
|
||||
// 如果是加载状态,使用固定的"..."
|
||||
if (isLoading && str === "...") {
|
||||
this.content.string = "...";
|
||||
@@ -44,13 +48,13 @@ export class DialogBubble extends Component {
|
||||
const contentWidth = 60;
|
||||
this.contentT.setContentSize(new Size(contentWidth, 40));
|
||||
this.bg.setContentSize(new Size(contentWidth + 30, 50));
|
||||
|
||||
|
||||
if (callback) {
|
||||
callback(40); // 返回固定高度
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 设置文本内容
|
||||
this.content.string = str;
|
||||
|
||||
@@ -75,7 +79,7 @@ export class DialogBubble extends Component {
|
||||
|
||||
// 设置内容区域宽度,让Label自动计算高度
|
||||
this.contentT.setContentSize(new Size(contentWidth, 0));
|
||||
this.bg.setContentSize(new Size(contentWidth + 17, 0));
|
||||
this.bg.setContentSize(new Size(contentWidth + 37, 0));
|
||||
|
||||
// 强制更新Label的渲染数据以获取正确的高度
|
||||
this.content.updateRenderData(true);
|
||||
@@ -90,7 +94,7 @@ export class DialogBubble extends Component {
|
||||
|
||||
// 根据内容大小调整背景大小,添加适当的内边距
|
||||
//const bgHeight = actualHeight + 17;
|
||||
this.bg.setContentSize(new Size(actualSize.x + 30, actualSize.y + 10));
|
||||
this.bg.setContentSize(new Size(actualSize.x + 40, actualSize.y + 30));
|
||||
|
||||
// 回调通知实际高度
|
||||
if (callback) {
|
||||
|
||||
Reference in New Issue
Block a user