Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

155 строки
4.9 KiB

  1. --
  2. -- xx : 2018 3 27
  3. -- 跑得快战绩单轮详情界面
  4. local PdkDef = require("luaScript.SubGameDefine.Poker.luzhouPdkWanFa")
  5. local PdkDanJuItem = class("PdkDanJuItem")
  6. -- lunshuInfo : 轮数的意思是,一个房间里面会打多局,可能因为流局的原因,某一局要打多轮
  7. -- 标记是否来自俱乐部的作用是:在获取回放数据的时候,确定是使用俱乐部的协议还是子游戏的协议
  8. function PdkDanJuItem:ctor(lunshuInfo, isFromClub)
  9. -- 本局详细信息
  10. self.lunshuInfo = lunshuInfo;
  11. -- 是否来自俱乐部
  12. self.isFromClub = isFromClub;
  13. self.ui = loadUI("pk_luzhoupdk/res/ui/ui_zhanji/ui_lzpdk_zhanji_danju_item.ui")
  14. self.txtScores = {}
  15. for i=1,4 do
  16. local scoreLayout = self.ui.Items["Layout_player_score_"..i]
  17. scoreLayout:setVisible(false)
  18. self.txtScores[i] = self.ui.Items["Text_score_"..i]
  19. self.txtScores[i]:setString("")
  20. end
  21. self:loadData()
  22. self.ui.Items.Button_share:setVisible(false)
  23. -- self.ui.Items.Button_detail:setVisible(false)
  24. self.ui.Items.Button_detail:registerClick(handler(self , self.onClickButtonDetail))
  25. end
  26. function PdkDanJuItem:loadData()
  27. self.ui.Items.Text_xuhao:setString(string.format("%d", self.lunshuInfo.idx))
  28. self.ui.Items.Text_time:setString(os.date("%m-%d %H:%M:%S", self.lunshuInfo.endtime))
  29. if self.lunshuInfo.flag and (self.lunshuInfo.flag == 8 or self.lunshuInfo.flag == 9) then
  30. self.ui.Items.ImageView_Flag:setVisible(true)
  31. else
  32. self.ui.Items.ImageView_Flag:setVisible(false)
  33. end
  34. local endFlag = self.lunshuInfo.flag
  35. local jiesanInfo
  36. if self.lunshuInfo.ext and self.lunshuInfo.ext.disbandStatus then
  37. jiesanInfo = self.lunshuInfo.ext.disbandStatus
  38. end
  39. local count = 0
  40. local scoreCount = table.nums(self.lunshuInfo.score)
  41. for uid,score in pairs(self.lunshuInfo.score) do
  42. count = count + 1
  43. if score>0 then
  44. self.txtScores[count]:setFntFile("res/fonts/zhanji_win.fnt")
  45. self.txtScores[count]:setString(string.format("+%d", score))
  46. else
  47. self.txtScores[count]:setFntFile("res/fonts/zhanji_lose.fnt")
  48. self.txtScores[count]:setString(string.format("%d", score))
  49. end
  50. --昵称
  51. local playerInfo = app.playerInfoManager:getPlayerInfo(uid);
  52. if playerInfo then
  53. local len = string.len(playerInfo.name)
  54. if len == 0 then
  55. playerInfo.name = "未知昵称"
  56. end
  57. playerInfo.name = getSubStringNickname(playerInfo.name)
  58. local nameNode = string.format("Text_player_name_%d",count)
  59. self.ui.Items[nameNode]:setText(playerInfo.name)
  60. end
  61. local jsNameNode = string.format("Text_jiesanInfo_%d",count)
  62. local jsItemNode = self.ui.Items[jsNameNode]
  63. if endFlag == 9 and jiesanInfo then
  64. jsItemNode:setVisible(true)
  65. if jiesanInfo[uid] and jiesanInfo[uid] == 0 then
  66. jsItemNode:setText("超时解散")
  67. jsItemNode:setColor(cc.c3b(0,255,0))
  68. elseif jiesanInfo[uid] and jiesanInfo[uid] == 1 then
  69. jsItemNode:setText("申请解散")
  70. jsItemNode:setColor(cc.c3b(255,0,0))
  71. elseif jiesanInfo[uid] and jiesanInfo[uid] == 2 then
  72. jsItemNode:setText("同意解散")
  73. jsItemNode:setColor(cc.c3b(0,255,0))
  74. elseif jiesanInfo[uid] and jiesanInfo[uid] == 3 then
  75. jsItemNode:setText("拒绝解散")
  76. end
  77. elseif endFlag == 8 then--系统解散
  78. jsItemNode:setVisible(true)
  79. jsItemNode:setText("系统解散")
  80. jsItemNode:setColor(cc.c3b(255,0,0))
  81. else
  82. jsItemNode:setVisible(false)
  83. end
  84. local scoreLayout = self.ui.Items["Layout_player_score_"..count]
  85. scoreLayout:setSize(cc.size(1028/scoreCount,90))
  86. scoreLayout:setVisible(true)
  87. end
  88. end
  89. function PdkDanJuItem:getRoot()
  90. return self.ui
  91. end
  92. function PdkDanJuItem:onEnter()
  93. PdkDanJuItem.super.onEnter()
  94. end
  95. function PdkDanJuItem:onExit()
  96. end
  97. function PdkDanJuItem:onClickButtonDetail( sender )
  98. playBtnEffect()
  99. --[[if self.lunshuInfo.flag == 9 then
  100. showTooltip("本局提前解散")
  101. return
  102. end--]]
  103. local protocolZhanJi
  104. if self.isFromClub then
  105. protocolZhanJi = app.club_zhanji
  106. else
  107. protocolZhanJi = app:getProtocolZhanJi(GAME_IDS.luzhouPaoDeKuai)
  108. end
  109. local function showRecoreView( )
  110. app.waitDialogManager:closeWaitNetworkDialog()
  111. local recordData = nil
  112. local zhanjiInfo = protocolZhanJi.zhanjiInfoList[self.lunshuInfo.pid]
  113. if zhanjiInfo and zhanjiInfo.detail then
  114. local rdata
  115. for k,v in pairs(zhanjiInfo.detail) do
  116. local d = v["1"]
  117. if d then
  118. if d.subid == self.lunshuInfo.subid then
  119. recordData = d
  120. break
  121. end
  122. end
  123. end
  124. end
  125. if recordData and recordData.ops then--回放数据
  126. recordData.nbound = self.lunshuInfo.nbound
  127. recordData.roomid = self.lunshuInfo.roomid
  128. local view = import("pk_luzhoupdk.luaScript.Views.Room.luzhouPdkRoomPlayView"):new(recordData)
  129. view:setAnchorPoint(cc.p(0.5, 0.5))
  130. app:showWaitDialog(view)
  131. else
  132. showTooltip("本局数据不支持回放")
  133. end
  134. end
  135. if protocolZhanJi then
  136. app.waitDialogManager:showWaitNetworkDialog()
  137. protocolZhanJi:getZhanJiDetail(self.lunshuInfo.pid, self.lunshuInfo.subid, showRecoreView)
  138. end
  139. end
  140. return PdkDanJuItem