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.

149 lines
4.4 KiB

  1. -- 总结算界面
  2. local ZPRoomCountAllView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomCountAllView")
  3. local luzhouRoomCountAllView = class("luzhouRoomCountAllView", ZPRoomCountAllView)
  4. function luzhouRoomCountAllView:ctor(response,endTime)
  5. luzhouRoomCountAllView.super.ctor(self,response,endTime);
  6. end
  7. function luzhouRoomCountAllView:onEnter()
  8. luzhouRoomCountAllView.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. function luzhouRoomCountAllView:onExit()
  36. luzhouRoomCountAllView.super.onExit(self);
  37. end
  38. -- 防封群分享
  39. function luzhouRoomCountAllView:onClickFFQShare()
  40. app.waitDialogManager:showWaitNetworkDialog("获取分享链接")
  41. local onGetUrlCallback = function(url)
  42. app.waitDialogManager:closeWaitNetworkDialog()
  43. if url then
  44. local imagePath = cc.FileUtils:getInstance():getWritablePath().."icon.png"
  45. local gameName = getSubGameName(GAME_IDS.luzhouDaEr) or "川南棋牌"
  46. local info = {}
  47. -- info.contentType = "image"
  48. info.image = fileName
  49. info.title = gameName.."战绩"
  50. info.FFQFlag = true
  51. -- info.imageWidth = 800
  52. info.menuIdxs = {1, 4, 5, 6}
  53. -- info.isShareZhanjiUrl = false
  54. info.copyData={
  55. type=1,
  56. tableId=app.room.roomInfo.nShowTableId,
  57. userInfos={},
  58. }
  59. local content = nil;
  60. local memberList = app.room.roomInfo.memberList--self._overData.nTotalPlayerInfos
  61. for k,v in pairs(self.response) do
  62. local userInfo = app.room:getUserInfo(k)
  63. --昵称
  64. local nickname = userInfo.nickname or ""
  65. local totalScore = v.nTotalScore or v.nTotalMoney
  66. table.insert(info.copyData.userInfos,{nickname=getShortName2(nickname),totalScore=totalScore})
  67. local strUserInfo = ""
  68. if totalScore > 0 then
  69. strUserInfo = string.format("%s(+%s)", getShortName2(nickname), totalScore)
  70. else
  71. strUserInfo = string.format("%s(%s)", getShortName2(nickname), totalScore)
  72. end
  73. if content then
  74. content = content .. "," .. strUserInfo
  75. else
  76. content = strUserInfo
  77. end
  78. end
  79. local sharUrl = string.format("%s?uid=%s&gameid=%s&app=%s&roomid=%s&endtime=%s",
  80. url,
  81. app.user.loginInfo.uid,
  82. GAME_IDS.luzhouDaEr,
  83. getAppId(),
  84. app.room.roomInfo.nShowTableId,
  85. self.endTime or os.time())
  86. info.url = sharUrl
  87. info.description = content
  88. dump(info)
  89. local view = import("luaScript.Views.Main.ShareView"):new(info)
  90. view:setAnchorPoint(cc.p(0.5, 0.5))
  91. app:showWaitDialog(view)
  92. else
  93. showTooltip("获取分享用的链接失败")
  94. end
  95. end
  96. app.php:initShareZhanJiToUrl(onGetUrlCallback)
  97. end
  98. -- 分享
  99. function luzhouRoomCountAllView:onClickShare()
  100. local fileName = cc.FileUtils:getInstance():getWritablePath()..tostring(app.room.roomInfo.nShowTableId).."_screen.jpg"
  101. cc.FileUtils:getInstance():screenToFile(fileName, function(ret)
  102. if 1 == tonumber(ret) then
  103. local info = {}
  104. info.contentType = "image"
  105. info.image = fileName
  106. info.imageWidth = 800
  107. info.isShareZhanjiUrl = true
  108. info.copyData={
  109. type=1,
  110. tableId=app.room.roomInfo.nShowTableId,
  111. userInfos={},
  112. gameId=32,
  113. }
  114. for nUserId,totalData in pairsByKeys(self.response) do
  115. local userInfo = app.room:getUserInfo(nUserId)
  116. --昵称
  117. local nickname = userInfo.nickname or ""
  118. local totalScore = totalData.nTotalScore
  119. table.insert(info.copyData.userInfos,{nickname=getShortName2(nickname),totalScore=totalScore})
  120. end
  121. local view = import("luaScript.Views.Main.ShareView"):new(info,nil,{endtime=self.endTime})
  122. view:setAnchorPoint(cc.p(0.5, 0.5))
  123. app:showWaitDialog(view)
  124. else
  125. showTooltip("截图保存失败");
  126. end
  127. end);
  128. end
  129. return luzhouRoomCountAllView;