import NumberToImage from "./NumberToImage"; const { ccclass, property, requireComponent } = cc._decorator; @ccclass export default class Uid extends cc.Component { static _instance: any; @property(cc.Label) uid_Number: cc.Label = null; onLoad() { // 为节点添加点击事件监听器 if (Uid._instance == null) { Uid._instance = this; cc.game.addPersistRootNode(this.node); } else { return; } if (cc.fx.GameConfig.GM_INFO.userId > 0) { this.uid_Number.string = cc.fx.GameConfig.GM_INFO.userId + ""; } } start() { // ... 已有代码 ... } }