update
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user