您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字

157 行
4.7 KiB

  1. -- 总结算界面
  2. local ZPRoomCountAllView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomCountAllView")
  3. local changpaiRoomCountAllView = class("changpaiRoomCountAllView", ZPRoomCountAllView)
  4. function changpaiRoomCountAllView:ctor(response,endTime)
  5. changpaiRoomCountAllView.super.ctor(self,response,endTime);
  6. end
  7. function changpaiRoomCountAllView:loadUI()
  8. local ui = loadUI("zp_changpai/res/ui/ui_fangjian/changpai_ui_daju.ui");
  9. self.ui = ui;
  10. self:addChild(ui);
  11. end
  12. function changpaiRoomCountAllView:onEnter()
  13. changpaiRoomCountAllView.super.onEnter(self)
  14. local index = 1
  15. for nUserId,totalData in pairsByKeys(self.response) do
  16. local iamgeBg = string.format("ImageView_item_bg_%d",index)
  17. local uid = string.format("Text_ID_%d",index)
  18. if totalData.nTextJson then
  19. local dataJson = json.decode(totalData.nTextJson)
  20. local jiesanLab = self.ui.Items[uid]:getCopied()
  21. local jiesanPos = self.ui.Items[uid]:getPosition()
  22. local jiesaninfo = {
  23. [0] = "超时解散",
  24. [1] = "申请解散",
  25. [2] = "同意解散",
  26. [3] = "拒绝",
  27. [4] = "系统解散",
  28. }
  29. if dataJson.jiesan and dataJson.jiesan >= 0 then
  30. jiesanLab:setPositionY(jiesanPos.y - 168)
  31. jiesanLab:setAnchorPoint(cc.p(0.5, 0.5))
  32. jiesanLab:setColor(cc.c3b(255,155,155))
  33. jiesanLab:setText(jiesaninfo[dataJson.jiesan])
  34. self.ui.Items[iamgeBg]:addChild(jiesanLab)
  35. end
  36. end
  37. index = index + 1
  38. end
  39. end
  40. function changpaiRoomCountAllView:onExit()
  41. changpaiRoomCountAllView.super.onExit(self);
  42. end
  43. -- 防封群分享
  44. function changpaiRoomCountAllView:onClickFFQShare()
  45. app.waitDialogManager:showWaitNetworkDialog("获取分享链接")
  46. local onGetUrlCallback = function(url)
  47. app.waitDialogManager:closeWaitNetworkDialog()
  48. if url then
  49. local imagePath = cc.FileUtils:getInstance():getWritablePath().."icon.png"
  50. local gameName = getSubGameName(app.gameId) or "川南棋牌"
  51. logE("changpaiRoomCountAllView gid=",app.gameId,gameName,GAME_IDS.zgchangpai)
  52. local info = {}
  53. -- info.contentType = "image"
  54. info.image = fileName
  55. info.title = gameName.."战绩"
  56. info.FFQFlag = true
  57. -- info.imageWidth = 800
  58. info.menuIdxs = {1, 4, 5, 6}
  59. -- info.isShareZhanjiUrl = false
  60. info.copyData={
  61. type=1,
  62. tableId=app.room.roomInfo.nShowTableId,
  63. userInfos={},
  64. }
  65. local content = nil;
  66. local memberList = app.room.roomInfo.memberList--self._overData.nTotalPlayerInfos
  67. for k,v in pairs(self.response) do
  68. local userInfo = app.room:getUserInfo(k)
  69. --昵称
  70. local nickname = userInfo.nickname or ""
  71. local totalScore = v.nTotalScore or v.nTotalMoney
  72. table.insert(info.copyData.userInfos,{nickname=getShortName2(nickname),totalScore=totalScore})
  73. local strUserInfo = ""
  74. if totalScore > 0 then
  75. strUserInfo = string.format("%s(+%s)", getShortName2(nickname), totalScore)
  76. else
  77. strUserInfo = string.format("%s(%s)", getShortName2(nickname), totalScore)
  78. end
  79. if content then
  80. content = content .. "," .. strUserInfo
  81. else
  82. content = strUserInfo
  83. end
  84. end
  85. local sharUrl = string.format("%s?uid=%s&gameid=%s&app=%s&roomid=%s&endtime=%s",
  86. url,
  87. app.user.loginInfo.uid,
  88. app.gameId,
  89. getAppId(),
  90. app.room.roomInfo.nShowTableId,
  91. self.endTime or os.time())
  92. info.url = sharUrl
  93. info.description = content
  94. dump(info)
  95. local view = import("luaScript.Views.Main.ShareView"):new(info)
  96. view:setAnchorPoint(cc.p(0.5, 0.5))
  97. app:showWaitDialog(view)
  98. else
  99. showTooltip("获取分享用的链接失败")
  100. end
  101. end
  102. app.php:initShareZhanJiToUrl(onGetUrlCallback)
  103. end
  104. -- 分享
  105. function changpaiRoomCountAllView:onClickShare()
  106. local fileName = cc.FileUtils:getInstance():getWritablePath()..tostring(app.room.roomInfo.nShowTableId).."_screen.jpg"
  107. cc.FileUtils:getInstance():screenToFile(fileName, function(ret)
  108. if 1 == tonumber(ret) then
  109. local info = {}
  110. info.contentType = "image"
  111. info.image = fileName
  112. info.imageWidth = 800
  113. info.isShareZhanjiUrl = true
  114. info.copyData={
  115. type=1,
  116. tableId=app.room.roomInfo.nShowTableId,
  117. userInfos={},
  118. gameId=46,
  119. }
  120. for nUserId,totalData in pairsByKeys(self.response) do
  121. local userInfo = app.room:getUserInfo(nUserId)
  122. --昵称
  123. local nickname = userInfo.nickname or ""
  124. local totalScore = totalData.nTotalScore
  125. table.insert(info.copyData.userInfos,{nickname=getShortName2(nickname),totalScore=totalScore})
  126. end
  127. local view = import("luaScript.Views.Main.ShareView"):new(info,nil,{endtime=self.endTime})
  128. view:setAnchorPoint(cc.p(0.5, 0.5))
  129. app:showWaitDialog(view)
  130. else
  131. showTooltip("截图保存失败");
  132. end
  133. end);
  134. end
  135. return changpaiRoomCountAllView;