您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

149 行
4.4 KiB

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