17395ec5-832c-4da8-aab2-d6542ca3312a.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. cc._RF.push(module, '173957FgyxNqKqy1lQsozEq', 'ZY_GameFaildLayer');
  3. // Texture/prefab/ZY_GameFaildLayer.js
  4. "use strict";
  5. var ZYGameTool = require('GameTool');
  6. var GameFaild = cc.Class({
  7. "extends": cc.Component,
  8. properties: {
  9. videoBtn: cc.Node,
  10. jumpBtn: cc.Node,
  11. btnCallFunc: null,
  12. numNode: cc.Node,
  13. number: 8
  14. },
  15. // LIFE-CYCLE CALLBACKS:
  16. onLoad: function onLoad() {
  17. console.log("into GameFaild");
  18. this.number = 8;
  19. this.schedule(this.countTime, 1);
  20. this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this);
  21. if (!Module.GameFaildLayer) Module.GameFaildLayer = this;
  22. this.videoBtn.on('click', function (event) {
  23. this.videoClick();
  24. }.bind(this));
  25. this.jumpBtn.on('click', function (event) {
  26. this.jumpClick();
  27. }.bind(this));
  28. ZYGameTool.getInstance().OpenAd("banner", "banner");
  29. },
  30. start: function start() {},
  31. countTime: function countTime() {
  32. --this.number;
  33. this.numNode.getComponent(cc.Label).string = this.number;
  34. if (this.number == 0) {
  35. this.jumpClick();
  36. }
  37. if (this.number == 5) {
  38. this.jumpBtn.active = true;
  39. }
  40. },
  41. videoClick: function videoClick() {
  42. this.unschedule(this.countTime);
  43. ZYGameTool.getInstance().OpenAd("home_lqjb", "video", function () {
  44. console.log("---debug---成功---");
  45. if (this.btnCallFunc) this.btnCallFunc(true);
  46. Module.GameFaildLayer = null;
  47. this.node.destroy();
  48. }.bind(this), function () {
  49. this.schedule(this.countTime, 1); // if(this.btnCallFunc) this.btnCallFunc(false);
  50. // Module.GameFaildLayer =null;
  51. // if (Module.GameManager) Module.GameManager.clearData();
  52. // gameLocalData.clear();
  53. // this.node.destroy();
  54. // cc.director.loadScene("homeScene");
  55. // console.log("---debug---失败---");
  56. }.bind(this));
  57. },
  58. jumpClick: function jumpClick() {
  59. if (this.btnCallFunc) this.btnCallFunc(false);
  60. if (Module.GameManager) Module.GameManager.clearData();
  61. gameLocalData.clear();
  62. Module.GameFaildLayer = null;
  63. this.node.destroy();
  64. cc.director.loadScene("homeScene");
  65. },
  66. call: function call(func) {
  67. this.btnCallFunc = func;
  68. },
  69. touchBegin: function touchBegin(touch, event) {} // update (dt) {},
  70. });
  71. cc._RF.pop();