ClubPartnerPre.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. InitPre:function(){
  6. if(this.m_UserCtrl == null) this.m_UserCtrl = this.$('@UserCtrl');
  7. this.m_UserCtrl.SetUserByID(0);
  8. this.$('YRevence@Label').string='0%';
  9. this.$('Y&TDraw@Label').string='0';
  10. this.$('Rate&TRevence@Label').string='0';
  11. this.$('T&YRevence@Label').string='0';
  12. this.$('YWinner@Label').string='0';
  13. this.$('YScore@Label').string='0';
  14. //删除
  15. this.m_NdDel = this.$('Layout/BtDel');
  16. if( this.m_NdDel ) this.m_NdDel.active = false;
  17. //旗下普通玩家
  18. this.m_NdInfo = this.$('Layout/BtInfo');
  19. if( this.m_NdInfo ) this.m_NdInfo.active = false;
  20. //旗下
  21. this.m_NdLeadList = this.$('Layout/BtLeadList');
  22. if( this.m_NdLeadList ) this.m_NdLeadList.active = false;
  23. this.m_MaxLv = CLUB_LEVEL_OWNER;
  24. this.m_MinLv = CLUB_LEVEL_MEMBER;
  25. this.node.active = false;
  26. this._bChangeRate = false;
  27. },
  28. SetPreInfo:function(ParaArr){//idArr[i], ShowLv, FindID
  29. this.m_UserID = ParaArr[1][0][0];
  30. this.m_LeaderID = this.m_Hook.m_dwLeaderID;
  31. this.m_ClubID = this.m_Hook.m_SelClubInfo.dwClubID;
  32. this.m_ClubLv = this.m_Hook.m_SelClubInfo.cbClubLevel;
  33. this.m_UserLv = CLUB_LEVEL_MEMBER;
  34. var webUrl = window.PHP_HOME+'/League.php?&GetMark=61&dwUserID='+this.m_UserID;
  35. webUrl += '&dwClubID='+this.m_ClubID+'&dwLeaderID='+this.m_LeaderID;
  36. WebCenter.GetData(webUrl, 1, function (data) {//GameID ClubLv Rate Score
  37. var InfoArr = JSON.parse(data);
  38. this.m_UserLv = InfoArr[1];
  39. //列表筛选等级
  40. if(InfoArr[1]==null || InfoArr[1]>this.m_MaxLv || InfoArr[1]<this.m_MinLv) return
  41. //筛选查找ID
  42. //if(ParaArr[2]!='' && (InfoArr[0]+'').indexOf(ParaArr[2])<0) return
  43. this.node.active = true;
  44. this.m_TagClubLv = InfoArr[1];
  45. if (this.m_UserCtrl) {
  46. this.m_UserCtrl.SetUserByID(this.m_UserID);
  47. }
  48. this.$('YRevence@Label').string=Score2Str(parseInt(InfoArr[6]));
  49. this.$('Y&TDraw@Label').string=parseInt(InfoArr[7])+'\n'+parseInt(InfoArr[8]);
  50. this.$('Rate&TRevence@Label').string=InfoArr[2]+'%'+'\n'+Score2Str(parseInt(InfoArr[5]));
  51. this.$('T&YRevence@Label').string=Score2Str(parseInt(InfoArr[4]))+'\n'+Score2Str(parseInt(InfoArr[3]));
  52. this.$('YWinner@Label').string=InfoArr[9];
  53. this.$('YScore@Label').string=Score2Str(parseInt(InfoArr[10]));
  54. this.$('ScoreInfo@Label').string=Score2Str(parseInt(InfoArr[11]))+'\n'+Score2Str(parseInt(InfoArr[12]));
  55. if(this.m_UserID == ParaArr[1][1]){
  56. this.m_NdInfo.active = true;
  57. }else{
  58. //解除关系 (部长名下普通成员无删除)
  59. if(this.m_NdDel) this.m_NdDel.active = (InfoArr[1]==CLUB_LEVEL_PARTNER);
  60. //旗下普通玩家
  61. if(this.m_NdInfo && InfoArr[1]>CLUB_LEVEL_MEMBER) this.m_NdInfo.active = true;
  62. //旗下
  63. if(this.m_NdLeadList && InfoArr[1]>CLUB_LEVEL_MEMBER) this.m_NdLeadList.active = true;
  64. }
  65. this._bChangeRate = InfoArr[1]>=CLUB_LEVEL_PARTNER;
  66. }.bind(this));
  67. },
  68. //详情
  69. OnClick_ShowUserScore:function(){
  70. cc.gSoundRes.PlaySound('Button');
  71. this.m_Hook.OnShowMemberInfo(this.m_UserID, this.m_UserLv);
  72. },
  73. //调整比率
  74. OnClick_ChangeRate:function(){
  75. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  76. if(this.m_UserID == pGlobalUserData.dwUserID) return;
  77. if(this._bChangeRate == false) return;
  78. if(this.m_LeaderID!=pGlobalUserData.dwUserID) return;
  79. cc.gSoundRes.PlaySound('Button');
  80. this.m_Hook.SetLeaderRate(this.m_UserID);
  81. },
  82. //旗下
  83. OnClick_ShowUserPartnerInfo:function(){
  84. cc.gSoundRes.PlaySound('Button');
  85. this.m_Hook.OnShowPartnerInfo(this.m_UserID, this.m_TagClubLv);
  86. },
  87. //旗下玩家
  88. OnClick_ShowUserPartnerList:function(_,data){
  89. cc.gSoundRes.PlaySound('Button');
  90. this.m_Hook.OnShowPartnerList(data,this.m_UserID,this.m_UserCtrl.m_LabID.string);
  91. },
  92. //删除
  93. OnClick_BtDel:function(){
  94. cc.gSoundRes.PlaySound('Button');
  95. if(this.m_TagClubLv == 3){
  96. this.m_Hook.ShowAlert('是否確認移除玩家? 確認後玩家將成為盟主成員',Alert_YesNo,function(Res){
  97. if(Res) this.m_Hook.DelFromLeader(this.m_UserID);
  98. }.bind(this));
  99. }else{
  100. var webUrl = window.PHP_HOME+ '/League.php?GetMark=103&dwUserID='+this.m_UserID;
  101. webUrl += '&dwClubID='+g_ShowClubInfo.dwClubID;
  102. webUrl += `&start=1`;
  103. webUrl += `&end=10`;
  104. webUrl += `&lvl=0`;
  105. WebCenter.GetData(webUrl, null, function (data) {
  106. var Res = JSON.parse(data);
  107. if(Res.length>1){
  108. g_Lobby.ShowTips("該玩家有下級玩家,不能删除!");
  109. }else{
  110. this.m_Hook.ShowAlert('是否確認將玩家降為普通成員?',Alert_YesNo,function(Res){
  111. if(Res) {
  112. this.m_Hook.OnOpClubUserLv(this.m_UserID, CLUB_LEVEL_MEMBER);
  113. }
  114. }.bind(this))
  115. }
  116. }.bind(this));
  117. }
  118. },
  119. });