c83e9106-3bdf-453e-bbb8-be3768092213.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. cc._RF.push(module, 'c83e9EGO99FPru4vjdoCSIT', 'GameTip');
  3. // Texture/prefab/GameTip.js
  4. "use strict";
  5. var ZYGameTool = require('GameTool');
  6. var GameTipLayer = cc.Class({
  7. "extends": cc.Component,
  8. properties: {
  9. btn: {
  10. title: "按钮",
  11. type: cc.Node,
  12. "default": []
  13. },
  14. btnCallFunc: null,
  15. coinNumbers: null
  16. },
  17. onLoad: function onLoad() {
  18. console.log("into GameTip");
  19. this.coinNumbers = [10, 15, 25, 35, 40];
  20. this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this);
  21. if (!Module.GameTipLayer) Module.GameTipLayer = this;
  22. this.btn[0].on('click', function (event) {
  23. this.node.destroy();
  24. Module.GameTipLayer = null;
  25. }.bind(this));
  26. this.btn[1].on('click', function (event) {
  27. var num = this.coinNumbers[zy.randNum(0, 4)];
  28. this.openVideo(num);
  29. }.bind(this));
  30. this.btn[1].runAction(cc.repeatForever(cc.sequence(cc.scaleTo(0.8, 1.15), cc.scaleTo(1, 0.8))));
  31. },
  32. start: function start() {},
  33. openVideo: function openVideo(num) {
  34. ZYGameTool.getInstance().OpenAd("home_prop", "video", function () {
  35. // this.coinAction(num);
  36. coinNum += num;
  37. ZYGameTool.getInstance().setIntegerForKey(localDataItem.coinNum, coinNum);
  38. if (this.btnCallFunc) this.btnCallFunc(num);
  39. this.node.destroy();
  40. console.log("---debug---成功---");
  41. }.bind(this), function () {
  42. if (this.btnCallFunc) this.btnCallFunc(0);
  43. console.log("---debug---失败---");
  44. }.bind(this));
  45. },
  46. call: function call(func) {
  47. this.btnCallFunc = func;
  48. },
  49. touchBegin: function touchBegin(touch, event) {// this.node.destroy();
  50. } // update (dt) {},
  51. });
  52. cc._RF.pop();