2025-05-25 11:35:02 +08:00
|
|
|
local PlayerSelfCardInfoView = import(".main.ZPPlayerSelfCardInfoView")
|
|
|
|
|
local CardCheck = import(".main.CardCheck")
|
|
|
|
|
local M = {}
|
2025-06-26 20:56:41 +08:00
|
|
|
--
|
|
|
|
|
function M.new(view, mainView)
|
|
|
|
|
setmetatable(M, { __index = PlayerSelfCardInfoView })
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-05-25 11:35:02 +08:00
|
|
|
self.class = "PlayerSelfCardInfoView"
|
|
|
|
|
self._view = view
|
|
|
|
|
self._mainView = mainView
|
|
|
|
|
self._full = true
|
|
|
|
|
self:init()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:onTouchBegin(context)
|
2025-06-26 20:56:41 +08:00
|
|
|
if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then
|
2025-05-25 11:35:02 +08:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local button = context.sender
|
|
|
|
|
local card = button.data
|
2025-06-26 20:56:41 +08:00
|
|
|
if DataManager.CurrenRoom.curren_outcard_seat == DataManager.CurrenRoom.self_player.seat then
|
2025-05-25 11:35:02 +08:00
|
|
|
self:ShowHuTip(card.card_item)
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
card.btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/204_", card.card_item)
|
|
|
|
|
-- card.btn_card:GetController('touch').selectedIndex = 1
|
2025-05-25 11:35:02 +08:00
|
|
|
card.btn_card.sortingOrder = 100
|
2025-06-26 20:56:41 +08:00
|
|
|
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
|
|
|
|
card.btn_card.xy = Vector2.New(card.btn_card.x + 20, card.btn_card.y - 50)
|
2025-05-25 11:35:02 +08:00
|
|
|
card.touch_pos = xy - button.xy
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__OnDragEnd(context)
|
2025-06-26 20:56:41 +08:00
|
|
|
if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then
|
2025-05-25 11:35:02 +08:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if self.outcard_button then
|
|
|
|
|
self.outcard_button = nil
|
|
|
|
|
end
|
|
|
|
|
local button = context.sender
|
2025-06-26 20:56:41 +08:00
|
|
|
|
2025-05-25 11:35:02 +08:00
|
|
|
local card = button.data
|
2025-06-26 20:56:41 +08:00
|
|
|
|
2025-05-25 11:35:02 +08:00
|
|
|
local _room = DataManager.CurrenRoom
|
|
|
|
|
card.btn_card.sortingOrder = 0
|
|
|
|
|
if (button.y < -380 and _room.curren_outcard_seat == _room.self_player.seat) then
|
|
|
|
|
button.touchable = false
|
|
|
|
|
self.outcard_button = card
|
|
|
|
|
self:UpdateIsOnClick(false)
|
|
|
|
|
self._mainView:OutCard(card.card_item)
|
|
|
|
|
else
|
|
|
|
|
local isChangeCard = false
|
|
|
|
|
self.outcard_button = nil
|
2025-06-26 20:56:41 +08:00
|
|
|
card.btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/201_", card.card_item)
|
2025-05-25 11:35:02 +08:00
|
|
|
self._area_handcard_list:AddChild(button)
|
|
|
|
|
if #self.card_list == 1 then
|
|
|
|
|
isChangeCard = false
|
|
|
|
|
self:UpdateHandCardsPos()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local CountCards = {}
|
2025-06-26 20:56:41 +08:00
|
|
|
for i = 1, #self.card_list do
|
2025-05-25 11:35:02 +08:00
|
|
|
local lists = {}
|
|
|
|
|
if CountCards[self.card_list[i].index_X] == nil then
|
2025-06-26 20:56:41 +08:00
|
|
|
lists[#lists + 1] = self.card_list[i]
|
|
|
|
|
CountCards[self.card_list[i].index_X] = lists
|
2025-05-25 11:35:02 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
CountCards[self.card_list[i].index_X][#CountCards[self.card_list[i].index_X] + 1] = self.card_list[i]
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local minmark = 1
|
|
|
|
|
local maxmark = #self.card_list
|
2025-06-26 20:56:41 +08:00
|
|
|
if card == self.card_list[1] or card == self.card_list[#self.card_list] then
|
2025-05-25 11:35:02 +08:00
|
|
|
if self.card_list[1].index_X == self.card_list[2].index_X then
|
2025-06-26 20:56:41 +08:00
|
|
|
minmark = 2
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if self.card_list[#self.card_list].index_X == self.card_list[#self.card_list - 1].index_X then
|
|
|
|
|
maxmark = #self.card_list - 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if button.x + button.width / 2 < self.card_list[minmark].btn_card.x and #CountCards < 10 and button.y > -380 then
|
|
|
|
|
list_remove(self.card_list, card)
|
2025-05-25 11:35:02 +08:00
|
|
|
local num = 0
|
2025-06-26 20:56:41 +08:00
|
|
|
for i = 1, #self.card_list do
|
2025-05-25 11:35:02 +08:00
|
|
|
if card.index_X == self.card_list[i].index_X and card.index_Y < self.card_list[i].index_Y then
|
2025-06-26 20:56:41 +08:00
|
|
|
self.card_list[i].index_Y = self.card_list[i].index_Y - 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
if card.index_X == self.card_list[i].index_X then
|
2025-06-26 20:56:41 +08:00
|
|
|
num = num + 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if num == 0 then
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
if self.card_list[i].index_X < card.index_X then
|
|
|
|
|
self.card_list[i].index_X = self.card_list[i].index_X + 1
|
|
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
self.card_list[i].index_X = self.card_list[i].index_X + 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
card.index_X = 1
|
|
|
|
|
card.index_Y = 1
|
|
|
|
|
table.insert(self.card_list, 1, card)
|
2025-05-25 11:35:02 +08:00
|
|
|
isChangeCard = true
|
2025-06-26 20:56:41 +08:00
|
|
|
elseif button.x + button.width / 2 > (self.card_list[maxmark].btn_card.x + button.width) and #CountCards < 10 and button.y > -380 then
|
|
|
|
|
list_remove(self.card_list, card)
|
2025-05-25 11:35:02 +08:00
|
|
|
local num = 0
|
2025-06-26 20:56:41 +08:00
|
|
|
for i = 1, #self.card_list do
|
2025-05-25 11:35:02 +08:00
|
|
|
if card.index_X == self.card_list[i].index_X then
|
2025-06-26 20:56:41 +08:00
|
|
|
num = num + 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
if card.index_X == self.card_list[i].index_X and card.index_Y < self.card_list[i].index_Y then
|
2025-06-26 20:56:41 +08:00
|
|
|
self.card_list[i].index_Y = self.card_list[i].index_Y - 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if num == 0 then
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
if self.card_list[i].index_X > card.index_X then
|
|
|
|
|
self.card_list[i].index_X = self.card_list[i].index_X - 1
|
|
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
card.index_X = self.card_list[#self.card_list].index_X + 1
|
|
|
|
|
card.index_Y = 1
|
|
|
|
|
self.card_list[#self.card_list + 1] = card
|
2025-05-25 11:35:02 +08:00
|
|
|
isChangeCard = true
|
2025-06-26 20:56:41 +08:00
|
|
|
else
|
2025-05-25 11:35:02 +08:00
|
|
|
local MoveCard = false
|
|
|
|
|
local MoveCardPos = 0
|
|
|
|
|
local MoveCardY = 0
|
2025-06-26 20:56:41 +08:00
|
|
|
for i = 1, #CountCards do
|
2025-05-25 11:35:02 +08:00
|
|
|
local card_view = CountCards[i][1]
|
2025-06-26 20:56:41 +08:00
|
|
|
if card_view ~= nil then
|
|
|
|
|
if button.x + button.width / 2 > card_view.old_postion.x and button.x + button.width / 2 < (card_view.old_postion.x + button.width) and button.y > -380 then
|
|
|
|
|
if card ~= card_view and #CountCards[i] < 4 and card.index_X ~= card_view.index_X then
|
2025-05-25 11:35:02 +08:00
|
|
|
MoveCardPos = i
|
2025-06-26 20:56:41 +08:00
|
|
|
MoveCardY = #CountCards[i] + 1
|
2025-05-25 11:35:02 +08:00
|
|
|
MoveCard = true
|
2025-06-26 20:56:41 +08:00
|
|
|
list_remove(self.card_list, card)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local MoveCardindex = 0
|
2025-06-26 20:56:41 +08:00
|
|
|
-- local MoveCardY = 0
|
2025-06-27 03:16:36 +08:00
|
|
|
-- print("lingmeng end", button.y, MoveCard, button.y > -380,
|
|
|
|
|
-- button.x + button.width / 2 > card.old_postion.x and
|
|
|
|
|
-- button.x + button.width / 2 < (card.old_postion.x + button.width) and button.y > -380)
|
2025-06-26 20:56:41 +08:00
|
|
|
if button.x + button.width / 2 > card.old_postion.x and button.x + button.width / 2 < (card.old_postion.x + button.width) and button.y > -380 then
|
|
|
|
|
if #CountCards[card.index_X] > 1 then
|
|
|
|
|
for i = 1, #CountCards[card.index_X] do
|
2025-05-25 11:35:02 +08:00
|
|
|
local _cv = CountCards[card.index_X][i]
|
|
|
|
|
if _cv ~= card then
|
2025-06-26 20:56:41 +08:00
|
|
|
if button.y + button.height / 2 > _cv.btn_card.y and button.y + button.height / 2 < (_cv.btn_card.y + button.height) then
|
2025-05-25 11:35:02 +08:00
|
|
|
--向下移動
|
2025-06-26 20:56:41 +08:00
|
|
|
if ((button.y + button.height / 2) + 20) > (card.old_postion.y + button.height) then
|
|
|
|
|
MoveCardindex = -1
|
|
|
|
|
MoveCardPos = card.index_X
|
|
|
|
|
MoveCardY = _cv.index_Y
|
|
|
|
|
MoveCard = true
|
|
|
|
|
list_remove(self.card_list, card)
|
|
|
|
|
--向上移動
|
|
|
|
|
elseif ((button.y + button.height / 2) - 20) < card.old_postion.y then
|
|
|
|
|
MoveCardindex = 1
|
|
|
|
|
MoveCardPos = card.index_X
|
|
|
|
|
MoveCardY = _cv.index_Y
|
|
|
|
|
MoveCard = true
|
|
|
|
|
list_remove(self.card_list, card)
|
|
|
|
|
end
|
|
|
|
|
elseif i == #CountCards[card.index_X] and button.y + button.height / 2 < _cv.btn_card.y then
|
|
|
|
|
MoveCardindex = 1
|
|
|
|
|
MoveCardPos = card.index_X
|
|
|
|
|
MoveCardY = _cv.index_Y
|
|
|
|
|
MoveCard = true
|
|
|
|
|
list_remove(self.card_list, card)
|
|
|
|
|
elseif i == 1 and button.y + button.height / 2 > (_cv.btn_card.y + button.width) then
|
|
|
|
|
MoveCardindex = -1
|
|
|
|
|
MoveCardPos = card.index_X
|
|
|
|
|
MoveCardY = _cv.index_Y
|
|
|
|
|
MoveCard = true
|
|
|
|
|
list_remove(self.card_list, card)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-06-27 03:16:36 +08:00
|
|
|
-- print("lingmeng end", MoveCard, MoveCardindex)
|
2025-06-26 20:56:41 +08:00
|
|
|
if MoveCard == true and MoveCardindex == 0 then
|
2025-05-25 11:35:02 +08:00
|
|
|
local num = 0
|
2025-06-26 20:56:41 +08:00
|
|
|
for i = 1, #self.card_list do
|
2025-05-25 11:35:02 +08:00
|
|
|
if card.index_X == self.card_list[i].index_X and card.index_Y < self.card_list[i].index_Y then
|
2025-06-26 20:56:41 +08:00
|
|
|
self.card_list[i].index_Y = self.card_list[i].index_Y - 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
if card.index_X == self.card_list[i].index_X then
|
2025-06-26 20:56:41 +08:00
|
|
|
num = num + 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if num == 0 then
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
if self.card_list[i].index_X > card.index_X then
|
|
|
|
|
self.card_list[i].index_X = self.card_list[i].index_X - 1
|
|
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
if MoveCardPos > card.index_X then
|
2025-06-26 20:56:41 +08:00
|
|
|
MoveCardPos = MoveCardPos - 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
card.index_X = MoveCardPos
|
|
|
|
|
card.index_Y = MoveCardY
|
|
|
|
|
for i = #self.card_list, 1, -1 do
|
2025-05-25 11:35:02 +08:00
|
|
|
if MoveCardPos == self.card_list[i].index_X then
|
2025-06-26 20:56:41 +08:00
|
|
|
table.insert(self.card_list, (i + 1), card)
|
2025-05-25 11:35:02 +08:00
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
isChangeCard = true
|
2025-06-26 20:56:41 +08:00
|
|
|
--上下移动
|
|
|
|
|
elseif MoveCard == true and MoveCardindex ~= 0 then
|
|
|
|
|
for i = 1, #self.card_list do
|
|
|
|
|
if card.index_X == self.card_list[i].index_X then
|
2025-05-25 11:35:02 +08:00
|
|
|
--向下移动
|
|
|
|
|
if MoveCardindex == -1 then
|
2025-06-26 20:56:41 +08:00
|
|
|
if self.card_list[i].index_Y < card.index_Y and self.card_list[i].index_Y >= MoveCardY then
|
2025-05-25 11:35:02 +08:00
|
|
|
self.card_list[i].index_Y = self.card_list[i].index_Y + 1
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
--向上移动
|
2025-05-25 11:35:02 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
if self.card_list[i].index_Y > card.index_Y and self.card_list[i].index_Y <= MoveCardY then
|
|
|
|
|
self.card_list[i].index_Y = self.card_list[i].index_Y - 1
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
card.index_X = MoveCardPos
|
|
|
|
|
card.index_Y = MoveCardY
|
|
|
|
|
for i = #self.card_list, 1, -1 do
|
|
|
|
|
if MoveCardPos == self.card_list[i].index_X and self.card_list[i].index_Y == (MoveCardY - 1) then
|
|
|
|
|
table.insert(self.card_list, (i + 1), card)
|
2025-05-25 11:35:02 +08:00
|
|
|
break
|
2025-06-26 20:56:41 +08:00
|
|
|
elseif MoveCardPos == self.card_list[i].index_X and self.card_list[i].index_Y == (MoveCardY + 1) then
|
|
|
|
|
table.insert(self.card_list, i, card)
|
2025-05-25 11:35:02 +08:00
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
isChangeCard = true
|
|
|
|
|
else
|
|
|
|
|
isChangeCard = false
|
|
|
|
|
self._area_handcard_list:AddChild(button)
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
self:UpdateHandCardsPos()
|
2025-06-26 20:56:41 +08:00
|
|
|
if isChangeCard == true then
|
2025-05-25 11:35:02 +08:00
|
|
|
self:SendChangeCard()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
function M:UpdateOutCardList(outcard, isShow, isMopai, seat)
|
|
|
|
|
if (isShow == nil) then
|
|
|
|
|
isShow = false
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if (isMopai == nil) then
|
|
|
|
|
isMopai = false
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
self._area_outcard_list:RemoveChildren(0, -1, true)
|
|
|
|
|
local outcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
|
|
|
|
|
|
|
|
|
if outcard == 0 then
|
|
|
|
|
--outcards:GetChild("icon").icon ="ui://Main_RunBeard/202_1_300"
|
2025-05-25 11:35:02 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
outcards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", outcard)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
outcards.x, outcards.y = 0, 0
|
|
|
|
|
local show_di_bg = outcards:GetChild("show_di_bg")
|
2025-05-25 11:35:02 +08:00
|
|
|
--show_di_bg.visible = true
|
2025-06-26 20:56:41 +08:00
|
|
|
if (isShow) then
|
|
|
|
|
if outcard == 0 then
|
|
|
|
|
show_di_bg.visible = false
|
|
|
|
|
end
|
|
|
|
|
if (seat ~= nil and outcards ~= nil) then
|
|
|
|
|
if (isMopai) then
|
|
|
|
|
if outcard ~= 0 then
|
|
|
|
|
outcards:GetTransition("mopai" .. seat):Play(function()
|
|
|
|
|
-- show_di_bg.visible = true
|
|
|
|
|
end)
|
|
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
show_di_bg.visible = false
|
|
|
|
|
outcards:GetTransition("cpai" .. seat):Play()
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
else
|
|
|
|
|
--show_di_bg.visible = true
|
|
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
show_di_bg.visible = false
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
self._area_outcard_list:AddChild(outcards)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--弃牌
|
2025-06-26 20:56:41 +08:00
|
|
|
function M:UpdateQiPai(qi_list, isplay)
|
|
|
|
|
self._area_qipai_list:RemoveChildren(0, -1, true)
|
|
|
|
|
for i = 1, #qi_list do
|
|
|
|
|
local qicards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai")
|
|
|
|
|
qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_", qi_list[i])
|
|
|
|
|
if (isplay) then
|
|
|
|
|
if (i == #qi_list) then
|
|
|
|
|
qicards:GetTransition("t0"):Play()
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
end
|
|
|
|
|
self._area_qipai_list:AddChild(qicards)
|
|
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--摸牌动画
|
2025-06-26 20:56:41 +08:00
|
|
|
function M:PlayingOutCardAnima(card)
|
2025-05-25 11:35:02 +08:00
|
|
|
coroutine.start(function()
|
2025-06-26 20:56:41 +08:00
|
|
|
coroutine.wait(0.1)
|
|
|
|
|
-- self._bgview.selectedIndex = 1
|
2025-05-25 11:35:02 +08:00
|
|
|
self:ClearOutCard()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
function M:UpdateFzList(fz_list, ispaly)
|
2025-06-20 11:52:54 +08:00
|
|
|
--printlog("UpdateFzList area_fz_list2")
|
2025-06-26 20:56:41 +08:00
|
|
|
self._area_fz_list:RemoveChildren(0, -1, true)
|
|
|
|
|
for i = 1, #fz_list do
|
|
|
|
|
local fzitem = nil
|
2025-05-25 11:35:02 +08:00
|
|
|
if fz_list[i].type ~= RB_FZType.Kan then
|
2025-06-26 20:56:41 +08:00
|
|
|
fzitem = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/ComponentNew")
|
|
|
|
|
if (ispaly == false) then
|
|
|
|
|
fzitem:RemoveChildren(0, -1, true)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
if fz_list[i].type == RB_FZType.Chi or fz_list[i].type == RB_FZType.Bi then
|
|
|
|
|
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
|
|
|
|
fzcards:GetChild("card_" .. 1).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].active_card)
|
2025-05-25 11:35:02 +08:00
|
|
|
fzcards:GetController("c2").selectedIndex = 1
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards:GetChild("card_" .. 2).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[1])
|
|
|
|
|
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[2])
|
|
|
|
|
fzcards.x, fzcards.y = 0, 0
|
2025-05-25 11:35:02 +08:00
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
2025-05-25 11:35:02 +08:00
|
|
|
elseif fz_list[i].type == RB_FZType.Peng then
|
2025-06-26 20:56:41 +08:00
|
|
|
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
|
|
|
|
for j = 1, 3 do
|
|
|
|
|
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards.x, fzcards.y = 0, 0
|
|
|
|
|
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
2025-05-25 11:35:02 +08:00
|
|
|
elseif fz_list[i].type == RB_FZType.Wei then
|
2025-06-26 20:56:41 +08:00
|
|
|
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
|
|
|
|
fzcards:GetController("c1").selectedIndex = 1
|
|
|
|
|
for j = 1, 3 do
|
|
|
|
|
if j == 1 then
|
|
|
|
|
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
2025-05-28 03:06:01 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
2025-05-28 03:06:01 +08:00
|
|
|
end
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards.x, fzcards.y = 0, 0
|
|
|
|
|
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
2025-05-25 11:35:02 +08:00
|
|
|
elseif fz_list[i].type == RB_FZType.ChouWei then
|
2025-06-26 20:56:41 +08:00
|
|
|
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
|
|
|
|
for j = 1, 2 do
|
|
|
|
|
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
|
|
|
|
fzcards.x, fzcards.y = 0, 0
|
|
|
|
|
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
2025-05-25 11:35:02 +08:00
|
|
|
elseif fz_list[i].type == RB_FZType.Pao then
|
2025-06-26 20:56:41 +08:00
|
|
|
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
|
|
|
|
for j = 1, 4 do
|
|
|
|
|
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards.x, fzcards.y = 0, 0
|
|
|
|
|
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
2025-05-25 11:35:02 +08:00
|
|
|
elseif fz_list[i].type == RB_FZType.Ti then
|
2025-06-26 20:56:41 +08:00
|
|
|
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
|
|
|
|
for j = 1, 4 do
|
|
|
|
|
if j == 1 then
|
|
|
|
|
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
2025-05-25 11:35:02 +08:00
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
fzcards.x, fzcards.y = 0, 0
|
|
|
|
|
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
function M:playAnim(fzitem, fzcards, size, i, ispaly)
|
|
|
|
|
if (ispaly == nil) then
|
|
|
|
|
ispaly = false
|
|
|
|
|
end
|
|
|
|
|
if (ispaly and i == size) then
|
|
|
|
|
local faArray = fzitem:GetChild("chiwei")
|
|
|
|
|
if (faArray ~= nil) then
|
|
|
|
|
faArray:AddChild(fzcards)
|
|
|
|
|
else
|
|
|
|
|
fzitem:AddChild(fzcards)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
fzitem:AddChild(fzcards)
|
|
|
|
|
end
|
2025-06-27 03:16:36 +08:00
|
|
|
self._area_fz_list:AddChildAt(fzitem,0)
|
|
|
|
|
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
--出牌提示动画
|
|
|
|
|
function M:ChuPaiTiShi()
|
|
|
|
|
if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then
|
2025-05-25 11:35:02 +08:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local chu_player = DataManager.CurrenRoom.self_player
|
|
|
|
|
local selfplayeTable = {}
|
|
|
|
|
selfplayeTable.handcard_list = chu_player.handcard_list
|
|
|
|
|
selfplayeTable.fz_list = chu_player.fz_list
|
|
|
|
|
selfplayeTable.tiCount = chu_player.tiCount
|
|
|
|
|
selfplayeTable.paoCount = chu_player.paoCount
|
|
|
|
|
selfplayeTable.hu_xi = chu_player.hu_xi
|
|
|
|
|
local player = membe_deep_clone(selfplayeTable)
|
2025-06-26 20:56:41 +08:00
|
|
|
local mark_ting = {}
|
|
|
|
|
for i = 1, #DataManager.CurrenRoom.self_player.handcard_list do
|
|
|
|
|
local card = DataManager.CurrenRoom.self_player.handcard_list[i]
|
2025-05-25 11:35:02 +08:00
|
|
|
list_remove(player.handcard_list, card)
|
|
|
|
|
local _player = membe_deep_clone(player)
|
2025-06-26 20:56:41 +08:00
|
|
|
local tingList = CardCheck.tingPai(_player, DataManager.CurrenRoom)
|
2025-05-25 11:35:02 +08:00
|
|
|
local isKan = false
|
2025-06-26 20:56:41 +08:00
|
|
|
for j = 1, #player.fz_list do
|
2025-05-25 11:35:02 +08:00
|
|
|
if card == player.fz_list[j].card and player.fz_list[j].type == RB_FZType.Kan then
|
2025-06-26 20:56:41 +08:00
|
|
|
isKan = true
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if #tingList > 0 and isKan == false then
|
2025-06-26 20:56:41 +08:00
|
|
|
mark_ting[#mark_ting + 1] = card
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
|
|
|
|
table.insert(player.handcard_list, card)
|
2025-06-26 20:56:41 +08:00
|
|
|
table.sort(player.handcard_list, ViewUtil.HandCardSort)
|
2025-05-25 11:35:02 +08:00
|
|
|
end
|
2025-06-26 20:56:41 +08:00
|
|
|
if DataManager.CurrenRoom.curren_outcard_seat == DataManager.CurrenRoom.self_player.seat then
|
|
|
|
|
self._view:GetController("chupai").selectedIndex = 1
|
|
|
|
|
if #mark_ting > 0 then
|
|
|
|
|
for i = 1, #mark_ting do
|
|
|
|
|
for k = 1, #self.card_list do
|
|
|
|
|
local card_view = self.card_list[k]
|
2025-05-25 11:35:02 +08:00
|
|
|
if card_view.card_item == mark_ting[i] then
|
|
|
|
|
card_view.btn_card:GetController("mark_ting").selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
2025-06-26 20:56:41 +08:00
|
|
|
self._view:GetController("chupai").selectedIndex = 0
|
|
|
|
|
for k = 1, #self.card_list do
|
|
|
|
|
local card_view = self.card_list[k]
|
2025-05-25 11:35:02 +08:00
|
|
|
card_view.btn_card:GetController("mark_ting").selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-26 20:56:41 +08:00
|
|
|
return M
|