-- 总结算界面 local ZPRoomCountAllView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomCountAllView") local doushisiRoomCountAllView = class("doushisiRoomCountAllView", ZPRoomCountAllView) function doushisiRoomCountAllView:ctor(response,endTime) doushisiRoomCountAllView.super.ctor(self,response,endTime); end function doushisiRoomCountAllView:onEnter() doushisiRoomCountAllView.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 --显示隐藏游戏内选手id(主办人和管理员不限制,只针对海选赛) -- todo lwq -- begin local ClubDefine = require("luaScript.Protocol.Club.ClubDefine") if app.club_php.clubID and app.club_php.clubID ~= 0 then if app.club_php:getCestIsOpen(app.club_php.clubID) then --隐私数据 local clubInfo = app.club_php.clubList[app.club_php.clubID] self.cliext = clubInfo.groupext and clubInfo.groupext.cliext if not self.cliext or not self.cliext.is_hideUid or (self.cliext and self.cliext.is_hideUid == 1) then if clubInfo.role == ClubDefine.Job.Creator or clubInfo.role == ClubDefine.Job.Manager then self.ui.Items[uid]:setVisible(true) else self.ui.Items[uid]:setVisible(false) end end end end if nUserId == tonumber(app.user.loginInfo.uid) then self.ui.Items[uid]:setVisible(true) end -- end end index = index + 1 end end function doushisiRoomCountAllView:onExit() doushisiRoomCountAllView.super.onExit(self); end function doushisiRoomCountAllView:loadUI() local ui = loadUI("zp_doushisi/res/ui/ui_fangjian/doushisi_ui_daju.ui"); self.ui = ui; self:addChild(ui); end -- 防封群分享 function doushisiRoomCountAllView: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(GAME_IDS.doushisiDaEr) or "川南棋牌" 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 totalScore = tonumber(totalScore) 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, GAME_IDS.doushisi, 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 doushisiRoomCountAllView: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=47, } 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 function doushisiRoomCountAllView:playAni() --判断大赢家和土豪 local tuhaoScore = -999999 local winerScore = -999999 local tt = {} --排除都为0的情况 local zeorNum = 0 for k,v in pairs(self.response) do if v.nTotalScore == 0 then zeorNum = zeorNum + 1 end end local maxPeople = table.nums(self.response) if zeorNum ~= maxPeople then for k,v in pairs(self.response) do table.insert(tt,v.nTotalScore) end local function sortFunc(a,b) return a < b end table.sort(tt,sortFunc) tuhaoScore = tt[1] winerScore = tt[maxPeople] end self:setAllDaYingJiaVisible(false) local index = 1 for nUserId,totalData in pairsByKeys(self.response) do if (not (tolua.type(app.room.isLianDa) == "function")) or (tolua.type(app.room.isLianDa) == "function" and app.room:checkUserIDIsInTable(nUserId)) then -- 玩家头像 名字 local beizi = string.format("ImageView_Bei_%d",index) local yingLight = string.format("ImageView_light_%d",index) local nodePlayer = string.format("Layout_player_%d",index) local totalScore = totalData.nTotalScore --分数 if totalScore == winerScore then local tarPos = cc.pAdd(self.ui.Items[beizi]:getPosition(),cc.p(0,30)) self.ui.Items[beizi]:setScale(1) --self.ui.Items[beizi]:setOpacity(0) local mSpawn = cc.Spawn:create(cc.ScaleTo:create(0.2,1.0),cc.FadeIn:create(0.2)) local seq = cc.Sequence:create(cc.DelayTime:create(0.15 * 5),mSpawn) --self.ui.Items[beizi]:runAction(seq) self.ui.Items[beizi]:setVisible(true) self.ui.Items[yingLight]:setVisible(true) else self.ui.Items[beizi]:setVisible(false) self.ui.Items[yingLight]:setVisible(false) end --self.ui.Items[nodePlayer]:setOpacity(0) local mSpawn = cc.Spawn:create(cc.MoveBy:create(0.2,cc.p(0,120)),cc.FadeIn:create(0.2)) local seq = cc.Sequence:create(cc.DelayTime:create(0.15 * index),cc.CallFunc:create(function () self.ui.Items[nodePlayer]:setPositionY(self.ui.Items[nodePlayer]:getPositionY() - 120) end),mSpawn) --self.ui.Items[nodePlayer]:runAction(seq) index = index + 1 end end self.ui.Items.Layout_3:setVisible(true); --[[ local seq = cc.Sequence:create(cc.DelayTime:create(0.35*index),cc.CallFunc:create(function () self.ui.Items.Layout_3:setVisible(true); end))--]] --self.ui:runAction(seq) end return doushisiRoomCountAllView;