LabelEx.ts 571 B

123456789101112131415161718
  1. import { _decorator, Component, Node, Label } from 'cc';
  2. const { ccclass, property, requireComponent, menu } = _decorator;
  3. @ccclass('LabelEx')
  4. @requireComponent([Label])
  5. @menu('扩展组件/LabelEx')
  6. export class LabelEx extends Component {
  7. @property({ displayName: "对应文本表中的ID" })
  8. private text_id: number = -1;
  9. onLoad() {
  10. let lab = this.getComponent(Label);
  11. if (lab && this.text_id != -1) {
  12. //lab.string = TextConf.getSingle(this.text_id)?.text;
  13. //lab.cacheMode = Label.CacheMode.NONE;
  14. }
  15. }
  16. }