cc.Class({ extends: cc.Component, properties: { bgFrames: [cc.SpriteFrame], tabRichText: cc.RichText }, // LIFE-CYCLE CALLBACKS: onLoad () { }, start () { }, init (text) { this.text = text; }, show () { this.getComponent(cc.Button).interactable = false; this.getComponent(cc.Sprite).spriteFrame = this.bgFrames[1]; this.tabRichText.string = `${this.text}`; }, hide () { this.getComponent(cc.Button).interactable = true; this.getComponent(cc.Sprite).spriteFrame = this.bgFrames[0]; this.tabRichText.string = `${this.text}`; }, // update (dt) {}, });