1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- tNodes: [cc.Node],
- page1Node: cc.Node,
- page2Node: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- },
- initData(){
- this.selectToggle(null, 0);
- },
- selectToggle(event, index){ // 0 1 2 3
- for(let i=0; i< this.tNodes.length; i++){
- this.tNodes[i].getChildByName('on').active = false;
- }
- this.tNodes[index].getChildByName('on').active = true;
- this.page1Node.active = false;
- this.page2Node.active = false;
- let tempPage = this.page1Node;
- let pageJsName = 'TaskPage1';
- if(index == 1 || index == 2){
- tempPage = this.page2Node;
- pageJsName = 'TaskPage2';
- }
- tempPage.active = true;
- tempPage.getComponent(pageJsName).initData(index);
- },
- });
|