cc.Class({ extends: cc.Component, properties: { btn1: cc.Node, btn2: cc.Node, }, start () { this.btn1.on('click', this.callback, this); this.btn2.on('click', this.callback, this); this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this ); }, touchBegin: function(touch, envent) { }, callback: function(t) { window.Utils.playSound('sound/button' , 2, false); var name = t.node.name; if (name == "close") { this.node.active = false; } else if (name == "video") { wb.ADManager.openAdC("video", function (a, result) { if(result == 0){ Module.getGiftNum++; window.Utils.setIntegerForKey("diaoyu_getGiftNum" , Module.getGiftNum) Module.money = Module.money + 10000; Module.gameObj.updateMoney(); this.node.active = false; window.Utils.playSound('sound/sell' , 2, false); window.Utils.playEffectSpine('effect/effect5/jb.json', 'action', Module.gameObj.node, 0.8); }else{ Module.gameObj.popupTishiLayer("视频未播放完~"); } }.bind(this)); } }, });