import { _decorator, Component, Node, Label } from 'cc'; import { ClientEvent } from '../clientEvent'; import { Constant } from '../constant'; import { GameMng } from '../GameMng'; import { Tools } from '../Tools'; const { ccclass, property } = _decorator; @ccclass('tong_qian_lab') export class tong_qian_lab extends Component { start() { ClientEvent.on(Constant.UI_EVENT.UI_MSG_UPDATE_TONG_QIAN,this.onUpdate,this) } onDestroy(){ ClientEvent.off(Constant.UI_EVENT.UI_MSG_UPDATE_TONG_QIAN,this.onUpdate,this) } onUpdate(){ if( GameMng._userData!=null){ this.getComponent(Label).string = Tools.getTongBiNumber(GameMng._userData.bag.tong_bi); } } onEnable(){ if( GameMng._userData!=null){ this.getComponent(Label).string = Tools.getTongBiNumber(GameMng._userData.bag.tong_bi); } } update(deltaTime: number) { } }