btnmanager.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Learn cc.Class:
  2. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. pauseNode: cc.Node,
  14. },
  15. // LIFE-CYCLE CALLBACKS:
  16. // onLoad () {},
  17. start() {
  18. Btn = this;
  19. this.bg = this.pauseNode.getChildByName("bg");
  20. this.bg.active = false;
  21. },
  22. clickthis: function () {
  23. utils.isMobile(function () {
  24. if (manager_android_js.gamestatus == 1) {
  25. // manager_android_js.gamestatus = 2;
  26. // this.bg.active = true;
  27. this.clickPause();
  28. cc.director.pause();
  29. console.log("查看数据", Statistics);
  30. }
  31. }.bind(this));
  32. },
  33. clickShare: function () {
  34. utils.isMobile(function () {
  35. manager_android_js.clickShare();
  36. }.bind(this));
  37. },
  38. clickQuit: function () {
  39. utils.isMobile(function () {
  40. manager_android_js.clickQuit();
  41. }.bind(this));
  42. },
  43. clickPause: function () {
  44. utils.isMobile(function () {
  45. manager_android_js.clickPause();
  46. }.bind(this));
  47. },
  48. clickRest: function () {
  49. utils.isMobile(function () {
  50. if (manager_android_js.gamestatus == 2) {
  51. // manager_android_js.gamestatus = 1;
  52. this.bg.active = false;
  53. cc.director.resume();
  54. manager_android_js.clickRest();
  55. }
  56. }.bind(this));
  57. },
  58. // update (dt) {},
  59. });