TaskLayer.js 937 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. var baseLayer = require('BaseLayer');
  2. cc.Class({
  3. extends: baseLayer,
  4. properties: {
  5. tNodes: [cc.Node],
  6. page1Node: cc.Node,
  7. page2Node: cc.Node,
  8. },
  9. // LIFE-CYCLE CALLBACKS:
  10. // onLoad () {},
  11. start () {
  12. },
  13. initData(){
  14. this.selectToggle(null, 0);
  15. },
  16. selectToggle(event, index){ // 0 1 2 3
  17. for(let i=0; i< this.tNodes.length; i++){
  18. this.tNodes[i].getChildByName('on').active = false;
  19. }
  20. this.tNodes[index].getChildByName('on').active = true;
  21. this.page1Node.active = false;
  22. this.page2Node.active = false;
  23. let tempPage = this.page1Node;
  24. let pageJsName = 'TaskPage1';
  25. if(index == 1 || index == 2){
  26. tempPage = this.page2Node;
  27. pageJsName = 'TaskPage2';
  28. }
  29. tempPage.active = true;
  30. tempPage.getComponent(pageJsName).initData(index);
  31. },
  32. });