同步四人,新作面shownext

master
罗家炜 2025-04-21 17:32:52 +08:00
parent b071af8324
commit 4786cecfb7
4 changed files with 81 additions and 92 deletions

View File

@ -101,7 +101,7 @@ function M:fillCard2(obj, pos_str, card)
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
obj:GetController('jing').selectedIndex = 1
end
obj.icon = 'ui://Main_Majiang/' .. pos_str .. card
obj:GetChild("icon").url = 'ui://Main_Majiang/' .. pos_str .. card
end
function M:getBackCard(card)
@ -179,96 +179,29 @@ function M:adjust3dOutPut(obj, area, oder, num, index)
end
function M:UpdateOutCardList(outcard, card_item, cursor)
print("lingmengoutpu", outcard, card_item, cursor)
outcard = outcard or nil
card_item = card_item or 0
cursor = cursor or nil
local outCardName = self._viewText_cardInfo['Out_Card']
local outcard
local outlist = self._player.outcard_list
if (outcard) then
outcard:SetPivot(0.5, 0.5, true)
outcard.touchable = false
-- outcard.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. card_item
outcard.icon = string.format('ui://%s/%s202_%s', self:GetCardPicPack(), self:GetPrefix(), card_item)
self._mask_liangpai:AddChild(outcard)
end
local outcard_list = self._mask_data['outcard_list']
local oder = outcard_list['oder']
local comp = outcard_list['comp']
local card = outcard_list['card']
local multi_oder = outcard_list['multi_oder']
local num = outcard_list['num']
local multi_draw_oder = 0
local sortStart = 0
local sortType = 0
local sortStep = 0
if (outcard_list['multi_draw_oder']) then
multi_draw_oder = outcard_list['multi_draw_oder']
end
if self._current_card_type == 2 then
comp = comp .. '_3d'
num = outcard_list['num3d']
multi_oder = outcard_list['multi_oder3d']
sortType = outcard_list['sorting_order3d']
card = outcard_list['card3d']
if sortType == 1 then
sortStart = 1
sortStep = 1
elseif sortType == -1 then
sortStart = #outlist
sortStep = -1
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
local obj = nil
self._area_outcard_list:RemoveChildren(0, -1, true)
for i = 0, #outlist - 1 do
obj = UIPackage.CreateObjectFromURL('ui://Main_Majiang/' .. comp)
local row = math.floor(i / num)
local col = math.floor(i % num)
if self._current_card_type == 2 then
if i >= num then
row = 1 + math.floor(((i - num) / (num + 2)))
col = ((i - num) % (num + 2))
end
end
if DataManager.CurrenRoom.room_config.people_num == 2 then
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, nil, nil, -6)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, nil, nil, -12)
elseif DataManager.CurrenRoom.room_config.people_num == 4 then
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, nil, nil, -6)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, nil, nil, -12)
else
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row)
end
if self._current_card_type == 2 then
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
end
self:fillCard(obj, card, outlist[i + 1])
-- 添加角标
self:AddFlag(i + 1, outlist[i], obj)
-- obj.icon = "ui://Main_Majiang/"..card .. outlist[i+1]
sortStart = sortStart + sortStep
obj.sortingOrder = sortStart
obj.data = outlist[i + 1]
if (oder == AreaOderType.down_up or (multi_draw_oder == 1)) then
self._area_outcard_list:AddChildAt(obj, 0)
else
self._area_outcard_list:AddChild(obj)
end
end
if (obj and cursor) then
cursor.xy = Vector2(obj.width / 2, obj.height / 2)
obj:AddChild(cursor)
obj:GetController('color').selectedIndex = 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)
end
-- 设置添加角标的方法

View File

@ -177,7 +177,6 @@ function M:UpdateHandCard(getcard, mp)
c_v.index = i
c_v.old_postion = btn_card.xy
_carViewList[#_carViewList + 1] = c_v
btn_card.data = c_v
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
@ -205,12 +204,21 @@ function M:UpdateOutCardList(outcard, card_item)
local outCardName = self._viewText_cardInfo['Out_Card']
local outcard
if self._viewText_cardInfo['Order'] == "desc" then
outcard = self._view_handCardList:GetFromPool(nil)
self._view_outCardList:AddChildAt(outcard, 0)
else
outcard = self._view_outCardList:AddItemFromPool()
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()
-- end
self:fillCard2(outcard, outCardName, card_item)
end
@ -251,6 +259,7 @@ function M:__OnDragEnd(context)
self._mainView:OutCard(card.card_item)
button.touchable = false
self.outcard_button = button
button.xy = self._touchPos
else
-- self._area_handcard_list:AddChildAt(button, card.index)
if self._touchIndex ~= card.index then
@ -267,7 +276,7 @@ end
function M:__OnClickHandCard(context)
self._ctr_seletedGet.selectedIndex = 0
local button = context.sender
local button = context.data
-- local _carViewList = self._carViewList
-- for i = 1, #_carViewList do
-- if (_carViewList[i].card ~= button) then
@ -297,6 +306,53 @@ function M:__OnClickGetCard(context)
end
end
function M:UpdateFzList(fz, index, show_card)
local isFour = false
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
isFour = true
end
local FZame = self._viewText_cardInfo['FZ_Card']
index = index or 0
show_card = show_card or nil
local outCard
-- 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", i))
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:Clear(bskip)

View File

@ -131,7 +131,7 @@ function M:fillCard2(obj, pos_str, card)
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
obj:GetController('jing').selectedIndex = 1
end
obj.icon = 'ui://Main_Majiang/' .. pos_str .. card
obj:GetChild("icon").url = 'ui://Main_Majiang/' .. pos_str .. card
end
function M:getBackCard(card)