|
- 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 ZPWanFa= require("luaScript.SubGameDefine.ZiPai.erwuWanFa")
-
- local ErWuRoomXiaoJuView = class("ErWuRoomXiaoJuView", cc.UIView)
-
- local tempCardVlue ={
- [17] = 20, --11
- [18] = 30, --12
- [49] = 40, --31
- [34] = 41, --22
- [20] = 50, --14
- [50] = 51, --32
- [21] = 60, --15
- [36] = 61, --24
- [51] = 62, --33
- [22] = 70, --16
- [82] = 71, --52
- [52] = 72, --34
- [38] = 80, --26
- [53] = 81, --35
- [68] = 82, --44
- [54] = 90, --36
- [84] = 91, --54
- [70] = 100, --46
- [85] = 101, --55
- [86] = 110, --56
- [102] = 120, --66
- }
-
- function ErWuRoomXiaoJuView:ctor(nextCallBackFun,isRecontect,colorType)
- ErWuRoomXiaoJuView.super.ctor(self);
- self.isRecontect = isRecontect
- self.nextCallBack = nextCallBackFun
- self.xiaojuData = app.room.roomInfo.playList
- self.isShow = false
- if self.isRecontect then
- self.xiaojuData = app.room.roomInfo.arrayTableInfo
- end
- self.allNode = {}
- self.showHu = {}
- self.colorType = colorType or ZPDef.ColorType.White
- end
-
- function ErWuRoomXiaoJuView:loadUI()
- local ui = loadUI("zp_erwu/res/ui/ui_fangjian/erwu_ui_xiaoju.ui");
- self.ui = ui;
- self:addChild(ui);
- end
-
- function ErWuRoomXiaoJuView:onEnter()
- ErWuRoomXiaoJuView.super.onEnter(self)
-
- self:loadUI()
-
- -- 下一局
- self.ui.Items.Button_Next:registerClick(handler(self , self.onClickNext))
-
- --显示总结算
- self.ui.Items.Button_All:registerClick(handler(self , self.onClickZongJieSuan))
-
- --查牌
- self.ui.Items.Button_ChaPai:registerClick(handler(self , self.onClickChaPai))
- --胡牌类型item,复制用
- self.ui.Items.Layout_hutypes:setVisible(false)
-
- --显示结束
- if app.room.roomInfo.isGameOver == 1 then
- self.ui.Items.Button_Next:setVisible(false)
- self.ui.Items.Button_All:setVisible(true)
- else
- self.ui.Items.Button_All:setVisible(false)
- end
-
- self.ui.Items.ImageView_DiCard_1:setVisible(false)
- --组合牌第一个点的坐标
- self.weaveCardPos = cc.p(180,45)
- self.leftCardPos = self.ui.Items.ImageView_DiCard_1:getPosition()
-
- --初始化人物信息
- self:initPlayerView()
- self:initOtherData()
- self:updatePlayerInfo()
- end
-
- function ErWuRoomXiaoJuView:initPlayerView()
- self.ui.Items.Layout_WeaveCard_Item:setVisible(false)
- for i=1,4 do
- local head = "ImageView_head_"..i
- local headBg = "ImageView_head_bg_" .. i
- local name = "Text_Name_"..i
- local id = "Text_ID_"..i
- local banker = "ImageView_Zhuang_"..i
- local winScore = "TextBMFont_WinScore_"..i
- local loseScore = "TextBMFont_LoseScore_"..i
- local layout = "Layout_Hand_"..i
- local winBg = "ImageView_ying_bg_"..i
- --local loseBg = "ImageView_pt_bg_"..i
- local layoutHuinfo = "Layout_HuInfo_"..i
- local fangPao = "ImageView_FangPao_"..i
- local layoutHuTypes = "Layout_huTypes_"..i
- local huType = "ImageView_HuType_"..i
- local textHuInfo = "Text_Hu_Info_"..i
- local textHushu = "Text_hushu_"..i
- local textBeishu = "Text_beishu_"..i
- local textFanshu = "Text_fanshu_"..i
- local textFanxing = "Text_fanxing_"..i
- local textTuoNum = "Text_TuoNum_"..i
- local toujia = "ImageView_toujia_"..i
- local baojiao = "ImageView_baojiao_"..i
- local xiaojia = "ImageView_xiaojia_"..i
- local fengding = "ImageView_fengding_"..i
-
- self.allNode[i] = {}
- self.allNode[i].nodeHead = self.ui.Items[head]
- self.allNode[i].nodeHeadBg = self.ui.Items[headBg]
- self.allNode[i].nodeName = self.ui.Items[name]
- self.allNode[i].nodeID = self.ui.Items[id]
- self.allNode[i].nodeBanker = self.ui.Items[banker]
- self.allNode[i].nodewinScore = self.ui.Items[winScore]
- self.allNode[i].nodeloseScore = self.ui.Items[loseScore]
- self.allNode[i].nodeLayout = self.ui.Items[layout]
- self.allNode[i].nodewinBg = self.ui.Items[winBg]
- --self.allNode[i].nodeloseBg = self.ui.Items[loseBg]
- self.allNode[i].nodelayoutHuinfo = self.ui.Items[layoutHuinfo]
- self.allNode[i].nodefangPao = self.ui.Items[fangPao]
- self.allNode[i].nodehutype = self.ui.Items[huType]
- self.allNode[i].nodelayoutHuTypes = self.ui.Items[layoutHuTypes]
- self.allNode[i].nodehuinfo = self.ui.Items[textHuInfo]
- self.allNode[i].nodeHushu = self.ui.Items[textHushu]
- self.allNode[i].nodeBeishu = self.ui.Items[textBeishu]
- self.allNode[i].nodefanshu = self.ui.Items[textFanshu]
- self.allNode[i].nodefanxing = self.ui.Items[textFanxing]
- self.allNode[i].nodeTuoNum = self.ui.Items[textTuoNum]
-
- self.allNode[i].nodetoujia = self.ui.Items[toujia]
- self.allNode[i].nodebaojiao = self.ui.Items[baojiao]
- self.allNode[i].nodexiaojia = self.ui.Items[xiaojia]
- self.allNode[i].nodefengding = self.ui.Items[fengding]
-
- self.ui.Items["Layout_Player_" .. i]:setVisible(false)
- end
- end
-
- --是否是小家uid
- function ErWuRoomXiaoJuView:isLittleUid(uid)
- if not uid then return false end
- if uid == 0 then return true end
- local viewId = app.room:getViewIdByUserId(uid)
- if not viewId then return false end
- local seatId = app.room:getSeatIdByViewId(viewId)
- if not seatId then return false end
- if app.room.roomInfo.xiaoSeatId and app.room.roomInfo.xiaoSeatId == seatId then
- return true
- else
- return false
- end
- end
-
- --获取最大得分
- function ErWuRoomXiaoJuView:getMaxTurnScore(t)
- local score = 0
- for i,j in pairs(t) do
- if j.nTurnScore > score then
- score = j.nTurnScore
- end
- end
- return score
- end
-
- function ErWuRoomXiaoJuView:updatePlayerInfo()
- self.isHaveUse = {}
- local indexPlayer = 2
- local maxTurnScore = self:getMaxTurnScore(self.xiaojuData)
- --按要求赢家要摆在第一个位置
- for k,v in pairsByKeys(self.xiaojuData) do
- local i = indexPlayer
- if v.nTurnScore == maxTurnScore and not self.isHaveUse[1] and (not self:isLittleUid(v.nUserId)) then
- i = 1
- elseif self:isLittleUid(v.nUserId) then
- i = 4
- else
- indexPlayer = indexPlayer + 1
- end
- if i== 4 and (not self:isLittleUid(v.nUserId)) then
- for tt=1,4 do
- if not self.isHaveUse[tt] then
- i = tt
- end
- end
- self.isHaveUse[i] = true
- elseif not self.isHaveUse[i] then
- self.isHaveUse[i] = true
- else
- for tt=1,4 do
- if not self.isHaveUse[tt] then
- i = tt
- end
- end
- self.isHaveUse[i] = true
- end
-
- self.ui.Items["Layout_Player_" .. i]:setVisible(true)
-
- 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 baopeiUserId = app.room.roomInfo.baopeiUserid
- local bankerId = app.room:getUserIdBySeatId(app.room.roomInfo.nBankSeatId)
- local stopFlag = app.room.roomInfo.stopFlag
- local xiaojiaid = self:getXiaojiaUid()
-
- self.allNode[i].nodefangPao:setScale(1.5)
-
- if stopFlag ~= 0 then
- self.allNode[i].nodefanshu:setVisible(false)
- self.allNode[i].nodelayoutHuTypes:setVisible(false)
- self.allNode[i].nodefanxing:setVisible(false)
- self.allNode[i].nodeTuoNum:setVisible(false)
- self.allNode[i].nodefengding:setVisible(false)
- end
-
- 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
-
- if v.nUserId == 0 then
- self.allNode[i].nodeName:setVisible(false)
- self.allNode[i].nodeID:setVisible(false)
- self.allNode[i].nodeHeadBg:setVisible(false)
- self.allNode[i].nodewinScore:setVisible(false)
- self.allNode[i].nodeloseScore:setVisible(false)
- else
- 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))
- end
- --庄家
- if bankerId == v.nUserId then
- self.allNode[i].nodeBanker:setVisible(false)
- self.allNode[i].nodetoujia:setVisible(true)
- else
- self.allNode[i].nodeBanker:setVisible(false)
- self.allNode[i].nodetoujia:setVisible(false)
- end
-
-
- --小家
- if xiaojiaid == v.nUserId then
- self.allNode[i].nodexiaojia:setVisible(true)
- else
- self.allNode[i].nodexiaojia:setVisible(false)
- end
-
-
- --报叫
- if v.nBaoPaiStatus == 2 then
- self.allNode[i].nodebaojiao:setVisible(true)
- else
- self.allNode[i].nodebaojiao:setVisible(false)
- end
- --点炮 包赔玩家
- if dianPaoUserId == v.nUserId or baopeiUserId == v.nUserId then
- if dianPaoUserId == v.nUserId then
- self.allNode[i].nodefangPao:setVisible(true)
- --更换显示方式
- --local ui = self:getAHutypeUi("zp_erwu/res/ui/zy_fangjian/jiesuan/dianpao.png")
- self.allNode[i].nodefangPao:loadTexture("zp_erwu/res/ui/zy_fangjian/jiesuan/dianpao.png")
- self.allNode[i].nodefangPao:setScale(1.3)
-
- local orderPos = self.allNode[i].nodefangPao:getPosition()
- self.allNode[i].nodefangPao:setPositionY(orderPos.y - 10)
- elseif baopeiUserId == v.nUserId then
- self.allNode[i].nodefangPao:setVisible(true)
- --更换显示方式
- ---local ui = self:getAHutypeUi("zp_erwu/res/ui/zy_fangjian/jiesuan/baopei.png")
- self.allNode[i].nodefangPao:loadTexture("zp_erwu/res/ui/zy_fangjian/jiesuan/baopei.png")
-
- self.allNode[i].nodefangPao:setScale(1.3)
-
- local orderPos = self.allNode[i].nodefangPao:getPosition()
- self.allNode[i].nodefangPao:setPositionY(orderPos.y - 10)
- end
- 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].nodefangPao:setVisible(true)
- self.allNode[i].nodelayoutHuinfo:setVisible(false)
- self.allNode[i].nodefangPao:loadTexture("zp_erwu/res/ui/zy_fangjian/jiesuan/hu.png")
-
- end
-
- if huv.huPaiUid == v.nUserId then
- self.allNode[i].nodefanshu:setVisible(true)
- self.allNode[i].nodefanshu:setText(huv.huPaiHuShu.."番")
- local hustr = self:getHuTypesStr(huv.huPaiUid,huv.huTypes)
- self.allNode[i].nodelayoutHuTypes:setVisible(true)
- self.allNode[i].nodefanxing:setVisible(true)
- self.allNode[i].nodefanxing:setText(tostring(hustr))
- self.allNode[i].nodeTuoNum:setVisible(true)
- self.allNode[i].nodeTuoNum:setText(v.totalTuoNum.."坨")
- else
- self.allNode[i].nodefanshu:setVisible(false)
- self.allNode[i].nodelayoutHuTypes:setVisible(false)
- self.allNode[i].nodefanxing:setVisible(false)
- self.allNode[i].nodeTuoNum:setVisible(false)
- end
-
- if huv.huPaiUid == v.nUserId and self:IsFengDing(huv.huTypes) then
- self.allNode[i].nodefengding:setVisible(true)
- else
- self.allNode[i].nodefengding:setVisible(false)
- end
- end
-
- if v.nTurnScore < 0 and v.nBaoPaiStatus == 2 then
- self.allNode[i].nodelayoutHuTypes:setVisible(true)
- self.allNode[i].nodefanxing:setVisible(true)
- self.allNode[i].nodefanxing:setText(tostring("被杀报"))
- end
-
- local index = 0
- for key,value in pairs(data.tableWeaveCard) do
- if (table.nums(value.card) == 5) then
- local list = {value.card[1], value.card[2], value.card[3], value.card[4]}
- self:createWeaveCard(value, list, index, false, self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
-
- list = {value.card[2]}
- self:createWeaveCard(value, list, index, false, self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- else
- self:createWeaveCard(value, value.card, index, false, self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- end
- end
-
- if table.nums(data.tableWeaveCard) > 0 then
- index = index + 1
- end
-
- local handcardList = {}
- for k,value in pairs(data.handCard) do
- local card = value.opcard
- local list = value.card
- if list then
- table.insert(handcardList,list)
- end
- end
-
- table.sort(handcardList,function(a,b)
- local index = a[1]
- local numA = tempCardVlue[index]
- local index1 = b[1]
- local numB = tempCardVlue[index1]
-
- if numA ~= nil and numB ~= nil then
- return numA < numB
- end
- end)
-
- --只显示一次胡变为opCard
- local showOneTime = true
- for k,value in pairs(handcardList) do
- local list = value
- if list then
- local lens = table.nums(list)
- if lens > 4 and lens <= 8 then
- local templist = {}
- for i = 5,lens do
- table.insert(templist,list[i])
- end
- self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- self:createWeaveCard(value,templist,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- elseif lens > 8 and lens <= 12 then
- local templist = {}
- local templist1 = {}
- for i = 5,8 do
- table.insert(templist,list[i])
- end
- for i = 9,12 do
- table.insert(templist1,list[i])
- end
- self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- self:createWeaveCard(value,templist,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- self:createWeaveCard(value,templist1,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- elseif lens > 12 and lens <= 16 then
- local templist = {}
- local templist1 = {}
- local templist2 = {}
- for i = 5,8 do
- table.insert(templist,list[i])
- end
- for i = 9,12 do
- table.insert(templist1,list[i])
- end
- for i = 13,16 do
- table.insert(templist2,list[i])
- end
- self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- self:createWeaveCard(value,templist,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- self:createWeaveCard(value,templist1,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- self:createWeaveCard(value,templist2,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- else
- self:createWeaveCard(value,list,index,true,self.allNode[i].nodeLayout,v.nUserId)
- index = index + 1
- end
-
- end
- 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
-
- self.ui.Items.Layout_Player:doLayout()
- self.ui.Items.Layout_Player:requestDoLayout()
-
- self:showDiPai()
- end
-
-
- function ErWuRoomXiaoJuView:getAHutypeUi(ht,filename)
- local ui = self.ui.Items.Layout_hutypes:getCopied()
- ui.Items = getUIItems(ui);
- ui:setVisible(true)
- if not ht then
- ht = 0
- end
- local name = string.format(ZPDef.TipFile.HU,ht)
- if filename then
- name = filename
- end
- ui.Items.ImageView_hutype:loadTextureFromPlist(name)
- return ui
- end
-
- function ErWuRoomXiaoJuView:showDiPai()
- local dipaiSize = table.nums(app.room.roomInfo.dipaiList);
-
-
-
- if dipaiSize <= 0 then
- self.ui.Items.Layout_Bottom_1:setVisible(false)
- else
- self.ui.Items.Layout_Bottom_1:setVisible(true)
- end
-
- self.ui.Items.Layout_Bottom_1:setVisible(false)
- --[[if app.room:getActualPlayerNum() == 2 then
- local y = self.ui.Items.Layout_Bottom_1:getPositionY()
- self.ui.Items.Layout_Bottom_1:setPositionY(y+40)
- end--]]
- local tIndex = 0
- for dipaiK,dipaiV in pairsByKeys(app.room.roomInfo.dipaiList) do
- local mLayout = cc.Layout:createNode()
- mLayout:setAnchorPoint(cc.p(0.5,0.5))
- mLayout:setSize(cc.size(30,30))
- local cardImg = cc.ImageView:createNode();
- cardImg:setAnchorPoint(cc.p(0.5,0.5));
- cardImg:setScale(0.8)
- local fileName = ZPFuc.getZPCardImgByValue(dipaiV.chessCards,ZPDef.CardType.CARD_TYPE_QUIT,self.colorType)
- cardImg:loadTextureFromPlist(fileName);
- local row = math.floor(tIndex/22)
- --cardImg:setPosition(self.leftCardPos.x + (tIndex%25)*45,self.leftCardPos.y-row*60)
- cardImg:setPosition(cc.p(15,15))
- mLayout:addChild(cardImg)
- self.ui.Items.Layout_dipai:addChild(mLayout);
- tIndex = tIndex + 1;
- end
- end
-
- function ErWuRoomXiaoJuView:getHuTypeAndBeiShuStr(huType,beishu)
- local strRul = ""
-
- return strRul
- end
-
- --判断是否是赢家uid
- function ErWuRoomXiaoJuView:getIsWinUid(uid)
- for huk,huv in pairs(app.room.roomInfo.hupaiInfo) do
- if huv.huPaiUid == uid then
- return true
- end
- end
- return false
- end
-
- function ErWuRoomXiaoJuView:createWeaveCard(value,list,index,isHand,node,userID)
- local sendCardType = value.type
- local huxi = value.hushu
- local opCard = value.opcard
- local ui = self.ui.Items.Layout_WeaveCard_Item:getCopied()
- ui.Items = getUIItems(ui);
- ui:setVisible(true)
-
- local max = table.nums(list)
- local idx = max
-
- for i = 1,4 do
- local name = "ImageView_Card_"..i
- local hu = "ImageView_card_hu_"..i
- ui.Items[hu]:setVisible(false)
- if i > max then
- ui.Items[name]:setVisible(false)
- else
- if list[i] == app.room.roomInfo.huCard and not self.isShow then
- --[[--吃胡一定是手牌
- if app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU and isHand then
- self.isShow = true
- --其他类型的胡牌在组合牌上
- elseif app.room.roomInfo.huCardType and app.room.roomInfo.huCardType ~= ZPDef.ReconnectHuType.CHI_HU and not isHand then
- self.isShow = true
- elseif app.room.roomInfo.huCardType and app.room.roomInfo.huCardType == 0 and isHand then--叫牌的时候
- self.isShow = true
- end--]]
- if app.room.roomInfo.stopFlag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then
- if true == isHand or #list == 4 or (#list == 3 and list[1]==list[2] and list[2]==list[3]) then
- self.isShow = true
- end
- else
- if app.room.roomInfo.huCardType == ZPDef.ReconnectHuType.CHI_HU and not isHand then
- else
- self.isShow = true
- end
- end
- end
-
- local fileName = ZPFuc.getZPCardImgByValue(list[i],ZPDef.CardType.CARD_TYPE_QUIT,self.colorType)
- ui.Items[name]:loadTextureFromPlist(fileName)
- ui.Items[name].cardValue = list[i]
- --[[if self.isShow == true then
- --ui.Items[name]:setColor(cc.c3b(248,193,103))
- if not self.showHu[userID] then
- self.isShow = false
- self.showHu[userID] = true
- if self:getIsWinUid(userID) then
- ui.Items[hu]:setVisible(true)
- end
- end
- self.isShow = false
- end--]]
- end
- end
-
- --不管是不是手牌都要显示
- if self:getWeaveTypeFile(sendCardType) ~= "" then--and (not isHand)
- --ui.Items.ImageView_tip:loadTextureFromPlist(self:getWeaveTypeFile(sendCardType))
- ui.Items.ImageView_tip:setVisible(false)
- else
- ui.Items.ImageView_tip:setVisible(false)
- end
- ui.Items.TextBMFont_youshu:setVisible(false)
- --ui.Items.TextBMFont_youshu:setText(huxi)
- ui:setPosition(cc.p(self.weaveCardPos.x + index * 35,self.weaveCardPos.y))
- --self.ui.Items.Layout_1:addChild(ui)
- node:addChild(ui)
- end
-
- --在胡牌的那张牌上面显示胡字
- function ErWuRoomXiaoJuView:showHuCardBox(node,hucard)
- if not node then return end
- local cardUI = node:getChildren()
- if cardUI and type(cardUI) == 'table' then
- local endPos = cardUI[#cardUI]:getPosition()
- for i = #cardUI ,1,-1 do
- local tui = cardUI[i]
- for k = 1,4 do
- local name = "ImageView_Card_"..k
- local hu = "ImageView_card_hu_"..k
- if tui.Items[name] and tui.Items[name]:isVisible() and tui.Items[name].cardValue == hucard then
- --把带胡字的那一列放到最后去
- tui.Items[hu]:setVisible(true)
- local pos1 = tui:getPosition()
- tui:setPosition(endPos)
- cardUI[#cardUI]:setPosition(pos1)
- return
- end
- end
- end
- end
- end
-
- --[[
- 获取组合类型文件
- ]]
- function ErWuRoomXiaoJuView:getWeaveTypeFile(sendCardType)
- if sendCardType == ZPDef.SendCardType.TWO_SEVEN_TEN
- or sendCardType == ZPDef.SendCardType.ONE_FIVE_TEN
- or sendCardType == ZPDef.SendCardType.ONE_TWO_THREE
- or sendCardType == ZPDef.SendCardType.DA_ZI_TWO_AND_ONE
- or sendCardType == ZPDef.SendCardType.SHUN_ZI then
- return ZPDef.XiaoJuWeaveCardType.CHI
- elseif sendCardType == ZPDef.SendCardType.DUI_THREE_SAME then
- return ZPDef.XiaoJuWeaveCardType.PENG
- elseif sendCardType == ZPDef.SendCardType.KAN_THREE_SAME or sendCardType == ZPDef.SendCardType.DIRTY_THREE_SAME then
- return ZPDef.XiaoJuWeaveCardType.WEI
- elseif sendCardType == ZPDef.SendCardType.KUAI_SHUI_FOUR_SAME or sendCardType == ZPDef.SendCardType.CHI_PAI_PENG_PAO or sendCardType == ZPDef.SendCardType.CHI_PAI_SHAO_PAO then
- return ZPDef.XiaoJuWeaveCardType.ZHAO
- elseif sendCardType == ZPDef.SendCardType.GUN_ZI_FOUR_SAME or sendCardType == ZPDef.SendCardType.CHI_PAI_TI then
- return ZPDef.XiaoJuWeaveCardType.LONG
- elseif sendCardType == ZPDef.SendCardType.ZHUANG_ZI then
- return ZPDef.XiaoJuWeaveCardType.JIANG
- elseif sendCardType == ZPDef.SendCardType.KANPAI_LOCAL then
- return ZPDef.XiaoJuWeaveCardType.KAN
- else
- local txt = string.format("发牌类型为:"..sendCardType)
- --showTooltip(txt)
- return ""
- end
- end
-
-
- function ErWuRoomXiaoJuView:initOtherData()
- local roomInfo = app.room.roomInfo
- local winUserId = app.room.roomInfo.winUserId
-
- --规则
- local rule = ZPWanFa.getRuleInfo(roomInfo.strGameInfo)
- logD("ErWuRoomXiaoJuView:initOtherData", "rule", rule)
- self.ui.Items.Text_Rule:setText(rule)
- --时间
- self.ui.Items.Text_Time:setText(getTimeString())
- --房号
- self.ui.Items.Text_RoomNum:setText("房号:"..tostring(app.room.roomInfo.nShowTableId))
- end
-
-
- function ErWuRoomXiaoJuView:updateUserHead(nodeHead,nUserId, sex, headimgurl)
- setPlayerHeadImage(nUserId, headimgurl, nodeHead);
- end
-
- -- 查牌
- function ErWuRoomXiaoJuView:onClickChaPai()
- playBtnEffect()
- self:setVisible(false)
- end
-
-
- -- 下一局
- function ErWuRoomXiaoJuView:onClickNext()
- playBtnEffect()
-
- self.ui:sendMsg(app.room, "callReadyRequest");
-
- if self.nextCallBack then
- self.nextCallBack()
- end
- end
-
- function ErWuRoomXiaoJuView:onClickZongJieSuan()
- playBtnEffect()
-
- if self.nextCallBack then
- self.nextCallBack()
- end
-
- end
-
- function ErWuRoomXiaoJuView:getAHutypeTextUi(text)
- local hutext = cc.Text:createNode()
- hutext:setDefaults()
- local config = hutext:getFontConfig()
- config.fontSize = 22
- config.texColor = cc.c3b(255,240,179)--cc.c4b(251,213,130,255)
- hutext:setFontConfig(config)
- hutext:setText(tostring(text))
- return hutext
- end
-
-
- function ErWuRoomXiaoJuView:getXiaojiaUid()
- return app.room:getUserIdBySeatId(app.room.roomInfo.xiaoSeatId)
- end
-
-
- function ErWuRoomXiaoJuView:IsFengDing(huType)
- local ret = getNumBand(huType,ZPDef.HuType.FENGDING)
- if ret > 0 then
- return true
- end
-
- return false
- end
-
-
-
- --显示胡牌类型
-
- function ErWuRoomXiaoJuView:getHuTypesStr(huUid,huType)
- local strSpec = ""
- if huType > 0 then
- local ret = getNumBand(huType,ZPDef.HuType.TIAN_HU)
- if ret > 0 then
- strSpec = strSpec.."天胡x2 "
- end
- local ret = getNumBand(huType,ZPDef.HuType.LONG_HU)
- if ret > 0 then
- strSpec = strSpec.."龙胡x1 "
- end
- local ret = getNumBand(huType,ZPDef.HuType.TUO_HONG_HU)
- if ret > 0 then
- if huUid == self:getXiaojiaUid() then
- strSpec = strSpec.."坨坨红x1 "
- else
- strSpec = strSpec.."坨坨红x3 "
- end
- end
- local ret = getNumBand(huType,ZPDef.HuType.HEI_LONG_HU)
- if ret > 0 then
- strSpec = strSpec.."黑龙x1 "
- end
-
- local ret = getNumBand(huType,ZPDef.HuType.CHI_PIAO)
- if ret > 0 then
- strSpec = strSpec.."吃飘x1 "
- end
-
- local ret = getNumBand(huType,ZPDef.HuType.XIAO_HU)
- if ret > 0 then
- strSpec = strSpec.."小胡 "
- end
-
- local ret = getNumBand(huType,ZPDef.HuType.TUO_HEI_HU)
- if ret > 0 then
- if huUid == self:getXiaojiaUid() then
- strSpec = strSpec.."坨坨黑x1 "
- else
- strSpec = strSpec.."坨坨黑x3 "
- end
- end
- local ret = getNumBand(huType,ZPDef.HuType.BAO_HU)
- if ret > 0 then
- strSpec = strSpec.."报叫x1 "
- end
- end
-
-
-
- --另加番
- if app.room.roomInfo.fourHongNum > 0 or app.room.roomInfo.fourNormolNum > 0 then
- local num = app.room.roomInfo.fourHongNum + app.room.roomInfo.fourNormolNum
- strSpec = strSpec.."四张x"..num.." "
- end
- if app.room.roomInfo.threeHongNum > 0 or app.room.roomInfo.fourHongNum > 0 then
- local num = app.room.roomInfo.fourHongNum + app.room.roomInfo.threeHongNum
- strSpec = strSpec.."冲番牌x"..num.." "
- end
-
- return strSpec
- end
-
-
- return ErWuRoomXiaoJuView
|