var baseLayer = require('BaseLayer'); import SoundMgr from "../base/SoundMgr"; cc.Class({ extends: baseLayer, properties: { atlasCoin: cc.SpriteAtlas, //金币图集 daysNode: [cc.Node], vipRewardNode: [cc.Node], spBar: cc.Sprite }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { this.setData(); }, // update (dt) {}, setData(){ for(let i=0; i < this.daysNode.length; i++){ this.daysNode[i].getChildByName('labNum').getComponent(cc.Label).string = `x${123}`; this.daysNode[i].getChildByName('get').active = false; // this.daysNode[i].getChildByName('sp').getComponent(cc.Sprite).spriteFrame = this.atlasCoin.getSpriteFrame('coin2'); } for(let i=0; i < this.vipRewardNode.length; i++){ this.vipRewardNode[i].getChildByName('get').active = false; this.vipRewardNode[i].getChildByName('icon').getComponent(cc.Animation).play(); } this.spBar.fillRange = 0.5; }, onClickDay(event, customEventData){ SoundMgr.playClick(); console.log('day: ', customEventData); }, onClickVipReward(event, customEventData){ SoundMgr.playClick(); console.log('vipReward: ', customEventData); }, });