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.

155 lines
4.6 KiB

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