Files
18xchat/assets/Scripts/test/DialogBubble.ts
T
2025-07-21 22:14:06 +08:00

24 lines
610 B
TypeScript

import { _decorator, Component, Label, Node, Size, UITransform } from "cc";
const { ccclass, property } = _decorator;
@ccclass("DialogBubble")
export class DialogBubble extends Component {
@property(UITransform)
bg: UITransform = null;
@property(Label)
content: Label = null;
@property(UITransform)
contentT: UITransform = null;
updateBubbleContent(str: string) {
this.content.string = str;
this.content.updateRenderData();
this.bg.setContentSize(
new Size(this.contentT.contentSize.x + 5, this.contentT.contentSize.y + 5)
);
return this.bg.contentSize.y / 2;
}
}