1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- cc.Class({
- extends: cc.Component,
- properties: {
- num1: cc.Label,
- num2: cc.Label,
- 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 == "offline_btn") {
- if (this.money != undefined) Module.money = Module.money+this.money;
- console.log("---this.money--: " , this.money);
- // this.node.destroy();
- 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 if (name == "video") {
- wb.ADManager.openAdC("video", function (a, result) {
- if(result == 0){
- if (this.money != undefined) Module.money = Module.money + (this.money* 10);
- Module.gameObj.updateMoney();
- // this.node.destroy();
- 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));
- }
- },
- init: function (money){
- this.money = money;
- this.num1.string = money;
- this.num2.string = money * 10;
- },
- // update (dt) {},
- });
|