ClubPartnerPreZiMo.js 6.1 KB

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