local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef") local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions") local ZPSound = ZPFramework.ZPImport("zp_base.luaScript.ZPSound") local ZPRoomXiaoJuView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomXiaoJuView") local hejiangRoomXiaoJuView = class("hejiangRoomXiaoJuView",ZPRoomXiaoJuView) function hejiangRoomXiaoJuView:ctor(nextCallBackFun,isRecontect) hejiangRoomXiaoJuView.super.ctor(self,nextCallBackFun,isRecontect); end function hejiangRoomXiaoJuView:onEnter() hejiangRoomXiaoJuView.super.onEnter(self) end function hejiangRoomXiaoJuView:updatePlayerInfo() local maxTurnScore = self:getMaxTurnScore(self.xiaojuData) --非小家的3个玩家是否有最大分数这个值 local isNormolPlayerWiner = false for k,v in pairs(self.xiaojuData) do if app.room:checkUserIDIsInTable(v.nUserId) then if tonumber(v.nTurnScore) == maxTurnScore then if not self:isLittleUid(v.nUserId) then isNormolPlayerWiner = true end end end end local index = 1 local idx = 2 local isOneHaved = false local i = 1; for k,v in pairsByKeys(self.xiaojuData) do v.nTurnScore = tonumber(v.nTurnScore) if app.room:checkUserIDIsInTable(v.nUserId) then if self:isLittleUid(v.nUserId) then i = 4; else if isNormolPlayerWiner then if v.nTurnScore == maxTurnScore and not isOneHaved then i = 1; isOneHaved = true else i = idx; idx = idx + 1; end else i = index index = index + 1 end end local roomInfo = app.room.roomInfo local userInfo = app.room:getUserInfo(v.nUserId) local viewId = app.room:getViewIdByUserId(v.nUserId) local nWinerId = app.room.roomInfo.winUserId local dianPaoUserId = app.room.roomInfo.dianPaoUserId local bankerId = app.room:getUserIdBySeatId(app.room.roomInfo.nBankSeatId) local stopFlag = app.room.roomInfo.stopFlag if v.nTurnScore > 0 then self.allNode[i].nodewinScore:setText(tostring("+"..v.nTurnScore)) self.allNode[i].nodeloseScore:setVisible(false) else self.allNode[i].nodeloseScore:setText(v.nTurnScore) self.allNode[i].nodewinScore:setVisible(false) self.allNode[i].nodewinBg:setVisible(false) end self.allNode[i].nodelayoutHuinfo:setVisible(false) self.allNode[i].nodehutype:setVisible(false) --先设置默认头像 local width = self.allNode[i].nodeHead:getContentSize().width local nickname = "" if userInfo and userInfo.nickname then nickname = getSubStringNickname(userInfo.nickname) self:updateUserHead(self.allNode[i].nodeHead,v.nUserId, userInfo.sex, userInfo.headimgurl); end --名称 self.allNode[i].nodeName:setText(nickname) --ID self.allNode[i].nodeID:setText(tostring("ID:"..v.nUserId)) --显示隐藏游戏内选手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.allNode[i].nodeID:setVisible(true) else self.allNode[i].nodeID:setVisible(false) end end end end if v.nUserId == tonumber(app.user.loginInfo.uid) then self.allNode[i].nodeID:setVisible(true) end -- end --庄家 if bankerId == v.nUserId then self.allNode[i].nodeBanker:setVisible(true) else self.allNode[i].nodeBanker:setVisible(false) end --点炮玩家 if dianPaoUserId == v.nUserId then self.allNode[i].nodefangPao:setVisible(false) --更换显示方式 local ui = self:getAHutypeUi(0,"zp_mt_dianpao.png") self.allNode[i].nodelayoutHuTypes:addChild(ui) else self.allNode[i].nodefangPao:setVisible(false) end --组合牌展示 local data = self.xiaojuData[v.nUserId] if not data then return end local isHuUid = false--是否是赢牌者uid for huk,huv in pairs(roomInfo.hupaiInfo) do if huv.huPaiUid == v.nUserId then isHuUid = true app.room.roomInfo.huCard = huv.huCard self.allNode[i].nodelayoutHuinfo:setVisible(true) --显示胡牌 self.allNode[i].nodeHushu:setText(huv.huPaiHuShu) self.allNode[i].nodeBeishu:setText(huv.multiNum) local huDes = { [1] = "十",[2] = "二十",[3] = "三十",[4] = "四十",[5] = "五十",[6] = "六十",[7] = "七十",[8] = "八十", [9] = "九十",[10] = "一百",[20] = "二百",[30] = "三百", } --查叫 if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then local ui = self:getAHutypeUi(0,"zp_mt_chajiao.png") self.allNode[i].nodelayoutHuTypes:addChild(ui) end --非自摸 非点炮 显示堂出 if huv.dianPaoUid <= 0 and not ZPFuc.isZiMo(huv.huTypes) then local ui = self:getAHutypeUi(0,"zp_mt_tangchu.png") self.allNode[i].nodelayoutHuTypes:addChild(ui) end local huDNum = math.floor(huv.huPaiHuShu/10) if huv.huPaiHuShu == 0 then self.allNode[i].nodehuinfo:setText("乱胡")--显示无胡 local ui = self:getAHutypeUi(0) self.allNode[i].nodelayoutHuTypes:addChild(ui) elseif huDNum > 0 then if huv.huPaiHuShu%10 == 0 then self.allNode[i].nodehuinfo:setText("恰"..huDes[huDNum].."胡")--显示梗 local ui = self:getAHutypeUi(0,"zp_mt_geng.png") self.allNode[i].nodelayoutHuTypes:addChild(ui) else self.allNode[i].nodehuinfo:setText(huDes[huDNum].."多胡") end else self.allNode[i].nodehuinfo:setText(huv.huPaiHuShu.."胡") end if huv.guiNum and huv.guiNum > 0 then local gui = string.format("zp_mt_gui%d.png",huv.guiNum) local ui = self:getAHutypeUi(0,gui) self.allNode[i].nodelayoutHuTypes:addChild(ui) end self:showHuTypes(self.allNode[i].nodelayoutHuTypes,huv.huTypes) end end local index = 0 for key,value in pairs(data.tableWeaveCard) do local list,operationType = ZPFuc.getZPCardList(value.card,value.type) local card = value.opcard list = ZPFuc.getOpCardFirstList(operationType,list,card) --上面吃或不吃不要用if else因为还可能都不成立 if list then self:createWeaveCard(value,list,index,false,self.allNode[i].nodeLayout,v.nUserId) end index = index + 1 end --只显示一次胡变为opCard local showOneTime = true for k,value in pairs(data.handCard) do local list,operationType = ZPFuc.getZPCardList(value.card,value.type) local card = value.opcard --判断组合牌里是否有胡的那张 local haveHuCard = false for t = 1,3 do if app.room.roomInfo.huCard == list[t] then haveHuCard = true break end end --如果是吃胡,并且手里的这次的组合牌里还有胡的那张 if showOneTime and haveHuCard and app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU then card = app.room.roomInfo.huCard showOneTime = false end list = ZPFuc.getOpCardFirstList(operationType,list,card) if value.type == ZPDef.SendCardType.KAN_THREE_SAME then value.type = ZPDef.SendCardType.KANPAI_LOCAL end --上面吃或不吃不要用if else因为还可能都不成立 if list then self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId) end index = index + 1 end --本局结束 if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_NORMAL then if #roomInfo.hupaiInfo > 0 then if v.nTurnScore > 0 then if v.nUserId == app.user.loginInfo.uid then ZPSound.PlayWinGame() end else if v.nUserId == app.user.loginInfo.uid then ZPSound.PlayLoseGame() end end end end --indexPlayer = indexPlayer + 1 if isHuUid and true == isHuUid then self:showHuCardBox(self.allNode[i].nodeLayout,app.room.roomInfo.huCard) end end end self:showDiPai() end return hejiangRoomXiaoJuView;