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 doushisiRoomXiaoJuChaPaiView = class("doushisiRoomXiaoJuChaPaiView", ZPRoomXiaoJuChaPaiView) function doushisiRoomXiaoJuChaPaiView:ctor() doushisiRoomXiaoJuChaPaiView.super.ctor(self) end function doushisiRoomXiaoJuChaPaiView:onEnter() doushisiRoomXiaoJuChaPaiView.super.onEnter(self) end function doushisiRoomXiaoJuChaPaiView:loadUI() local ui = loadUI("zp_doushisi/res/ui/ui_fangjian/doushisi_ui_xiaoju_chapai.ui"); self.ui = ui; self:addChild(ui); end function doushisiRoomXiaoJuChaPaiView:liangShouPai(isRecontect) --胡牌类型 local huType = ZPDef.ReconnectHuType.NO_HU --房间信息 local roomInfo = app.room.roomInfo --正常结束取值 local tt = roomInfo.playList --重连取值 if isRecontect then tt = roomInfo.arrayTableInfo end local enterCardHu = roomInfo.isEnterCardHu 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,v in pairs(roomInfo.hupaiInfo) do local nUserId = v.huPaiUid local viewId = app.room:getViewIdByUserId(nUserId) if isRecontect and roomInfo.isZiMoHu and roomInfo.isZiMoHu ~= 1 and roomInfo.isQiangBaHu and roomInfo.isQiangBaHu ~= 1 then if self.showHuCardCallBack then self.showHuCardCallBack(showViewId,huCard) end end --赢家手牌 local cardList = roomInfo.memberList[nUserId].cardList if roomInfo.isZiMoHu and roomInfo.isZiMoHu ~= 1 then local isFind = false local lens = table.nums(cardList) local huCard = roomInfo.huCard if table.nums(cardList) > 0 then for i = 1,lens do if cardList[i] == huCard then table.remove(cardList,i) isFind = true break end if isFind then break end 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 function doushisiRoomXiaoJuChaPaiView:showDiPai() end --初始化小局查牌界面亮手牌的位置 function doushisiRoomXiaoJuChaPaiView:initLiangPaiPos() self.boxPosList1 = {} local weaveCardPos1 = self.ui.Items.Layout_LiangPai_1:getPosition() local tempY = 28 local tempX = 34 for i = 1, 16 do --矩形3 local indexX = i local indexY = 1 if i >= 7 and i < 13 then indexY = 2 indexX = i - 6 elseif i >= 13 then indexY = 3 indexX = i - 12 end self.boxPosList1[i] = cc.p(weaveCardPos1.x - tempX * (indexX - 1),weaveCardPos1.y - tempY * (indexY- 1)) end self.boxPosList2 = {} local weaveCardPos2 = self.ui.Items.Layout_LiangPai_2:getPosition() for i = 1, 16 do --矩形3 local indexX = i local indexY = 1 if i >= 7 and i < 13 then indexY = 2 indexX = i - 6 elseif i >= 13 then indexY = 3 indexX = i - 12 end self.boxPosList2[i] = cc.p(weaveCardPos2.x - tempX * (indexX - 1),weaveCardPos2.y - tempY * (indexY- 1)) end self.boxPosList3 = {} local weaveCardPos3 = self.ui.Items.Layout_LiangPai_3:getPosition() for i = 1, 16 do --矩形3 local indexX = i local indexY = 1 if i >= 7 and i < 13 then indexY = 2 indexX = i - 6 elseif i >= 13 then indexY = 3 indexX = i - 12 end self.boxPosList3[i] = cc.p(weaveCardPos3.x + tempX * (indexX - 1),weaveCardPos3.y - tempY * (indexY- 1)) end end function doushisiRoomXiaoJuChaPaiView:createHandCard(nUserId) logE("====================changpaiRoomXiaoJuChaPaiView:createHandCard()==================="); --[[ local cardList = app.room.roomInfo.memberList[nUserId].cardList --过滤手牌为空的情况 if not cardList or table.nums(cardList) <= 0 then return end local viewId = app.room:getViewIdByUserId(nUserId) local handcardlist = {} for i = 1,self.lieShuMax do local value = cardList[i] or {} for k,v in pairs(value) do table.insert(handcardlist,v) end end --不管有无数据,默认创建10列数据 if viewId == 1 then for k,v in pairs(handcardlist) do local changpai = ChangpaiCard:new(v,ZPDef.CardType.CARD_TYPE_QUIT,viewId,self.colorType) if self.colorType == ZPDef.ColorType.White then changpai:setScale(0.9) else changpai:setScale(0.7) end local pos = self.boxPosList1[k] changpai:setPosition(pos) self.ui.Items.Layout_HandCard:addChild(changpai,1) end elseif viewId == 2 then for k,v in pairs(handcardlist) do local changpai = ChangpaiCard:new(v,ZPDef.CardType.CARD_TYPE_QUIT,viewId,self.colorType) if self.colorType == ZPDef.ColorType.White then changpai:setScale(0.9) else changpai:setScale(0.7) end local pos = self.boxPosList2[k] changpai:setPosition(pos) self.ui.Items.Layout_HandCard:addChild(changpai,1) end elseif viewId == 3 then for k,v in pairs(handcardlist) do local changpai = ChangpaiCard:new(v,ZPDef.CardType.CARD_TYPE_QUIT,viewId,self.colorType) if self.colorType == ZPDef.ColorType.White then changpai:setScale(0.9) else changpai:setScale(0.7) end local pos = self.boxPosList3[k] changpai:setPosition(pos) self.ui.Items.Layout_HandCard:addChild(changpai,1) end end--]] end --判断列数是否是砍牌 function doushisiRoomXiaoJuChaPaiView:getCurrentColIsKan(list) local isKan = false return isKan end function doushisiRoomXiaoJuChaPaiView:PlayHuangZhuangAni(bShowAni) local nodeDipai = self.ui.Items.Layout_XiaoJu_LiangPai --黄庄不显示结算,增加黄庄动画 local tip = cc.ImageView:createNode(); tip:setAnchorPoint(cc.p(0.5,0.5)); tip:loadTextureFromPlist("zp_room_chapai_huangzhuang.png"); tip:setPosition(cc.p(nodeDipai:getContentSize().width / 2,nodeDipai:getContentSize().height / 2+70)) tip:setTag(1000) nodeDipai:addChild(tip); if bShowAni then tip:setScale(5.0) local seq = cc.Sequence:create(cc.ScaleTo:create(0.2,0.8),cc.ScaleTo:create(0.15,1.2),cc.ScaleTo:create(0.1,1)) tip:runAction(seq) end end function doushisiRoomXiaoJuChaPaiView:clearView() self.ui.Items.Layout_HandCard:removeAllChildren() --移除黄庄 self.ui.Items.Layout_XiaoJu_LiangPai:removeChildByTag(1000) end return doushisiRoomXiaoJuChaPaiView