"use strict"; cc._RF.push(module, '173957FgyxNqKqy1lQsozEq', 'ZY_GameFaildLayer'); // Texture/prefab/ZY_GameFaildLayer.js "use strict"; var ZYGameTool = require('GameTool'); var GameFaild = cc.Class({ "extends": cc.Component, properties: { videoBtn: cc.Node, jumpBtn: cc.Node, btnCallFunc: null, numNode: cc.Node, number: 8 }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() { console.log("into GameFaild"); this.number = 8; this.schedule(this.countTime, 1); this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this); if (!Module.GameFaildLayer) Module.GameFaildLayer = this; this.videoBtn.on('click', function (event) { this.videoClick(); }.bind(this)); this.jumpBtn.on('click', function (event) { this.jumpClick(); }.bind(this)); ZYGameTool.getInstance().OpenAd("banner", "banner"); }, start: function start() {}, countTime: function countTime() { --this.number; this.numNode.getComponent(cc.Label).string = this.number; if (this.number == 0) { this.jumpClick(); } if (this.number == 5) { this.jumpBtn.active = true; } }, videoClick: function videoClick() { this.unschedule(this.countTime); ZYGameTool.getInstance().OpenAd("home_lqjb", "video", function () { console.log("---debug---成功---"); if (this.btnCallFunc) this.btnCallFunc(true); Module.GameFaildLayer = null; this.node.destroy(); }.bind(this), function () { this.schedule(this.countTime, 1); // if(this.btnCallFunc) this.btnCallFunc(false); // Module.GameFaildLayer =null; // if (Module.GameManager) Module.GameManager.clearData(); // gameLocalData.clear(); // this.node.destroy(); // cc.director.loadScene("homeScene"); // console.log("---debug---失败---"); }.bind(this)); }, jumpClick: function jumpClick() { if (this.btnCallFunc) this.btnCallFunc(false); if (Module.GameManager) Module.GameManager.clearData(); gameLocalData.clear(); Module.GameFaildLayer = null; this.node.destroy(); cc.director.loadScene("homeScene"); }, call: function call(func) { this.btnCallFunc = func; }, touchBegin: function touchBegin(touch, event) {} // update (dt) {}, }); cc._RF.pop();