HelpNode.js 1.2 KB

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