ClubInviteAlter.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. OnHideView:function(){
  6. this.unschedule(this.UpdateTime);
  7. var obj = null;
  8. do{
  9. obj = window.gClubClientKernel.OnGetInviteInfor();
  10. if(obj){
  11. this.OnSetInviteInfor(obj);
  12. return;
  13. }
  14. }while(window.gClubClientKernel._inviteInfor.length>0);
  15. this.node.active = false;
  16. },
  17. OnSetInviteInfor:function(InviteInfor){
  18. console.log(InviteInfor);
  19. this._inviteInfor = InviteInfor;
  20. if(this._LabTime == null)this._LabTime = this.$('BGM/time@Label');
  21. if(this._LabContent == null)this._LabContent = this.$('BGM/content@Label');
  22. var now = new Date().getTime();
  23. if(Math.round((now - InviteInfor.time)/1000)>60){
  24. this.HideView();
  25. return;
  26. }
  27. this._time = 60 - Math.round((now - InviteInfor.time)/1000); //60;
  28. var webUrl = PHP_HOME+'/UserFunc.php?GetMark=12&dwUserID='+InviteInfor.dwUserID;
  29. WebCenter.GetData(webUrl, 1, function (data) {
  30. var Res = JSON.parse(data);
  31. var webUrl1 = PHP_HOME+'/League.php?GetMark=24&ClubID='+InviteInfor.dwClubID;
  32. WebCenter.GetData(webUrl1, 1, function (data1) {
  33. var Res1 = JSON.parse(data1);
  34. var str = '';
  35. console.log("////////////////////////",InviteInfor);
  36. console.log(this.m_GameList)
  37. str +='【'+Res1[0]+'】俱樂部玩家【'+Res["NickName"]+'】邀請您進行一場【'+GameList[InviteInfor.dwKindID]+'】遊戲,是否接受邀請?'
  38. this._LabContent.string = str;
  39. this._LabTime.string = this._time+'s';
  40. this.schedule(this.UpdateTime,1.0);
  41. }.bind(this));
  42. }.bind(this));
  43. },
  44. UpdateTime:function(){
  45. this._time--;
  46. this._LabTime.string = this._time+'s';
  47. if(this._time <= 0){
  48. this.HideView();
  49. }
  50. },
  51. onClick_Agree:function(){
  52. if(g_Lobby)g_Lobby.OnQueryRoom(this._inviteInfor.dwRoomID,this._inviteInfor.dwClubID);
  53. this.HideView();
  54. },
  55. });