You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.7 KiB
69 lines
1.7 KiB
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
|
|
import UserManager from "../Manager/UserManager";
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
|
|
@ccclass
|
|
export default class YuanBao2 extends cc.Component {
|
|
|
|
@property(cc.Node)
|
|
yuanBaoNumStr: cc.Node = null;
|
|
@property(cc.Node)
|
|
changeLabel: cc.Node = null;
|
|
|
|
|
|
onLoad () {
|
|
|
|
|
|
|
|
this.showMoney(false);
|
|
EventMgr.onEvent_custom(ryw_Event.updateMoney,(money,isAnim)=>{
|
|
//console.log('updateMoney++++++++')
|
|
|
|
this.showMoney(isAnim);
|
|
if(money == 0){
|
|
return
|
|
}
|
|
|
|
if(isNaN(money)){
|
|
|
|
}else{
|
|
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.2)
|
|
.by(2,{y:20,opacity:0})
|
|
.call(()=>{
|
|
label.removeFromParent()
|
|
})
|
|
.start()
|
|
}
|
|
|
|
|
|
|
|
},this)
|
|
|
|
|
|
|
|
}
|
|
|
|
start () {
|
|
|
|
}
|
|
showMoney(isAnim){
|
|
let aaa = Common5.getNumberChangeHanzi(UserManager.getCurMoney(),'2')
|
|
aaa = aaa as string
|
|
|
|
this.yuanBaoNumStr.getComponent(cc.Label).string = aaa;
|
|
}
|
|
|
|
}
|
|
|