SupplyLayer.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import SoundMgr from "../base/SoundMgr";
  2. var baseLayer = require('BaseLayer');
  3. cc.Class({
  4. extends: baseLayer,
  5. properties: {
  6. togNodes: [cc.Node],
  7. spBar: cc.Sprite,
  8. labGet: cc.Label,
  9. labNum: cc.Label,
  10. labY: cc.Label,
  11. acNode: cc.Node,
  12. },
  13. // LIFE-CYCLE CALLBACKS:
  14. // onLoad () {},
  15. start () {
  16. this.init();
  17. this.selectToggle(null, 0);
  18. },
  19. init(){
  20. for(let i=0; i < this.togNodes.length; i++){
  21. cc.find('off/lab', this.togNodes[i]).getComponent(cc.Label).string = `${10}元`;
  22. cc.find('on/lab', this.togNodes[i]).getComponent(cc.Label).string = `${10}元`;
  23. }
  24. this.acNode.getComponent('RechargeActivity').setType(1, this);
  25. },
  26. selectToggle(event, index){
  27. for(let i=0; i < this.togNodes.length; i++){
  28. this.togNodes[i].getChildByName('on').active = false;
  29. }
  30. this.togNodes[index].getChildByName('on').active = true;
  31. this.spBar.fillRange = - 0.22;
  32. this.labGet.string = `获得\n${12345}万金币开启`;
  33. this.labNum.string = 100;
  34. this.labY.string = `${2}元 开启礼包`;
  35. },
  36. onClickGreen(){
  37. SoundMgr.playClick();
  38. },
  39. });