ClubRecordInfoItem.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. ctor:function(){
  6. },
  7. InitPre:function(){
  8. if(this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
  9. this.m_ListCtrl.InitList(0, 'ClubRecordUserItem2', this);
  10. this.node.active = false;
  11. },
  12. SetPreInfo:function(ParaArr){//0 Kind 1 RecordID 2 index 3 info
  13. this.node.active = true;
  14. this.m_KindID = ParaArr[1][0];
  15. this.m_RecordID = ParaArr[1][1];
  16. this.m_GameIndex = ParaArr[1][2];
  17. this.m_ScoreInfo = ParaArr[1][3];
  18. this.$('Info/LabTime@Label').string = this.m_ScoreInfo['Time'];
  19. this.$('Info/LbIndex@Label').string = pad(this.m_GameIndex, 2) ;
  20. for(var i in this.m_ScoreInfo){
  21. if(i == 'Time') continue;
  22. this.m_ListCtrl.InsertListInfo(0, [i, this.m_ScoreInfo[i]]);
  23. }
  24. },
  25. OnClick_RePlayGame:function(){
  26. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  27. g_Lobby.OnRePlayGame(this.m_RecordID, this.m_KindID, pGlobalUserData, this.m_GameIndex - 1);
  28. },
  29. OnAnalysisReplay:function(){
  30. return
  31. GameDef = new window['CMD_GAME_'+this.m_KindID]();
  32. //显示手牌(回放 处理逻辑 )
  33. try {
  34. this.m_ReplayEngine = this.node.getComponent('ReplayEngine_'+this.m_KindID);
  35. if(this.m_ReplayEngine == null) this.m_ReplayEngine = this.node.addComponent('ReplayEngine_'+this.m_KindID);
  36. } catch (error) {
  37. if(window.LOG_NET_DATA)console.log(error)
  38. return false;
  39. }
  40. var webUrl = window.PHP_HOME+'/GameRecord.php?&GetMark=1&ID='+this.m_RecordID+'&GameIndex='+(this.m_GameIndex-1);
  41. WebCenter.GetData(webUrl, 999999, function (data) {
  42. if(data.length < 50){
  43. console.log('err 11111 ',webUrl)
  44. return
  45. }
  46. var RecordInfo = JSON.parse(data);
  47. if(RecordInfo[0] == 0) {
  48. console.log('err 22222 ',webUrl)
  49. return
  50. }
  51. if(this.m_ReplayEngine){
  52. this.m_ReplayEngine.SetData(RecordInfo[3], 0, true);
  53. for(var i in this.m_ReplayEngine.GameData[0].user){
  54. var TempUserID = this.m_ReplayEngine.GameData[0].user[i].dwUserID;
  55. var TempChairID = this.m_ReplayEngine.GameData[0].user[i].wChairID;
  56. var Score,CardData,CardType,Banker,Player,bBanker;
  57. Score = this.m_ReplayEngine.GameData.GameEnd.llGameScore[TempChairID];
  58. if(this.m_ReplayEngine.GameData.CardData) CardData = this.m_ReplayEngine.GameData.CardData[TempChairID];
  59. //牌型
  60. if(this.m_ReplayEngine.GameData.OxType) CardType = this.m_ReplayEngine.GameData.OxType[TempChairID];
  61. //庄显示
  62. if(this.m_ReplayEngine.GameData.lBankerCall) Banker = this.m_ReplayEngine.GameData.lBankerCall[TempChairID];
  63. if(Banker == 0xff) Banker='';
  64. if(Banker == 0) Banker='不搶';
  65. if(Banker > 0 && Banker < 0xff) Banker+='倍';
  66. //闲显示
  67. if(this.m_ReplayEngine.GameData.lPlayerCall) Player = this.m_ReplayEngine.GameData.lPlayerCall[TempChairID];
  68. if(Player == 0) Player='';
  69. if(Player > 0 ) Player='X'+Player;
  70. bBanker = this.m_ReplayEngine.GameData.wBankerUser == TempChairID;
  71. this.m_ListCtrl.InsertListInfo(0, [TempUserID, Score, CardData, this.m_ReplayEngine.GameData.CardCnt, CardType, Banker, Player, bBanker]);//0 UserID 1 Score 2 Card 3 CardCnt 4 Type 5Banker 6Player 7bBanker
  72. }
  73. }
  74. }.bind(this));
  75. },
  76. });