|
- -- 总结算界面
- local ZPRoomCountAllView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomCountAllView")
-
- local ErWuRoomCountAllView = class("ErWuRoomCountAllView", ZPRoomCountAllView)
-
- function ErWuRoomCountAllView:ctor(response,endTime)
- ErWuRoomCountAllView.super.ctor(self,response,endTime);
-
- end
-
- function ErWuRoomCountAllView:loadUI()
- local ui = loadUI("zp_erwu/res/ui/ui_fangjian/erwu_ui_daju.ui");
- self.ui = ui;
- self:addChild(ui);
- end
-
- function ErWuRoomCountAllView:onEnter()
- ErWuRoomCountAllView.super.onEnter(self)
-
- local index = 1
- for nUserId,totalData in pairsByKeys(self.response) do
- local iamgeBg = string.format("ImageView_item_bg_%d",index)
- local uid = string.format("Text_ID_%d",index)
-
- if totalData.nTextJson then
- local dataJson = json.decode(totalData.nTextJson)
- local jiesanLab = self.ui.Items[uid]:getCopied()
- local jiesanPos = self.ui.Items[uid]:getPosition()
- local jiesaninfo = {
- [0] = "超时解散",
- [1] = "申请解散",
- [2] = "同意解散",
- [3] = "拒绝",
- [4] = "系统解散",
- }
- if dataJson.jiesan and dataJson.jiesan >= 0 then
- jiesanLab:setPositionY(jiesanPos.y - 168)
- jiesanLab:setAnchorPoint(cc.p(0.5, 0.5))
- jiesanLab:setColor(cc.c3b(255,155,155))
- jiesanLab:setText(jiesaninfo[dataJson.jiesan])
- self.ui.Items[iamgeBg]:addChild(jiesanLab)
- end
- end
-
- index = index + 1
- end
- end
-
-
- function ErWuRoomCountAllView:onExit()
- ErWuRoomCountAllView.super.onExit(self);
- end
-
- -- 防封群分享
- function ErWuRoomCountAllView:onClickFFQShare()
- app.waitDialogManager:showWaitNetworkDialog("获取分享链接")
- local onGetUrlCallback = function(url)
- app.waitDialogManager:closeWaitNetworkDialog()
- if url then
- local imagePath = cc.FileUtils:getInstance():getWritablePath().."icon.png"
-
- local gameName = getSubGameName(app.gameId) or "川南棋牌"
- logE("ErWuRoomCountAllView gid=",app.gameId,gameName,GAME_IDS.ErWu)
-
- local info = {}
- -- info.contentType = "image"
- info.image = fileName
- info.title = gameName.."战绩"
- info.FFQFlag = true
- -- info.imageWidth = 800
- info.menuIdxs = {1, 4, 5, 6}
- -- info.isShareZhanjiUrl = false
- info.copyData={
- type=1,
- tableId=app.room.roomInfo.nShowTableId,
- userInfos={},
- }
- local content = nil;
- local memberList = app.room.roomInfo.memberList--self._overData.nTotalPlayerInfos
-
- for k,v in pairs(self.response) do
- local userInfo = app.room:getUserInfo(k)
- --昵称
- local nickname = userInfo.nickname or ""
- local totalScore = v.nTotalScore or v.nTotalMoney
- table.insert(info.copyData.userInfos,{nickname=getShortName2(nickname),totalScore=totalScore})
-
- local strUserInfo = ""
- if totalScore > 0 then
- strUserInfo = string.format("%s(+%s)", getShortName2(nickname), totalScore)
- else
- strUserInfo = string.format("%s(%s)", getShortName2(nickname), totalScore)
- end
- if content then
- content = content .. "," .. strUserInfo
- else
- content = strUserInfo
- end
- end
-
- local sharUrl = string.format("%s?uid=%s&gameid=%s&app=%s&roomid=%s&endtime=%s",
- url,
- app.user.loginInfo.uid,
- app.gameId,
- getAppId(),
- app.room.roomInfo.nShowTableId,
- self.endTime or os.time())
- info.url = sharUrl
- info.description = content
- dump(info)
- local view = import("luaScript.Views.Main.ShareView"):new(info)
- view:setAnchorPoint(cc.p(0.5, 0.5))
- app:showWaitDialog(view)
- else
- showTooltip("获取分享用的链接失败")
- end
- end
- app.php:initShareZhanJiToUrl(onGetUrlCallback)
- end
-
- -- 分享
- function ErWuRoomCountAllView:onClickShare()
- local fileName = cc.FileUtils:getInstance():getWritablePath()..tostring(app.room.roomInfo.nShowTableId).."_screen.jpg"
-
- cc.FileUtils:getInstance():screenToFile(fileName, function(ret)
- if 1 == tonumber(ret) then
- local info = {}
- info.contentType = "image"
- info.image = fileName
- info.imageWidth = 800
- info.isShareZhanjiUrl = true
-
- info.copyData={
- type=1,
- tableId=app.room.roomInfo.nShowTableId,
- userInfos={},
- gameId=GAME_IDS.ErWu,
- }
-
- for nUserId,totalData in pairsByKeys(self.response) do
- local userInfo = app.room:getUserInfo(nUserId)
- --昵称
- local nickname = userInfo.nickname or ""
- local totalScore = totalData.nTotalScore
- table.insert(info.copyData.userInfos,{nickname=getShortName2(nickname),totalScore=totalScore})
- end
-
- local view = import("luaScript.Views.Main.ShareView"):new(info,nil,{endtime=self.endTime})
- view:setAnchorPoint(cc.p(0.5, 0.5))
- app:showWaitDialog(view)
- else
- showTooltip("截图保存失败");
- end
- end);
- end
-
- return ErWuRoomCountAllView;
|