SignLayer.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. var baseLayer = require('BaseLayer');
  2. import SoundMgr from "../base/SoundMgr";
  3. cc.Class({
  4. extends: baseLayer,
  5. properties: {
  6. atlasCoin: cc.SpriteAtlas, //金币图集
  7. daysNode: [cc.Node],
  8. vipRewardNode: [cc.Node],
  9. spBar: cc.Sprite
  10. },
  11. // LIFE-CYCLE CALLBACKS:
  12. // onLoad () {},
  13. start () {
  14. this.setData();
  15. },
  16. // update (dt) {},
  17. setData(){
  18. for(let i=0; i < this.daysNode.length; i++){
  19. this.daysNode[i].getChildByName('labNum').getComponent(cc.Label).string = `x${123}`;
  20. this.daysNode[i].getChildByName('get').active = false;
  21. // this.daysNode[i].getChildByName('sp').getComponent(cc.Sprite).spriteFrame = this.atlasCoin.getSpriteFrame('coin2');
  22. }
  23. for(let i=0; i < this.vipRewardNode.length; i++){
  24. this.vipRewardNode[i].getChildByName('get').active = false;
  25. this.vipRewardNode[i].getChildByName('icon').getComponent(cc.Animation).play();
  26. }
  27. this.spBar.fillRange = 0.5;
  28. },
  29. onClickDay(event, customEventData){
  30. SoundMgr.playClick();
  31. console.log('day: ', customEventData);
  32. },
  33. onClickVipReward(event, customEventData){
  34. SoundMgr.playClick();
  35. console.log('vipReward: ', customEventData);
  36. },
  37. });