ClubUserScore.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_LabGold:cc.Label,
  5. m_LbSelfScore:cc.Label,
  6. m_EdOpScore:cc.EditBox,
  7. },
  8. ctor:function () {
  9. },
  10. onLoad:function(){
  11. },
  12. OnShowClubUser:function(UserID, ClubID, ClubLv){
  13. this.m_UserID = UserID;
  14. this.$('UserNode@UserCtrl').SetUserByID(UserID);
  15. this.m_LabGold.string = 0;
  16. var SelfLv = this.m_Hook.m_SelClubInfo.ClubLevel;
  17. this.m_EdOpScore.string = '';
  18. this.$('BtLv3').active = SelfLv==9 && ClubLv==6;
  19. this.$('BtLv6').active = SelfLv==9 && ClubLv==3;
  20. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  21. var webUrl = window.PHP_HOME+'/League.php?&GetMark=27&dwUserID='+UserID;
  22. webUrl += '&dwUserID2='+pGlobalUserData.dwUserID+'&dwClubID='+ClubID
  23. WebCenter.GetData(webUrl, null, function (data) {
  24. var res = JSON.parse(data);
  25. if(res.dwUserID == null || res.dwUserID != this.m_UserID) return
  26. this.m_LabGold.string = res.Gold;
  27. this.m_LbSelfScore.string = res.Gold1;
  28. if(res.LeaderID == pGlobalUserData.dwUserID && res.LeaderID !=this.m_UserID) {
  29. if(ClubLv==6) this.$('BtLv3').active = true;
  30. if(ClubLv==3 && SelfLv>6) this.$('BtLv6').active = true;
  31. }
  32. }.bind(this));
  33. },
  34. OnClick_BtSave:function(){//0金币 1积分
  35. //ClubGive
  36. var Score = parseInt(this.m_EdOpScore.string);
  37. if(Score>0) {
  38. this.m_Hook.OnGiveScore(this.m_UserID, 1, Score);
  39. }else if(Score<0) {
  40. this.m_Hook.OnTakeScore(this.m_UserID, 1, -Score);
  41. }else{
  42. return this.m_Hook.ShowTips('金額輸入錯誤!');
  43. }
  44. this.HideView();
  45. },
  46. OnClickGive:function(){//0金币 1积分
  47. //ClubGive
  48. var Score = parseInt(this.m_EdOpScore.string);
  49. if(Score>0) {
  50. this.m_Hook.OnGiveScore(this.m_UserID, 1, Score);
  51. this.HideView();
  52. }else{
  53. return this.m_Hook.ShowTips('金額輸入錯誤!');
  54. }
  55. },
  56. OnClickTake:function(){//0金币 1积分
  57. //ClubTake
  58. var Score = parseInt(this.m_EdOpScore.string);
  59. if(Score>0) {
  60. this.m_Hook.OnTakeScore(this.m_UserID, 1, Score);
  61. this.HideView();
  62. }else{
  63. return this.m_Hook.ShowTips('金額輸入錯誤!');
  64. }
  65. },
  66. OnClick_BtSetLv3:function(){
  67. this.ShowAlert('確定要取消合夥人身份嗎?', Alert_All, function(Res){
  68. if(Res)this.OnSetUserClubLv(3)
  69. }.bind(this))
  70. },
  71. OnClick_BtSetLv6:function(){
  72. this.ShowAlert('確定要設為合夥人嗎?', Alert_All, function(Res){
  73. if(Res) this.OnSetUserClubLv(6);
  74. }.bind(this))
  75. },
  76. OnSetUserClubLv:function(Lv){
  77. this.m_Hook.OnOpClubUserLv(this.m_UserID, Lv, function(){
  78. this.m_Hook.OnClick_Toggle();
  79. this.HideView();
  80. }.bind(this))
  81. },
  82. });