1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import SoundMgr from "../base/SoundMgr";
- import Tool from "../base/Tool";
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- labCoin: cc.Label,
- daysNode: [cc.Node],
-
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this._super();
- this.initItems();
- },
- start () {
- this.labCoin.string = `金币x${25800}`;
- },
- initItems(){
- for(let i=0; i < this.daysNode.length; i++){
- this.daysNode[i].getChildByName('labDay').getComponent(cc.Label).string = `第${i+1}天`;
- this.daysNode[i].getChildByName('labNum').getComponent(cc.Label).string = `x${998}`;
- let cantnode = this.daysNode[i].getChildByName('cant');
- cantnode.active = false;
- let getnode = this.daysNode[i].getChildByName('get');
- getnode.active = true;
- Tool.addBtnListener(getnode, this.node, 'SevenInvestLayer', 'onClickGet', i);
- let donenode = this.daysNode[i].getChildByName('done');
- donenode.active = false;
- }
- },
- onClickGet(event, customEventData){
- SoundMgr.playClick();
- console.log('get: ', customEventData);
- },
- onClickPay(){
- SoundMgr.playClick();
- },
- });
|