From 9cf1128c69f9505dd42f41f4e8c0a30365451183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Mon, 21 Apr 2025 19:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9B=E4=BA=BA=E5=90=8C=E6=AD=A5=E6=89=80?= =?UTF-8?q?=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lichuan/MJPlayerCardInfoView_jiangxi.lua | 210 +++++------------- .../MJPlayerSelfCardInfoView_jiangxi.lua | 24 +- 2 files changed, 70 insertions(+), 164 deletions(-) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua index ff522fdf..7d681102 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua @@ -188,20 +188,25 @@ function M:UpdateOutCardList(outcard, card_item, cursor) local outcard local outlist = self._player.outcard_list - if self._view_outCardList.numItems < #outlist - 1 then - for i = 1, #outlist - 1 do - outcard = self._view_outCardList:AddItemFromPool() - -- end - self:fillCard2(outcard, outCardName, outlist[i]) - end - end - -- if self._viewText_cardInfo['Order'] == "desc" then - -- outcard = self._view_handCardList:GetFromPool("ui://Main_Majiang/Comp_4_OutCard") - -- self._view_outCardList:AddChildAt(outcard, 0) - -- else - outcard = self._view_outCardList:AddItemFromPool() + -- if self._view_outCardList.numItems < #outlist - 1 then + -- for i = 1, #outlist - 1 do + -- outcard = self._view_outCardList:AddItemFromPool() + -- -- end + -- self:fillCard2(outcard, outCardName, outlist[i]) + -- end -- end - self:fillCard2(outcard, outCardName, card_item) + -- -- if self._viewText_cardInfo['Order'] == "desc" then + -- -- outcard = self._view_handCardList:GetFromPool("ui://Main_Majiang/Comp_4_OutCard") + -- -- self._view_outCardList:AddChildAt(outcard, 0) + -- -- else + -- outcard = self._view_outCardList:AddItemFromPool() + -- -- end + -- self:fillCard2(outcard, outCardName, card_item) + self._view_outCardList:RemoveChildrenToPool() + for i = 0, #outlist - 1 do + outcard = self._view_outCardList:AddItemFromPool() + self:fillCard2(outcard, outCardName, outlist[i + 1]) + end end -- 设置添加角标的方法 @@ -232,155 +237,50 @@ local function getPos(my_seat, other_seat, total) end function M:UpdateFzList(fz, index, show_card) - local gn = 3 + local isFour = false if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then - gn = 4 + isFour = true end - local fz_list = self._mask_data['fz_list'] - local oder = fz_list['oder'] - local comp = fz_list['comp'] .. gn - local card = fz_list['card'] - local card3d = '' - local adjust3d = 0 - if self._current_card_type == 2 then - comp = comp .. '_3d' - oder = fz_list['oder3d'] - adjust3d = fz_list['adjust3d'] - card = fz_list['card3d'] - card3d = 'b' - end + local FZame = self._viewText_cardInfo['FZ_Card'] + index = index or 0 + show_card = show_card or nil - local obj = UIPackage.CreateObjectFromURL('ui://Main_Majiang/' .. comp) - -- print("============================================pengpengpeng", comp) + local outCard - local _area_fz_list = self._area_fz_list - local _area_outcard_list = self._area_outcard_list - - if (index == -1) then - local num = _area_fz_list.numChildren - - if (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then - _area_fz_list.height = _area_fz_list.height + obj.height - if (oder == AreaOderType.down_up) then - local tem1 = obj.height - for i = 1, num do - local tem = _area_fz_list:GetChildAt(num - i) - tem.y = tem.y + tem1 - end - _area_fz_list.y = _area_fz_list.y - obj.height - else - ViewUtil.CardPos(obj, _area_outcard_list, oder, num) - end - elseif (oder == AreaOderType.left_right or oder == AreaOderType.right_left) then - _area_fz_list.width = _area_fz_list.width + obj.width - if (oder == AreaOderType.right_left) then - local tem1 = obj.width - for i = 1, num do - local tem = _area_fz_list:GetChildAt(num - i) - tem.x = tem.x + tem1 - end - _area_fz_list.x = _area_fz_list.x - obj.width - else - ViewUtil.CardPos(obj, _area_outcard_list, oder, num) - end - end - _area_fz_list:AddChild(obj) - - if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then - num = _area_fz_list.numChildren - for i = 1, num do - local tem = _area_fz_list:GetChildAt(i - 1) - tem.x = adjust3d * (i - 1) - end - end - else - local obj1 = _area_fz_list:RemoveChildAt(index) - obj1:Dispose() - obj.xy = obj1.xy - _area_fz_list:AddChildAt(obj, index) - end - - -- 显示fz的牌 - local obj_show - if show_card then - obj_show = UIPackage.CreateObjectFromURL('ui://Main_Majiang/Fz_0_' .. gn) - end - - for i = 1, gn do - local _oc = obj:GetChild('card_' .. i) - local _oc2 = nil - - if show_card then - _oc2 = obj_show:GetChild('card_' .. i) - end - - if (fz.type == FZType.Gang_An and i == gn) then - if self._current_card_type == 2 then - _oc.icon = UIPackage.GetItemURL('MajiangCard3d', card3d .. card .. '00') - else - _oc.icon = UIPackage.GetItemURL(self:GetCardPicPack(), card3d .. card .. '00') - end - - if show_card then - _oc2.icon = UIPackage.GetItemURL('Main_Majiang', '202_00') - end - else - if (fz.type == FZType.Chi) then - local index = i - if oder == AreaOderType.right_left or oder == AreaOderType.down_up then - index = gn - i + 1 - end - - self:fillCard(_oc, card, fz.opcard[index]) - - if show_card then - self:fillCard(_oc2, '202_', fz.opcard[index], false) - end - else - self:fillCard(_oc, card, fz.card) - - if show_card then - self:fillCard(_oc2, '202_', fz.card, false) - end - end - end - end - - obj.touchable = false - - if show_card then - obj_show.touchable = false - obj_show:SetPivot(0.5, 0.5, true) - obj_show:SetScale(0.8, 0.8) - self._mask_liangpai:AddChildAt(obj_show, 0) - coroutine.start( - function() - coroutine.wait(2) - obj_show:Dispose() - end - ) - end - - -- -- 标记碰牌对象 - -- local num = self._area_fz_list.numChildren - -- if num == 0 then return end - -- if index == -1 then - -- -- local obj = self._area_fz_list:GetChildAt(num - 1) - -- local pic_arrow = UIPackage.CreateObjectFromURL("ui://Main_Majiang/com_arrow") - -- obj:AddChild(pic_arrow) - -- pic_arrow:Center() - -- local my_seat = self._player.seat - -- if fz.from_seat ~= my_seat then - -- pic_arrow:GetController("show").selectedIndex = 1 - -- pic_arrow:GetController("pos").selectedIndex = getPos(DataManager.CurrenRoom.self_player.seat, fz.from_seat, #DataManager.CurrenRoom.player_list) - -- pic_arrow:SetPivot(0.5, 0.5) - -- if DataManager.CurrenRoom.self_player.seat ~= self._player.seat then - -- pic_arrow.scaleX = 0.5 - -- pic_arrow.scaleY = 0.5 - -- end + -- if self._view_outCardList.numItems < #outlist - 1 then + -- for i = 1, #outlist - 1 do + -- outcard = self._view_outCardList:AddItemFromPool() + -- -- end + -- self:fillCard2(outcard, outCardName, outlist[i]) -- end -- end + + outCard = self._view_FZList:AddItemFromPool() + + if fz.type == FZType.Chi then + for i = 1, 3 do + local FZCard = outCard:GetChild(string.format("Comp_Card%d", i)) + self:fillCard2(FZCard, FZame, fz.opcard[i]) + end + else + local ctr_Four = outCard:GetController("isFour") + for i = 1, 3 do + local FZCard = outCard:GetChild(string.format("Comp_Card%d", i)) + self:fillCard2(FZCard, FZame, fz.card) + end + if fz.type == FZType.Peng then + ctr_Four.selectedIndex = 0 + else + ctr_Four.selectedIndex = 1 + local FZCard = outCard:GetChild(string.format("Comp_Card%d", 4)) + self:fillCard2(FZCard, FZame, fz.card) + if fz.type == FZType.Gang_An then + self:fillCard2(FZCard, FZame, '00') + end + end + end + -- self:fillCard2(outcard, outCardName, card_item) end function M:GetOutCardByIndex(index) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua index ab345a5a..25ae0b2e 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua @@ -206,20 +206,26 @@ function M:UpdateOutCardList(outcard, card_item) local outcard local outlist = self._player.outcard_list - if self._view_outCardList.numItems < #outlist - 1 then - for i = 1, #outlist - 1 do - outcard = self._view_outCardList:AddItemFromPool() - -- end - self:fillCard2(outcard, outCardName, outlist[i]) - end + + -- if self._view_outCardList.numItems < #outlist - 1 then + -- for i = 1, #outlist - 1 do + -- outcard = self._view_outCardList:AddItemFromPool() + -- -- end + -- self:fillCard2(outcard, outCardName, outlist[i]) + -- end + -- end + self._view_outCardList:RemoveChildrenToPool() + for i = 0, #outlist - 1 do + outcard = self._view_outCardList:AddItemFromPool() + self:fillCard2(outcard, outCardName, outlist[i + 1]) end -- if self._viewText_cardInfo['Order'] == "desc" then -- outcard = self._view_handCardList:GetFromPool("ui://Main_Majiang/Comp_4_OutCard") -- self._view_outCardList:AddChildAt(outcard, 0) -- else - outcard = self._view_outCardList:AddItemFromPool() - -- end - self:fillCard2(outcard, outCardName, card_item) + -- outcard = self._view_outCardList:AddItemFromPool() + -- -- end + -- self:fillCard2(outcard, outCardName, card_item) end function M:onTouchBegin(context)