end.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. // foo: {
  14. // // ATTRIBUTES:
  15. // default: null, // The default value will be used only when the component attaching
  16. // // to a node for the first time
  17. // type: cc.SpriteFrame, // optional, default is typeof default
  18. // serializable: true, // optional, default is true
  19. // },
  20. // bar: {
  21. // get () {
  22. // return this._bar;
  23. // },
  24. // set (value) {
  25. // this._bar = value;
  26. // }
  27. // },
  28. },
  29. // LIFE-CYCLE CALLBACKS:
  30. onLoad () {
  31. let Canvas = cc.find("Canvas");
  32. //结算
  33. // this.Settlement = UtilsNode.getNode("Settlement",Canvas);
  34. //分享
  35. // this.share = UtilsNode.getNode("share",Canvas);
  36. //排行榜
  37. this.rankList = UtilsNode.getNode("ranklist",Canvas);
  38. //新的结算分享
  39. this.ReportActivity = UtilsNode.getNode("ReportActivity",Canvas);
  40. this.ReportActivitymanagec = this.ReportActivity.getComponent('ReportActivitymanage');
  41. // this.Settlement.getComponent("Settlement").setClickListeniner(function () {
  42. //
  43. // }.bind(this));
  44. this.initArrLayou();
  45. this.switchLayou(0);
  46. this.initListeniner();
  47. },
  48. start () {
  49. },
  50. initListeniner(){
  51. // this.Settlementomponent = this.Settlement.getComponent("Settlement");
  52. // this.Settlementomponent.setCallbackRestGame(function () {
  53. // utils.toLoadScene("game")
  54. // }.bind(this));
  55. // this.Settlementomponent.setCallbackShare(function () {
  56. // this.switchLayou(1);
  57. // }.bind(this));
  58. // this.Settlementomponent.setCallbackRanklist(function () {
  59. // this.switchLayou(2);
  60. // }.bind(this));
  61. //
  62. // this.shareComponent = this.share.getComponent("share");
  63. // this.shareComponent.setCallbackGoshare (function () {
  64. //
  65. // var qc = UtilsNode.getNode("qc",this.share);
  66. // qc.active = true;
  67. // this.shareComponent.captureScreenshot(function () {
  68. // // Log.info("去分享 base64",ShareImage.img);
  69. // qc.active = false;
  70. // utils.isMobile(function () {
  71. // manager_android_js.clickShare();
  72. // }.bind(this))
  73. // }.bind(this));
  74. // }.bind(this))
  75. // this.shareComponent.setCallbackShareback (function () {
  76. // this.switchLayou(0);
  77. // }.bind(this))
  78. this.rankListComponent = this.rankList.getComponent("ranklistManager");
  79. this.rankListComponent.setbackButtonClickListeniner(function () {
  80. this.switchLayou(0);
  81. }.bind(this))
  82. //todo-----------------------------------------------------------------------------------------------
  83. //新的
  84. this.ReportActivitymanagec.setResetgamesListner(function () {
  85. Log.info('重新开始游戏');
  86. utils.toLoadScene("game")
  87. }.bind(this));
  88. this.ReportActivitymanagec.setToshareListner(function () {
  89. // Log.info('去分享');
  90. this.ReportActivitymanagec.optionAndqc(1);
  91. this.ReportActivitymanagec.captureScreenshot(function () {
  92. // Log.info("去分享 base64",ShareImage.img);
  93. this.ReportActivitymanagec.optionAndqc(0);
  94. utils.isMobile(function () {
  95. manager_android_js.clickShare();
  96. }.bind(this))
  97. }.bind(this))
  98. }.bind(this));
  99. this.ReportActivitymanagec.setGotoRanklistListner(function () {
  100. Log.info('去看排行榜');
  101. this.switchLayou(1);
  102. }.bind(this));
  103. //todo-----------------------------------------------------------------------------------------------
  104. },
  105. //初始化 三个 界面的数组
  106. initArrLayou(){
  107. this.arrLayou = [];
  108. this.arrLayou.push(this.ReportActivity);
  109. // this.arrLayou.push(this.share);
  110. this.arrLayou.push(this.rankList);
  111. },
  112. switchLayou(type){
  113. for (var i = 0; i < this.arrLayou.length; i++) {
  114. this.arrLayou[i].active = false;
  115. }
  116. this.arrLayou[type].active = true;
  117. }
  118. // update (dt) {},
  119. });