ClubRankPre.js 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. InitPre:function(){
  6. if(this.m_UserCtrl == null) this.m_UserCtrl = this.$('UserCtrl@UserCtrl');
  7. if(this.m_LbInfo == null) this.m_LbInfo = this.$('Cnt@Label');
  8. if(this.m_Ltype == null) this.m_Ltype = this.$('Type@Label');
  9. if(this.m_LOperate == null) this.m_LOperate = this.$('Operate@Label');
  10. if(this.m_LTime == null) this.m_LTime = this.$('Time@Label');
  11. if(this.m_LbIndex == null) this.m_LbIndex = this.$('LabRank@Label');
  12. if(this.m_SpTop3 == null) this.m_SpTop3 = this.$('TexRank@Sprite');
  13. if(this.m_SpBG == null) this.m_SpBG = this.$('BG@Sprite');
  14. if(this.m_LTScore == null) this.m_LTScore = this.$('TScore@Label');
  15. if(this.m_LCScore == null) this.m_LCScore = this.$('CScore@Label');
  16. if(this.m_LChou == null) this.m_LChou = this.$('Chou@Label');
  17. if(this.m_LCChou == null) this.m_LCChou = this.$('CChou@Label');
  18. this.node.active = false;
  19. },
  20. SetPreInfo:function(ParaArr){//[i+1,Res[i][0],Res[i][1], RandType]); index userid cnt type
  21. this.m_Hook = ParaArr[1][2];
  22. switch(ParaArr[1][1]){
  23. case 0:this.OnShowScoreInfor(ParaArr[1][0]);return;
  24. case 1:this.OnShowScoreRecord(ParaArr[1][0]);return;
  25. case 2:this.OnShowWinnerRecord(ParaArr[1][0]);return;
  26. case 3:this.OnShowRichRecord(ParaArr[1][0]);return;
  27. case 4:this.OnShowCNTRecord(ParaArr[1][0]);return;
  28. case 5:this.OnShowExitRecord(ParaArr[1][0]);return;
  29. default:return;
  30. }
  31. },
  32. OnShowScoreInfor:function(arr){
  33. this.m_UserCtrl.SetUserByID(arr[0]);
  34. this.m_LbInfo.string = Score2Str(parseInt(arr[2]));
  35. this.m_UserID = arr[0];
  36. this.node.active = true;
  37. },
  38. OnShowScoreRecord:function(arr){
  39. this.m_UserCtrl.SetUserByID(arr[0]);
  40. this.m_LbInfo.string = Score2Str(parseInt(arr[2]));
  41. this.m_Ltype.string = arr[2]>0?'新增':'减少';
  42. this.m_LOperate.string = arr[1]==CLUB_LEVEL_OWNER ?'老闆':(arr[1]==CLUB_LEVEL_MANAGER ?'管理員':(arr[1]==CLUB_LEVEL_PARTNER ?'合夥人':"會員"));
  43. this.m_LTime.string = arr[3].replace(/ /,'\n');
  44. this.$('GameID@Label').string = arr[5];
  45. this.node.active = true;
  46. },
  47. OnShowWinnerRecord:function(arr){
  48. this.m_UserCtrl.SetUserByID(arr[0]);
  49. this.m_LbInfo.string = arr[1];
  50. this.node.active = true;
  51. },
  52. OnShowRichRecord:function(arr){
  53. this.m_UserCtrl.SetUserByID(arr[0]);
  54. this.m_LbInfo.string = arr[1];
  55. this.node.active = true;
  56. },
  57. OnShowCNTRecord:function(arr){
  58. this.m_LTScore.string = Score2Str(parseInt(arr[0]))+'/'+Score2Str(parseInt(arr[1]));
  59. this.m_LCScore.string = Score2Str(parseInt(arr[2]))+'/'+Score2Str(parseInt(arr[3]));
  60. this.m_LChou.string = Score2Str(parseInt(arr[4]));
  61. this.m_LCChou.string = Score2Str(parseInt(arr[5]))+'/'+Score2Str(parseInt(arr[6]));
  62. this.node.active = true;
  63. },
  64. OnShowExitRecord:function(arr){
  65. this.m_UserCtrl.SetUserByID(arr[1]);
  66. this.$('Cnt1@Label').string =Score2Str(parseInt(arr[4]));
  67. this.$('Cnt2@Label').string =arr[2];
  68. this.$('Cnt3@Label').string =arr[1] == arr[0]?'自己':(arr[5]==CLUB_LEVEL_OWNER?'老闆':'管理員');
  69. this.$('Cnt4@Label').string =arr[3].replace(/ /,'\n');
  70. this.$('Cnt5@Label').string =arr[6];
  71. this.node.active = true;
  72. },
  73. OnShowPersonalInfo:function(){
  74. cc.gSoundRes.PlaySound('Button');
  75. this.m_Hook.ShowPrefabDLG('ClubPersonalInfo',this.m_Hook.node,function(Js){
  76. Js.OnSetBaseInfo(this.m_UserID);
  77. }.bind(this));
  78. },
  79. OnBtClickOpenUpdateUserScoreNode:function(){
  80. cc.gSoundRes.PlaySound('Button');
  81. this.m_Hook.OnBtClickOpenUpdateUserScoreNode(this.m_UserID);
  82. },
  83. // update (dt) {},
  84. });