LobbyRoom.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. //Pre js
  6. InitPre:function(){
  7. },
  8. SetPreInfo:function(ParaArr){ //OwnRoomInfo
  9. this.m_dwRoomID = ParaArr.dwRoomID;
  10. this.m_wKindID = ParaArr.wKindID;
  11. if(ParaArr.dwClubID)this.m_dwClubID = ParaArr.dwClubID;
  12. this.m_dwRules = ParaArr.dwRules;
  13. this.m_dwServerRules = ParaArr.dwServerRules;
  14. var gamedef = new window['CMD_GAME_'+ParaArr.wKindID]();
  15. this.$('room@Label').string = ParaArr.dwRoomID;
  16. this.$('score@Label').string = '';
  17. this.$('rule@Label').string = '';
  18. this.$('pay@Label').string = '';
  19. this.$('subroom@Label').string = '';
  20. this.$('people@Label').string = '';
  21. if(gamedef.GetBaseScore) this.$('score@Label').string = gamedef.GetBaseScore(this.m_dwServerRules, this.m_dwRules);
  22. if(gamedef.GetGameMode) this.$('rule@Label').string = gamedef.GetGameMode(this.m_dwServerRules, this.m_dwRules);
  23. if(gamedef.GetPayMode) this.$('pay@Label').string = gamedef.GetPayMode(this.m_dwServerRules, this.m_dwRules);
  24. if(gamedef.GetGameCount) this.$('subroom@Label').string = gamedef.GetGameCount(this.m_dwServerRules, this.m_dwRules);
  25. this.$('people@Label').string = ParaArr.byPlayerCnt;
  26. },
  27. OnClick_EnterRoom:function(){
  28. g_Lobby.OnQueryRoom(this.m_dwRoomID, this.m_dwClubID);
  29. },
  30. OnClick_Share:function(){
  31. this.GetShareInfo();
  32. },
  33. //分享信息
  34. GetShareInfo: function() {
  35. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  36. var ShareInfo = new Object();
  37. ShareInfo.title = '房號【'+this.m_dwRoomID+'】 ' + g_GlobalUserInfo.m_UserInfoMap[pGlobalUserData.dwUserID].NickName + "邀請您來玩" + window.GameList[this.m_wKindID];
  38. var gamedef = new window['CMD_GAME_'+this.m_wKindID]();
  39. ShareInfo.desc = gamedef.GetGameMode(this.m_dwServerRules, this.m_dwRules);
  40. ShareInfo.imgUrl = window.PHP_HOME + '/app01/App.jpg';
  41. ShareInfo.link = cc.share.MakeLink_InviteRoom(this.m_dwRoomID, this.m_dwClubID);
  42. ThirdPartyShareMessage(ShareInfo,0)
  43. return ShareInfo;
  44. },
  45. /////////////////////////////////////////////////////////////////////////////
  46. });