Multimain.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. start () {
  32. utils.isMobile(function () {
  33. Manager.Multimain = this;
  34. Manager.sceneType = 2;
  35. }.bind(this));
  36. //分享
  37. let sharelayout = this.sharelayout = UtilsPrefabs.getNode("sharelayout", this.node);
  38. //结算
  39. let Settlementlayout = this.Settlementlayout = UtilsPrefabs.getNode("Settlementlayout", this.node);
  40. //排行榜
  41. let ranklist = this.ranklist = UtilsPrefabs.getNode("ranklist", this.node);
  42. sharelayout.active = false;
  43. Settlementlayout.active = false;
  44. ranklist.active = false;
  45. this.layoutarr = [];
  46. this.layoutarr.push(sharelayout);
  47. this.layoutarr.push(Settlementlayout);
  48. this.layoutarr.push(ranklist);
  49. this.setShow(0);
  50. this.initListeniner();
  51. this._init();
  52. },
  53. _init : function(){
  54. // utils.redytoLoadScene("main");
  55. // console.log("用户信息是"+UserInfo);
  56. // console.log("用户信息是",UserInfo);
  57. },
  58. initListeniner : function(){
  59. this.sharelayout.getComponent("sharelayoutManager").setShareButtonClickListeniner(function () {
  60. // this.setShow(1);
  61. }.bind(this));
  62. this.sharelayout.getComponent("sharelayoutManager").setShareButtonClickcloseListeniner(function () {
  63. this.setShow(1);
  64. utils.isMobile(function () {
  65. Manager.sceneType = 3;
  66. }.bind(this));
  67. }.bind(this));
  68. this.Settlementlayout.getComponent("SettlementlayoutManager").setmoreButtonClickListeniner(function () {
  69. this.setShow(2);
  70. utils.isMobile(function () {
  71. Manager.sceneType = 4;
  72. }.bind(this));
  73. }.bind(this));
  74. this.ranklist.getComponent("ranklistManager").setbackButtonClickListeniner(function () {
  75. this.setShow(1);
  76. utils.isMobile(function () {
  77. Manager.sceneType = 3;
  78. }.bind(this));
  79. }.bind(this));
  80. },
  81. setShow : function (number) {
  82. for (var i = 0; i < this.layoutarr.length; i++) {
  83. this.layoutarr[i].active = false;
  84. }
  85. this.layoutarr[number].active = true;
  86. }
  87. // update (dt) {},
  88. });