SenceManager.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Learn cc.Class:
  2. // - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
  4. // Learn Attribute:
  5. // - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. },
  14. // LIFE-CYCLE CALLBACKS:
  15. // onLoad () {},
  16. start() {
  17. },
  18. enterSence: function (lastSenceName, senceName) {
  19. this.node.getChildByName(lastSenceName).active = false;
  20. this.node.getChildByName(senceName).active = true;
  21. if (senceName == "Game") {
  22. this.node.getChildByName(senceName).getComponent("GameSence").startGame();
  23. } else if (senceName == 'Home') {
  24. this.node.getChildByName(senceName).getComponent("HomeSence").updateShareBtn();
  25. }
  26. }
  27. // update (dt) {},
  28. });