123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- var ZYGameTool = require('GameTool');
- var GameTipLayer = cc.Class({
- extends: cc.Component,
- properties: {
- btn: {
- title: "按钮",
- type: cc.Node,
- default:[],
- },
- btnCallFunc: null,
- coinNumbers: null,
- },
- onLoad() {
- console.log("into GameTip");
- this.coinNumbers = [10,15,25,35, 40];
- this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this);
- if (!Module.GameTipLayer) Module.GameTipLayer = this;
- this.btn[0].on('click', function (event) {
- this.node.destroy();
- Module.GameTipLayer = null;
- }.bind(this));
- this.btn[1].on('click', function (event) {
- var num = this.coinNumbers[zy.randNum(0,4)];
- this.openVideo(num);
- }.bind(this));
- this.btn[1].runAction(cc.repeatForever(cc.sequence(cc.scaleTo(0.8, 1.15), cc.scaleTo(1, 0.8))));
- },
- start() {
- },
- openVideo: function(num){
- ZYGameTool.getInstance().OpenAd("home_prop", "video",
- function () {
- // this.coinAction(num);
- coinNum += num;
- ZYGameTool.getInstance().setIntegerForKey(localDataItem.coinNum, coinNum);
- if(this.btnCallFunc) this.btnCallFunc(num);
- this.node.destroy();
- console.log("---debug---成功---");
- }.bind(this),
- function () {
- if(this.btnCallFunc) this.btnCallFunc(0);
- console.log("---debug---失败---");
- }.bind(this),
- )
- },
- call: function (func) {
- this.btnCallFunc = func;
- },
- touchBegin: function (touch, event) {
- // this.node.destroy();
- },
- // update (dt) {},
- });
|