tong_qian_lab.ts 957 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { _decorator, Component, Node, Label } from 'cc';
  2. import { ClientEvent } from '../clientEvent';
  3. import { Constant } from '../constant';
  4. import { GameMng } from '../GameMng';
  5. import { Tools } from '../Tools';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('tong_qian_lab')
  8. export class tong_qian_lab extends Component {
  9. start() {
  10. ClientEvent.on(Constant.UI_EVENT.UI_MSG_UPDATE_TONG_QIAN,this.onUpdate,this)
  11. }
  12. onDestroy(){
  13. ClientEvent.off(Constant.UI_EVENT.UI_MSG_UPDATE_TONG_QIAN,this.onUpdate,this)
  14. }
  15. onUpdate(){
  16. if( GameMng._userData!=null){
  17. this.getComponent(Label).string = Tools.getTongBiNumber(GameMng._userData.bag.tong_bi);
  18. }
  19. }
  20. onEnable(){
  21. if( GameMng._userData!=null){
  22. this.getComponent(Label).string = Tools.getTongBiNumber(GameMng._userData.bag.tong_bi);
  23. }
  24. }
  25. update(deltaTime: number) {
  26. }
  27. }