local M = {} local source_fz_03 = "ui://Main_RunBeard/Fz_0_3" local source_fz_04 = "ui://Main_RunBeard/Fz_0_4" local source_card = "ui://Main_RunBeard/202_" function M:getCardItem(card_1, card_2) local room = DataManager.CurrenRoom if room.change_card_display ~= nil then return card_1 .. room.change_card_display .. card_2 else return card_1 .. "6_" .. card_2 end end function M.InitFzView(fz,isMy,isplay,index,count) printlog("jefe InitFzView>>>") local self = setmetatable({}, {__index = M}) local item,fzcards if fz.type ~= RB_FZType.Kan then item = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Component1")--Extend_Poker_AHRunBeard item:RemoveChildren(0, -1, true) end -- local fzItem if fz.type == RB_FZType.Bi or fz.type == RB_FZType.Chi then fzcards = self:UpateChiBi(item,fz) elseif fz.type == RB_FZType.Peng then fzcards = self:UpdatePeng(item,fz) elseif fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then fzcards = self:UpdateWei(item,fz,isMy) elseif fz.type == RB_FZType.Ti then fzcards = self:UpateTi(item,fz) elseif fz.type == RB_FZType.Pao then fzcards = self:UpatePao(item,fz) end if item ~= nil and fzcards ~= nil then self:PlayEffect(item,fzcards,isplay,index,count) end return item,fzcards end function M:UpateChiBi(item,fz) local fzcards = UIPackage.CreateObjectFromURL(source_fz_03) local cardId1,cardId2,cardId3 if #fz.opcard == 2 then cardId1 = fz.card cardId2 = fz.opcard[1] cardId3 = fz.opcard[2] else cardId1 = fz.opcard[1] cardId2 = fz.opcard[2] cardId3 = fz.opcard[3] end fzcards:GetChild("card_" .. 1).icon = self:getCardItem(source_card, cardId1) fzcards:GetController("c2").selectedIndex = 1 fzcards:GetChild("card_" .. 2).icon = self:getCardItem(source_card, cardId2) -- local card = fz.opcard[2] == nil and fz.opcard[1] or fz.opcard[2] fzcards:GetChild("card_" .. 3).icon = self:getCardItem(source_card, cardId3) fzcards.x, fzcards.y = 0, 0 item:AddChildAt(fzcards, 0) return fzcards end function M:UpdatePeng(item,fz) local fzcards = UIPackage.CreateObjectFromURL(source_fz_03) for j = 1, 3 do fzcards:GetChild("card_" .. j).icon = self:getCardItem(source_card, fz.opcard[1]) end fzcards.x, fzcards.y = 0, 0 item:AddChildAt(fzcards, 0) return fzcards end function M:UpdateWei(item,fz,isMy) local fzcards = UIPackage.CreateObjectFromURL(source_fz_03) --fzcards:GetController("c1").selectedIndex=1 local room = DataManager.CurrenRoom for j = 1, 3 do if room.room_config.mingwei or fz.type==RB_FZType.ChouWei or isMy then if j == 3 then fzcards:GetChild("card_" .. j).icon = self:getCardItem(source_card, fz.opcard[1]) else fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300" end else --未勾选明偎 -- if isMy then -- fzcards:GetChild("card_" .. j).icon = self:getCardItem(source_card, fz.opcard[1]) -- fzcards:GetController("c1").selectedIndex = 1 -- else fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300" -- end end end fzcards.x, fzcards.y = 0, 0 item:AddChildAt(fzcards,0) return fzcards end function M:UpateTi(item, fz,icon) local fzcards = UIPackage.CreateObjectFromURL(source_fz_04) for i = 1, 4 do if i == 4 and fz.type == RB_FZType.Ti then fzcards:GetChild("card_" .. i).icon = self:getCardItem(source_card, fz.card) else fzcards:GetChild("card_" .. i).icon = "ui://Main_RunBeard/202_1_300" end end fzcards.x, fzcards.y = 0, 0 -- item:AddChildAt(fzcards,0) return fzcards end function M:UpatePao(item, fz,icon) local fzcards = UIPackage.CreateObjectFromURL(source_fz_04) for i = 1, 4 do fzcards:GetChild("card_" .. i).icon = self:getCardItem(source_card, fz.opcard[1]) end fzcards.x, fzcards.y = 0, 0 return fzcards end function M:PlayEffect(fzitem,fzcards,isplay,index,count) if (isplay == nil) then isplay = false end if (isplay and index == count) then local faArray = fzitem:GetChild("chiwei") if (faArray ~= nil) then faArray:AddChild(fzcards) else fzitem:AddChild(fzcards) end else fzitem:AddChild(fzcards) end end function M:PlayEffectOther(fzitem,fzcards, size,i,isplay,seat) isplay = isplay == nil and false or isplay local isAddlast = false local room = DataManager.CurrenRoom if isplay and i== size then local faArray = fzitem:GetChild("chiwei") if room.room_config.people_num == 3 then if (room.self_player.seat == 1) then if (seat == 2) then faArray = fzitem:GetChild("chiwei1") else faArray = fzitem:GetChild("chiwei") end elseif (room.self_player.seat == 2) then if (seat == 3) then faArray = fzitem:GetChild("chiwei1") else faArray = fzitem:GetChild("chiwei") end elseif (room.self_player.seat == 3) then if (seat == 1) then faArray = fzitem:GetChild("chiwei1") else faArray = fzitem:GetChild("chiwei") end end end if (faArray ~= nil) then faArray:AddChild(fzcards) else fzitem:AddChild(fzcards) end else fzitem:AddChild(fzcards) end end return M