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 ZPRoomCard=ZPFramework.ZPImport("zp_base.luaScript.Views.Room.ZPRoomCard") local ZPRoomXiaoJuChaPaiView = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.Views.Room.ZPRoomXiaoJuChaPaiView") local hejiangRoomXiaoJuChaPaiView = class("hejiangRoomXiaoJuChaPaiView", ZPRoomXiaoJuChaPaiView) function hejiangRoomXiaoJuChaPaiView:ctor() hejiangRoomXiaoJuChaPaiView.super.ctor(self) end function hejiangRoomXiaoJuChaPaiView:onEnter() hejiangRoomXiaoJuChaPaiView.super.onEnter(self) end function hejiangRoomXiaoJuChaPaiView:liangShouPai(isRecontect) --胡牌类型 local huType = ZPDef.ReconnectHuType.NO_HU --房间信息 local roomInfo = app.room.roomInfo --正常结束取值 local tt = roomInfo.playList --重连取值 if isRecontect then tt = roomInfo.arrayTableInfo end if (roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_NORMAL) then --胡的牌 local huCard = roomInfo.huCard --出牌者ID或者点炮的ID,自摸这个是nil,有人点炮这个是有值的 local showViewId = nil local dianPaoViewId = app.room:getViewIdByUserId(roomInfo.dianPaoUserId) --重连 if isRecontect then showViewId = app.room:getViewIdBySeatId(roomInfo.showCardSeatId) else --小局结算 showViewId = dianPaoViewId end for k,huinfo in pairs(roomInfo.hupaiInfo) do huCard = huinfo.huCard local nUserId = huinfo.huPaiUid local viewId = app.room:getViewIdByUserId(nUserId) --显示胡的那个牌 if isRecontect then if self.showHuCardCallBack then self.showHuCardCallBack(showViewId,huCard) end end --赢家手牌 local cardList = {} cardList = roomInfo.memberList[nUserId].cardList --判断赢家是否吃胡 local isHandHaveHuCard = false local isFindChi = false for key,list in pairs(cardList) do for i = 1,3 do if list[i] == huCard then isHandHaveHuCard = true isFindChi = true break end end if isFindChi then break end end --是否是跑胡或提胡 local paoTiHU = false --如果是吃胡 if isHandHaveHuCard then huType = ZPDef.ReconnectHuType.CHI_HU --吃胡操作,去掉手里胡的那张 local isFind = false if table.nums(cardList) > 0 then for i = 1,self.lieShuMax do local cardColList = cardList[i] or {} for idx,value in pairs(cardColList) do if value == huCard then table.remove(cardColList,idx) isFind = true break end end if isFind then break end end end else for k,v in pairs(tt) do if k == nUserId then for key,value in pairs(v.tableWeaveCard) do local list,operationType = ZPFuc.getZPCardList(value.card,value.type) if operationType == ZPDef.OpType.OP_TYPE_MINGWEI and huCard == value.card or operationType == ZPDef.OpType.OP_TYPE_ANWEI and huCard == value.card then huType = ZPDef.ReconnectHuType.WEI_HU elseif operationType == ZPDef.OpType.OP_TYPE_PENG and huCard == value.card then huType = ZPDef.ReconnectHuType.PENG_HU elseif operationType == ZPDef.OpType.OP_TYPE_PAO and huCard == value.card then if value.type == ZPDef.SendCardType.CHI_PAI_SHAO_PAO then --x huType = ZPDef.ReconnectHuType.WEI_PAO_HU elseif value.type == ZPDef.SendCardType.CHI_PAI_PENG_PAO then huType = ZPDef.ReconnectHuType.PENG_PAO_HU elseif value.type == ZPDef.SendCardType.KUAI_SHUI_FOUR_SAME then huType = ZPDef.ReconnectHuType.KAN_PAO_HU end paoTiHU = true elseif operationType == ZPDef.OpType.OP_TYPE_TI and huCard == value.card then if value.type == ZPDef.SendCardType.CHI_PAI_TI then huType = ZPDef.ReconnectHuType.WEI_TI_HU elseif value.type == ZPDef.SendCardType.GUN_ZI_FOUR_SAME then huType = ZPDef.ReconnectHuType.KAN_TI_HU end paoTiHU = true elseif operationType == ZPDef.OpType.OP_TYPE_CHONG_PAO and huCard == value.card then paoTiHU = true end end end end end --添加2个牌 if huType == ZPDef.ReconnectHuType.WEI_HU or huType == ZPDef.ReconnectHuType.PENG_HU then local tt = {huCard,huCard} table.insert(cardList,tt) elseif huType == ZPDef.ReconnectHuType.KAN_TI_HU or huType == ZPDef.ReconnectHuType.KAN_PAO_HU or (true == paoTiHU) then local tt = {huCard,huCard,huCard} table.insert(cardList,tt) end end end if roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG and not isRecontect then --胡的牌 local huCard = roomInfo.huCard --出牌者ID或者点炮的ID,自摸这个是nil,有人点炮这个是有值的 local showViewId = nil local dianPaoViewId = app.room:getViewIdByUserId(roomInfo.dianPaoUserId) --重连 if isRecontect then showViewId = app.room:getViewIdBySeatId(roomInfo.showCardSeatId) else --小局结算 showViewId = dianPaoViewId end for k,huinfo in pairs(roomInfo.hupaiInfo) do huCard = huinfo.huCard local nUserId = huinfo.huPaiUid local viewId = app.room:getViewIdByUserId(nUserId) --显示胡的那个牌 if isRecontect then if self.showHuCardCallBack then self.showHuCardCallBack(showViewId,huCard) end end --赢家手牌 local cardList = {} cardList = roomInfo.memberList[nUserId].cardList local paoTiHU = false for k,v in pairs(tt) do if k == nUserId then if v.tableWeaveCard and #v.tableWeaveCard > 0 then local lastWeaveCard = v.tableWeaveCard[#v.tableWeaveCard] if (lastWeaveCard.type == ZPDef.SendCardType.KAN_THREE_SAME or lastWeaveCard.type == ZPDef.SendCardType.DIRTY_THREE_SAME or lastWeaveCard.type == ZPDef.SendCardType.DUI_THREE_SAME) and huCard == lastWeaveCard.card then local tcardlst = {huCard,huCard,huCard} table.insert(cardList,tcardlst) elseif (lastWeaveCard.type == ZPDef.SendCardType.GUN_ZI_FOUR_SAME or lastWeaveCard.type == ZPDef.SendCardType.KUAI_SHUI_FOUR_SAME or lastWeaveCard.type == ZPDef.SendCardType.CHI_PAI_TI or lastWeaveCard.type == ZPDef.SendCardType.CHI_PAI_SHAO_PAO or lastWeaveCard.type == ZPDef.SendCardType.CHI_PAI_PENG_PAO) and huCard == lastWeaveCard.card then local tcardlst = {huCard,huCard,huCard,huCard} table.insert(cardList,tcardlst) end end end end end end if roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then for k,huinfo in pairs(roomInfo.hupaiInfo) do local huCard = huinfo.huCard local nUserId = huinfo.huPaiUid local cardList = roomInfo.memberList[nUserId].cardList if cardList and #cardList > 0 then local isfindJiaoPai = false for i=#cardList,1,-1 do local cardLie = cardList[i] for j=1,4 do if cardLie[j] and cardLie[j] == huCard then cardLie.jiaopaiIdx = j isfindJiaoPai = true break end end if isfindJiaoPai then break end end end end end for k,v in pairsByKeys(tt) do local myUserID = app.room:getMyUserId() local nUserId = v.nUserId if myUserID ~= nUserId then local cardList = roomInfo.memberList[nUserId].cardList logE("cardList:"..table.tostring(cardList)) self:createHandCard(nUserId) end end app.room.roomInfo.huCardType = huType return huType end return hejiangRoomXiaoJuChaPaiView