You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
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 xuyongRoomCountAllView = class("xuyongRoomCountAllView", ZPRoomCountAllView)
  5. function xuyongRoomCountAllView:ctor(response,endTime)
  6. xuyongRoomCountAllView.super.ctor(self,response,endTime);
  7. end
  8. function xuyongRoomCountAllView:onEnter()
  9. xuyongRoomCountAllView.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 xuyongRoomCountAllView:onExit()
  37. xuyongRoomCountAllView.super.onExit(self);
  38. end
  39. -- 防封群分享
  40. function xuyongRoomCountAllView: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. table.insert(info.copyData.userInfos,{nickname=nickname,totalScore=totalScore})
  68. local strUserInfo = ""
  69. if totalScore > 0 then
  70. strUserInfo = string.format("%s(+%s)", getShortName(nickname), totalScore)
  71. else
  72. strUserInfo = string.format("%s(%s)", getShortName(nickname), totalScore)
  73. end
  74. if content then
  75. content = content .. "," .. strUserInfo
  76. else
  77. content = strUserInfo
  78. end
  79. end
  80. local sharUrl = string.format("%s?uid=%s&gameid=%s&app=%s&roomid=%s&endtime=%s",
  81. url,
  82. app.user.loginInfo.uid,
  83. ZPDef.GameID,
  84. getAppId(),
  85. app.room.roomInfo.nShowTableId,
  86. self.endTime or os.time())
  87. info.url = sharUrl
  88. info.description = content
  89. dump(info)
  90. local view = import("luaScript.Views.Main.ShareView"):new(info)
  91. view:setAnchorPoint(cc.p(0.5, 0.5))
  92. app:showWaitDialog(view)
  93. else
  94. showTooltip("获取分享用的链接失败")
  95. end
  96. end
  97. app.php:initShareZhanJiToUrl(onGetUrlCallback)
  98. end
  99. -- 分享
  100. function xuyongRoomCountAllView:onClickShare()
  101. local fileName = cc.FileUtils:getInstance():getWritablePath()..tostring(app.room.roomInfo.nShowTableId).."_screen.jpg"
  102. cc.FileUtils:getInstance():screenToFile(fileName, function(ret)
  103. if 1 == tonumber(ret) then
  104. local info = {}
  105. info.contentType = "image"
  106. info.image = fileName
  107. info.imageWidth = 800
  108. info.isShareZhanjiUrl = true
  109. info.copyData={
  110. type=1,
  111. tableId=app.room.roomInfo.nShowTableId,
  112. userInfos={},
  113. gameId=ZPDef.GameID,
  114. }
  115. for nUserId,totalData in pairsByKeys(self.response) do
  116. local userInfo = app.room:getUserInfo(nUserId)
  117. --昵称
  118. local nickname = userInfo.nickname or ""
  119. local totalScore = totalData.nTotalScore
  120. table.insert(info.copyData.userInfos,{nickname=nickname,totalScore=totalScore})
  121. end
  122. local view = import("luaScript.Views.Main.ShareView"):new(info,nil,{endtime=self.endTime})
  123. view:setAnchorPoint(cc.p(0.5, 0.5))
  124. app:showWaitDialog(view)
  125. else
  126. showTooltip("截图保存失败");
  127. end
  128. end);
  129. end
  130. return xuyongRoomCountAllView;