pushAdLayer.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. },
  14. onLoad() {
  15. this.initListener();
  16. },
  17. start() {
  18. this.node.active = false;
  19. this.pushCall();
  20. if (wb.wxData.vigameAdFlag) {
  21. this.node.active = false;
  22. }
  23. },
  24. initListener() {
  25. cc.director.on('wxPushData', function (event) {
  26. this.pushCall();
  27. }.bind(this));
  28. },
  29. pushCall() {
  30. if (wb.wxData.pushData && wb.wxData.pushData.bottomList.length > 0) {
  31. this.node.active = true;
  32. }
  33. },
  34. // update (dt) {},
  35. });