SevenInvestLayer.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import SoundMgr from "../base/SoundMgr";
  2. import Tool from "../base/Tool";
  3. var baseLayer = require('BaseLayer');
  4. cc.Class({
  5. extends: baseLayer,
  6. properties: {
  7. labCoin: cc.Label,
  8. daysNode: [cc.Node],
  9. },
  10. // LIFE-CYCLE CALLBACKS:
  11. onLoad () {
  12. this._super();
  13. this.initItems();
  14. },
  15. start () {
  16. this.labCoin.string = `金币x${25800}`;
  17. },
  18. initItems(){
  19. for(let i=0; i < this.daysNode.length; i++){
  20. this.daysNode[i].getChildByName('labDay').getComponent(cc.Label).string = `第${i+1}天`;
  21. this.daysNode[i].getChildByName('labNum').getComponent(cc.Label).string = `x${998}`;
  22. let cantnode = this.daysNode[i].getChildByName('cant');
  23. cantnode.active = false;
  24. let getnode = this.daysNode[i].getChildByName('get');
  25. getnode.active = true;
  26. Tool.addBtnListener(getnode, this.node, 'SevenInvestLayer', 'onClickGet', i);
  27. let donenode = this.daysNode[i].getChildByName('done');
  28. donenode.active = false;
  29. }
  30. },
  31. onClickGet(event, customEventData){
  32. SoundMgr.playClick();
  33. console.log('get: ', customEventData);
  34. },
  35. onClickPay(){
  36. SoundMgr.playClick();
  37. },
  38. });