PauseNode.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var ZYGameTool = require('GameTool');
  2. var GamePause = cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. btn: {
  6. title: "按钮",
  7. type: cc.Node,
  8. default:[],
  9. },
  10. btnCallFunc: null,
  11. },
  12. // LIFE-CYCLE CALLBACKS:
  13. onLoad() {
  14. this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this);
  15. if (!Module.GamePauseLayer) Module.GamePauseLayer = this;
  16. for (var i in this.btn){
  17. this.btn[i].on('click', function (event) {
  18. this.node.destroy();
  19. Module.GamePauseLayer = null;
  20. console.log("------click", event.node.name);
  21. if (this.btnCallFunc) this.btnCallFunc(event.node.name);
  22. }.bind(this));
  23. }
  24. ZYGameTool.getInstance().OpenAd("banner", "banner");
  25. },
  26. start() {
  27. },
  28. call: function (func) {
  29. this.btnCallFunc = func;
  30. },
  31. touchBegin: function (touch, event) {
  32. this.node.destroy();
  33. },
  34. // update (dt) {},
  35. });