import EventMgr from "../../FrameWork/Event/EventMgr"; import { ryw_Event } from "../../FrameWork/Event/EventEnum"; import Common5 from "../../Platform/th/Common5"; import User from "../../FrameWork/User/User"; const {ccclass, property} = cc._decorator; @ccclass export default class ZuanShi extends cc.Component { @property(cc.Node) yuanBaoNumStr: cc.Node = null; @property(cc.Node) changeLabel: cc.Node = null; onLoad () { this.showMoney(); EventMgr.onEvent_custom(ryw_Event.updateZuanShi,(money)=>{ console.log('updateMoney++++++++') this.showMoney(); if(money == 0){ return } // let label = cc.instantiate(this.changeLabel) // label.active = true // label.parent = this.changeLabel.parent // if(money>0){ // label.getComponent(cc.Label).string = "+"+Common5.getNumberChangeHanzi(money,'1',1) // }else if(money<0){ // label.getComponent(cc.Label).string = Common5.getNumberChangeHanzi(money,'1',1)+'' // } // cc.tween(label) // .delay(0.5) // .by(0.8,{y:20,opacity:0}) // .call(()=>{ // label.removeFromParent() // }) // .start() },this) } start () { } showMoney(){ let aaa = Common5.getNumberChangeHanzi( User.getZuanShi() ,'1') aaa = aaa as string this.yuanBaoNumStr.getComponent(cc.Label).string = aaa; } }