同步版本修改,胡牌手牌更新顺序和小结算手牌排序

master
罗家炜 2025-05-07 18:55:13 +08:00
parent 7ee1038f09
commit 4678fa548a
7 changed files with 12 additions and 12 deletions

View File

@ -181,6 +181,8 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])

View File

@ -367,7 +367,7 @@ function M:EventInit()
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(false, true)
local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi") local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi")
obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card

View File

@ -181,6 +181,8 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])

View File

@ -181,6 +181,8 @@ function M:fillResult0(room, peopleNum, result)
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort)
handCardList:SetVirtual() handCardList:SetVirtual()
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])

View File

@ -365,7 +365,7 @@ function M:EventInit()
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(false, true)
local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi") local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi")
obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card

View File

@ -179,26 +179,20 @@ function M:fillResult0(room, peopleNum, result)
end end
end end
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
local handCardList = handCardItem:GetChild("list") local handCardList = handCardItem:GetChild("list")
--手牌排序 --手牌排序
table.sort(infoList.hand_card, ViewUtil.HandCardSort) table.sort(infoList.hand_card, ViewUtil.HandCardSort)
handCardList:SetVirtual() handCardList:SetVirtual()
--去除赢家手牌标志
local flag_remove = infoList.is_win
local num_add = 0
handCardList.itemRenderer = function(index, obj) handCardList.itemRenderer = function(index, obj)
if infoList.win_card == infoList.hand_card[index + 1] and flag_remove then
flag_remove = false
num_add = 1
end
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(),
infoList.hand_card[index + num_add + 1]) infoList.hand_card[index + 1])
if room.jing == infoList.hand_card[index + 1] then if room.jing == infoList.hand_card[index + 1] then
obj:GetController('jing').selectedIndex = 1 obj:GetController('jing').selectedIndex = 1
end end
end end
handCardList.numItems = infoList.is_win and handInfoNum - 1 or handInfoNum handCardList.numItems = handInfoNum
allCardsList.width = 172 * fzInfoNum + 60 + (handInfoNum - 1) * 56 + 36 * (fzInfoNum) allCardsList.width = 172 * fzInfoNum + 60 + (handInfoNum - 1) * 56 + 36 * (fzInfoNum)
if infoList.seat == room.self_player.seat then if infoList.seat == room.self_player.seat then

View File

@ -365,7 +365,7 @@ function M:EventInit()
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(false, true)
local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi") local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi")
obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card