PauseNode.js 1001 B

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