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

152 行
4.5 KiB

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