ranklistManager.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. item: cc.Prefab,
  29. },
  30. // LIFE-CYCLE CALLBACKS:
  31. onLoad () {
  32. // console.log("排行页面看见");
  33. utils.isMobile(function () {
  34. manager_android_js.ranklist = this;
  35. }.bind(this));
  36. console.log("显示隐藏会走这里吗","onLoad");
  37. },
  38. //排行榜
  39. start() {
  40. console.log("显示隐藏会走这里吗","start");
  41. utils.isMobile(function () {
  42. manager_android_js.ranklist = this;
  43. }.bind(this));
  44. let ranklist = this.ranklist = UtilsNode.getNode("ranklist", this.node);
  45. let list_Wholecountry_layout=this.list_Wholecountry_layout = UtilsNode.getNode("list_Wholecountry_layout", this.node);
  46. let list_Goodfriend_layout =this.list_Goodfriend_layout= UtilsNode.getNode("list_Goodfriend_layout", this.node);
  47. let list_Wholecountry = this.list_Wholecountry=UtilsNode.getNode("list_Wholecountry", this.node);
  48. let list_Goodfriend = this.list_Goodfriend=UtilsNode.getNode("list_Goodfriend", this.node);
  49. // var i = "https://ss0.bdstatic.com/" +
  50. // "70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/" +
  51. // "u=3356744803,2445309553&fm=26&gp=0.jpg"
  52. // utils.loadHttpSpriteFrame(i, NewButton.getComponent(cc.Sprite));
  53. // item/ranklist_bg
  54. // Log.info("能不能点啊 list_Wholecountry",list_Wholecountry)
  55. // Log.info("能不能点啊 list_Goodfriend",list_Goodfriend)
  56. UtilsNode.setOn(list_Wholecountry, function () {
  57. this.switchs(0);
  58. }.bind(this));
  59. UtilsNode.setOn(list_Goodfriend, function () {
  60. this.switchs(1);
  61. }.bind(this));
  62. setTimeout(function () {
  63. this.switchs(0);
  64. }.bind(this),100);
  65. //返回到结算页面
  66. let backbutton = this.backbutton = UtilsNode.getNode("backbutton", this.node);
  67. UtilsNode.setOn(this.backbutton, function () {
  68. if (this.backButtonClick != null) {
  69. this.backButtonClick();
  70. }
  71. this.node.active = false;
  72. }.bind(this));
  73. this._init();
  74. },
  75. switchs : function(type){
  76. switch (type) {
  77. case 0:
  78. this.list_Wholecountry_layout.active = true;
  79. this.list_Goodfriend_layout.active = false;
  80. UtilsNode.getNode("Label1", this.list_Wholecountry).active = false;
  81. UtilsNode.getNode("Label2", this.list_Wholecountry).active = true;
  82. UtilsNode.getNode("Label1", this.list_Goodfriend).active = true;
  83. UtilsNode.getNode("Label2", this.list_Goodfriend).active = false;
  84. // console.log("排行页面看见"+type+" this.list_Wholecountry ",this.list_Wholecountry," this.list_Goodfriend ",this.list_Goodfriend);
  85. break;
  86. case 1:
  87. this.list_Wholecountry_layout.active = false;
  88. this.list_Goodfriend_layout.active = true;
  89. UtilsNode.getNode("Label1", this.list_Wholecountry).active = true;
  90. UtilsNode.getNode("Label2", this.list_Wholecountry).active = false;
  91. UtilsNode.getNode("Label1", this.list_Goodfriend).active = false;
  92. UtilsNode.getNode("Label2", this.list_Goodfriend).active = true;
  93. // console.log("排行页面看见"+type+" this.list_Wholecountry ",this.list_Wholecountry," this.list_Goodfriend ",this.list_Goodfriend);
  94. break;
  95. }
  96. },
  97. setListData : function(){
  98. this.list_Wholecountry_layout.getComponent("listWholecountryManger").setListData();
  99. this.list_Goodfriend_layout.getComponent("listGoodfriendManger").setListData();
  100. },
  101. setListDatatype : function(type,length){
  102. if (type ==0) {
  103. this.list_Wholecountry_layout.getComponent("listWholecountryManger").setListData(length);
  104. }
  105. if (type ==1) {
  106. this.list_Goodfriend_layout.getComponent("listGoodfriendManger").setListData(length);
  107. }
  108. },
  109. _init : function(){
  110. this.list_Wholecountry_layout.getComponent("listWholecountryManger")._init();
  111. this.list_Goodfriend_layout.getComponent("listGoodfriendManger")._init();
  112. },
  113. setbackButtonClickListeniner : function (backButtonClick) {
  114. this.backButtonClick = backButtonClick;
  115. },
  116. backButtonClick : function () {
  117. },
  118. // update (dt) {},
  119. });