ranklistManager.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. },
  34. //排行榜
  35. start() {
  36. utils.isMobile(function () {
  37. Manager.ranklist = this;
  38. }.bind(this));
  39. let ranklist = this.ranklist = UtilsPrefabs.getNode("ranklist", this.node);
  40. let list_Wholecountry_layout=this.list_Wholecountry_layout = UtilsPrefabs.getNode("list_Wholecountry_layout", this.node);
  41. let list_Goodfriend_layout =this.list_Goodfriend_layout= UtilsPrefabs.getNode("list_Goodfriend_layout", this.node);
  42. let list_Wholecountry = this.list_Wholecountry=UtilsPrefabs.getNode("list_Wholecountry", this.node);
  43. let list_Goodfriend = this.list_Goodfriend=UtilsPrefabs.getNode("list_Goodfriend", this.node);
  44. // var i = "https://ss0.bdstatic.com/" +
  45. // "70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/" +
  46. // "u=3356744803,2445309553&fm=26&gp=0.jpg"
  47. // utils.loadHttpSpriteFrame(i, NewButton.getComponent(cc.Sprite));
  48. // item/ranklist_bg
  49. UtilsPrefabs.setOn(list_Wholecountry, function () {
  50. this.switchs(0);
  51. }.bind(this));
  52. UtilsPrefabs.setOn(list_Goodfriend, function () {
  53. this.switchs(1);
  54. }.bind(this));
  55. this.switchs(0);
  56. //返回到结算页面
  57. let backbutton = this.backbutton = UtilsPrefabs.getNode("backbutton", this.node);
  58. UtilsPrefabs.setOn(this.backbutton, function () {
  59. if (this.backButtonClick != null) {
  60. this.backButtonClick();
  61. }
  62. }.bind(this));
  63. UtilsPrefabs.setOn(this.backbutton, function () {
  64. if (this.backButtonClick != null) {
  65. this.backButtonClick();
  66. }
  67. }.bind(this));
  68. },
  69. switchs : function(type){
  70. switch (type) {
  71. case 0:
  72. this.list_Wholecountry_layout.active = true;
  73. this.list_Goodfriend_layout.active = false;
  74. UtilsPrefabs.getNode("Label1", this.list_Wholecountry).active = false;
  75. UtilsPrefabs.getNode("Label2", this.list_Wholecountry).active = true;
  76. UtilsPrefabs.getNode("Label1", this.list_Goodfriend).active = true;
  77. UtilsPrefabs.getNode("Label2", this.list_Goodfriend).active = false;
  78. console.log("排行页面看见"+type+" this.list_Wholecountry ",this.list_Wholecountry," this.list_Goodfriend ",this.list_Goodfriend);
  79. break;
  80. case 1:
  81. this.list_Wholecountry_layout.active = false;
  82. this.list_Goodfriend_layout.active = true;
  83. UtilsPrefabs.getNode("Label1", this.list_Wholecountry).active = true;
  84. UtilsPrefabs.getNode("Label2", this.list_Wholecountry).active = false;
  85. UtilsPrefabs.getNode("Label1", this.list_Goodfriend).active = false;
  86. UtilsPrefabs.getNode("Label2", this.list_Goodfriend).active = true;
  87. console.log("排行页面看见"+type+" this.list_Wholecountry ",this.list_Wholecountry," this.list_Goodfriend ",this.list_Goodfriend);
  88. break;
  89. }
  90. },
  91. setListData : function(){
  92. this.list_Wholecountry_layout.getComponent("listWholecountryManger").setListData();
  93. this.list_Goodfriend_layout.getComponent("listGoodfriendManger").setListData();
  94. },
  95. setbackButtonClickListeniner : function (backButtonClick) {
  96. this.backButtonClick = backButtonClick;
  97. },
  98. backButtonClick : function () {
  99. },
  100. // update (dt) {},
  101. });