2025-04-01 10:48:36 +08:00
|
|
|
AreaOderType = {
|
|
|
|
|
left_right = 'left_right',
|
|
|
|
|
right_left = 'right_left',
|
|
|
|
|
up_down = 'up_down',
|
|
|
|
|
down_up = 'down_up'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local PlayerCardInfoView = {
|
|
|
|
|
_view = nil,
|
|
|
|
|
_mainView = nil,
|
|
|
|
|
_mask_liangpai = nil,
|
|
|
|
|
_mask_data = nil,
|
|
|
|
|
_area_handcard_list = nil,
|
|
|
|
|
_src_fz_list = nil,
|
|
|
|
|
_current_card_type = -1
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-24 21:48:34 +08:00
|
|
|
local CardView = {
|
|
|
|
|
card = nil,
|
|
|
|
|
-- 牌序号
|
|
|
|
|
card_item = 0,
|
|
|
|
|
-- 索引
|
|
|
|
|
index = 0,
|
|
|
|
|
-- 原始位置
|
|
|
|
|
old_postion = Vector2.zero
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local function NewCardView(card, cardItem)
|
|
|
|
|
local self = {}
|
|
|
|
|
setmetatable(self, { __index = CardView })
|
|
|
|
|
self.card = card
|
|
|
|
|
self.card_item = cardItem
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
local M = PlayerCardInfoView
|
|
|
|
|
|
|
|
|
|
--- Create a new PlayerCardInfoView
|
2025-08-19 22:17:52 +08:00
|
|
|
function M.new(view, mainView, record, direction)
|
2025-04-01 10:48:36 +08:00
|
|
|
local self = {}
|
2025-04-01 13:56:18 +08:00
|
|
|
setmetatable(self, { __index = M })
|
2025-04-01 10:48:36 +08:00
|
|
|
self._view = view
|
|
|
|
|
self._mainView = mainView
|
2025-06-25 22:49:44 +08:00
|
|
|
self._flag_record = record
|
2025-08-19 22:17:52 +08:00
|
|
|
self.direction = direction
|
2025-04-01 10:48:36 +08:00
|
|
|
self:init()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:init()
|
2025-05-19 16:21:21 +08:00
|
|
|
local CardInfo = self._view:GetChild('Text_CardInfo')
|
2025-09-19 16:34:16 +08:00
|
|
|
printlog("lingmeng json text", CardInfo.text)
|
2025-05-19 16:21:21 +08:00
|
|
|
self._viewText_cardInfo = json.decode(CardInfo.text)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
self._view_handCardList = self._view:GetChild('List_HandCard')
|
|
|
|
|
self._view_FZList = self._view:GetChild('List_FZ')
|
|
|
|
|
self._view_outCardList = self._view:GetChild('List_OutCard')
|
2025-09-01 20:15:53 +08:00
|
|
|
self._viewList_HuEffect = self._view:GetChild("list_HuEffect")
|
|
|
|
|
self._viewLoader_selfHuCardEffect = self._view:GetChild("loader_selfHuCardEffect")
|
2025-09-08 14:39:21 +08:00
|
|
|
self._viewClip_effect_ZiMo = self._view:GetChild("effect_ZiMo")
|
2025-09-13 20:41:59 +08:00
|
|
|
self._viewClip_Peng_Gang = self._view:GetChild("area_clip_pg")
|
2025-06-24 21:48:34 +08:00
|
|
|
|
|
|
|
|
self._view_getCard = self._view:GetChild('Btn_HandCard')
|
2025-05-19 16:21:21 +08:00
|
|
|
self._ctr_getCard = self._view:GetController('getCard')
|
2025-06-25 22:49:44 +08:00
|
|
|
|
|
|
|
|
self._ctr_record = self._view:GetController('record')
|
|
|
|
|
if self._flag_record and self._flag_record == 1 and self._ctr_record then
|
2025-10-13 18:26:33 +08:00
|
|
|
-- self._ctr_record.selectedIndex = self._flag_record or 0
|
2025-06-25 22:49:44 +08:00
|
|
|
self._view_handCardList = self._view:GetChild('List_HandCard2')
|
|
|
|
|
self._view_getCard = self._view:GetChild('Btn_HandCard2')
|
|
|
|
|
end
|
2025-08-19 22:17:52 +08:00
|
|
|
|
2025-08-28 15:02:07 +08:00
|
|
|
if self.direction == "S" then
|
|
|
|
|
self._view_outCardList.layout = FairyGUI.ListLayoutType.FlowHorizontal_left2right_bottom2top
|
|
|
|
|
elseif self.direction == "N" then
|
|
|
|
|
self._view_outCardList.layout = FairyGUI.ListLayoutType.FlowHorizontal_right2left_top2bottom
|
|
|
|
|
elseif self.direction == "E" then
|
|
|
|
|
self._view_outCardList.layout = FairyGUI.ListLayoutType.FlowVertical_right2left_bottom2top
|
|
|
|
|
end
|
2025-04-24 17:25:42 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-04-24 17:25:42 +08:00
|
|
|
function M:SetPlayer(p)
|
|
|
|
|
self._player = p
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-24 17:25:42 +08:00
|
|
|
function M:FillData(begin)
|
|
|
|
|
if (begin) then
|
2025-05-19 16:21:21 +08:00
|
|
|
print("lingmengResetFzList2")
|
|
|
|
|
pt(self._player)
|
2025-04-24 17:25:42 +08:00
|
|
|
for i = 1, #self._player.fz_list do
|
|
|
|
|
self:UpdateFzList(self._player.fz_list[i], -1)
|
|
|
|
|
end
|
|
|
|
|
self:UpdateOutCardList()
|
|
|
|
|
else
|
|
|
|
|
self._current_card_type = DataManager.CurrenRoom.card_type
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-04-24 17:25:42 +08:00
|
|
|
if self._current_card_type == 2 then
|
|
|
|
|
local c3d = self._view:GetController('3d')
|
|
|
|
|
if c3d ~= nil then
|
|
|
|
|
c3d.selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local c3d = self._view:GetController('3d')
|
|
|
|
|
if c3d ~= nil then
|
|
|
|
|
c3d.selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
function M:Clear()
|
|
|
|
|
--self._ctr_state.selectedIndex = 0
|
2025-05-19 16:21:21 +08:00
|
|
|
|
|
|
|
|
self._view_handCardList:RemoveChildren(0, -1, true)
|
|
|
|
|
self._view_outCardList:RemoveChildren(0, -1, true)
|
|
|
|
|
self._view_FZList:RemoveChildren(0, -1, true)
|
|
|
|
|
self._view_getCard:RemoveChildren(0, -1, true)
|
2025-08-28 16:26:26 +08:00
|
|
|
if self._view:GetChild('List_HandCard2') then
|
|
|
|
|
self._view:GetChild('List_HandCard2'):RemoveChildren(0, -1, true)
|
|
|
|
|
end
|
2025-09-11 21:11:49 +08:00
|
|
|
if self._view:GetChild('Btn_HandCard2') then
|
|
|
|
|
self._view:GetChild('Btn_HandCard2'):RemoveChildren(0, -1, true)
|
|
|
|
|
end
|
2025-09-01 20:15:53 +08:00
|
|
|
self._viewList_HuEffect:RemoveChildren(0, -1, true)
|
2025-05-19 16:21:21 +08:00
|
|
|
self._view_handCardList.selectedIndex = -1
|
|
|
|
|
self._click_index = self._view_handCardList.selectedIndex
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 获取麻将资源前缀
|
|
|
|
|
function M:GetPrefix()
|
|
|
|
|
-- local card_type = DataManager.CurrenRoom.card_type
|
|
|
|
|
-- local prefix = card_type == 1 and "a" or ""
|
|
|
|
|
-- return prefix
|
|
|
|
|
return get_majiang_prefix(DataManager.CurrenRoom.game_id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:fillCard(obj, pos_str, card, use3d)
|
2025-04-10 16:28:06 +08:00
|
|
|
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
|
|
|
|
obj:GetController('jing').selectedIndex = 1
|
2025-09-12 15:36:45 +08:00
|
|
|
else
|
|
|
|
|
obj:GetController('jing').selectedIndex = 0
|
2025-04-10 16:28:06 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
if self._current_card_type == 2 and (use3d == nil or use3d == true) then
|
|
|
|
|
obj.icon = 'ui://MajiangCard3d/' .. 'b' .. pos_str .. card
|
|
|
|
|
else
|
|
|
|
|
obj.icon = 'ui://Main_Majiang/' .. self:GetPrefix() .. pos_str .. card
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-08-21 21:35:24 +08:00
|
|
|
function M:fillCard2(obj, pos_str, card, out)
|
2025-04-18 19:08:32 +08:00
|
|
|
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
|
|
|
|
obj:GetController('jing').selectedIndex = 1
|
2025-08-21 21:35:24 +08:00
|
|
|
if obj:GetController('out') then
|
|
|
|
|
obj:GetController('out').selectedIndex = out or 0
|
|
|
|
|
end
|
2025-09-12 15:36:45 +08:00
|
|
|
else
|
|
|
|
|
obj:GetController('jing').selectedIndex = 0
|
2025-04-18 19:08:32 +08:00
|
|
|
end
|
2025-05-19 16:21:21 +08:00
|
|
|
|
2025-04-21 17:32:52 +08:00
|
|
|
obj:GetChild("icon").url = 'ui://Main_Majiang/' .. pos_str .. card
|
2025-04-18 19:08:32 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
function M:getBackCard(card)
|
|
|
|
|
return 'ui://Main_Majiang/' .. card
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetCard(btn)
|
|
|
|
|
local pic_name = split(btn.icon, '/')[4]
|
|
|
|
|
local lst = string.split(pic_name, '_')
|
|
|
|
|
return tonumber(lst[2] or 0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateHandCard(getcard, mp)
|
|
|
|
|
getcard = getcard or false
|
|
|
|
|
mp = mp or false
|
2025-04-24 17:25:42 +08:00
|
|
|
|
2025-09-04 16:10:14 +08:00
|
|
|
--存在back_columnGap字段则调控列表间距
|
|
|
|
|
if self._viewText_cardInfo['back_columnGap'] and self._view_handCardList.columnGap ~= tonumber(self._viewText_cardInfo['back_columnGap']) then
|
|
|
|
|
self._view_handCardList.columnGap = tonumber(self._viewText_cardInfo['back_columnGap'])
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
self._view_handCardList:RemoveChildren()
|
|
|
|
|
self._view_getCard:RemoveChildren()
|
2025-06-24 21:48:34 +08:00
|
|
|
local btn_card
|
2025-05-19 16:21:21 +08:00
|
|
|
for i = 0, self._player.hand_left_count - 1 do
|
|
|
|
|
if getcard and i == self._player.hand_left_count - 1 then
|
2025-06-24 21:48:34 +08:00
|
|
|
btn_card = self._view_getCard:AddItemFromPool()
|
2025-05-19 16:21:21 +08:00
|
|
|
else
|
2025-06-24 21:48:34 +08:00
|
|
|
btn_card = self._view_handCardList:AddItemFromPool()
|
|
|
|
|
end
|
|
|
|
|
if mp then
|
|
|
|
|
local tem_card = self._player.card_list[i + 1]
|
|
|
|
|
self:FillHandCard(i, btn_card, tem_card, true)
|
2025-04-24 17:25:42 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-05-19 16:21:21 +08:00
|
|
|
self._ctr_getCard.selectedIndex = getcard and 1 or 0
|
|
|
|
|
print("lingmenghand", self._ctr_getCard.selectedIndex, self._view_getCard.numItems, self._view_getCard.visible)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:UpdateHandCardWitness(getcard, isSelf)
|
|
|
|
|
getcard = getcard or false
|
|
|
|
|
isSelf = isSelf or false
|
|
|
|
|
|
|
|
|
|
self._view_handCardList:RemoveChildren()
|
|
|
|
|
self._view_getCard:RemoveChildren()
|
|
|
|
|
|
|
|
|
|
for i = 0, self._player.hand_left_count - 1 do
|
|
|
|
|
local btn_card
|
|
|
|
|
if getcard and i == self._player.hand_left_count - 1 then
|
|
|
|
|
btn_card = self._view_getCard:AddItemFromPool()
|
|
|
|
|
else
|
|
|
|
|
btn_card = self._view_handCardList:AddItemFromPool()
|
|
|
|
|
end
|
|
|
|
|
if isSelf then
|
|
|
|
|
self:FillWitnessCard(btn_card)
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-06-10 19:49:18 +08:00
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
self._view_handCardList.touchable = false
|
|
|
|
|
self._view_getCard.touchable = false
|
2025-06-10 19:49:18 +08:00
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
self._ctr_getCard.selectedIndex = getcard and 1 or 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:FillWitnessCard(btn_card)
|
|
|
|
|
btn_card:GetChild("icon").url = 'ui://Main_Majiang/b201_0'
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
-- 获取麻将图片资源位置,可以在扩展中复写
|
|
|
|
|
function M:GetCardPicPack()
|
|
|
|
|
-- if DataManager.CurrenRoom.card_type == 2 then
|
|
|
|
|
-- return "MajiangCard3d"
|
|
|
|
|
-- else
|
|
|
|
|
return 'Main_Majiang'
|
|
|
|
|
-- end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:adjust3dOutPut(obj, area, oder, num, index)
|
|
|
|
|
if index >= num then
|
|
|
|
|
local row = 1 + math.floor(((index - num) / (num + 2)))
|
|
|
|
|
local col = ((index - num) % (num + 2))
|
|
|
|
|
|
|
|
|
|
if oder == AreaOderType.left_right then
|
|
|
|
|
obj.x = obj.x + math.floor((area.width - obj.width * (num + 2)) / 2)
|
|
|
|
|
elseif oder == AreaOderType.right_left then
|
|
|
|
|
obj.x = obj.x - math.floor((area.width - obj.width * (num + 2)) / 2)
|
|
|
|
|
elseif oder == AreaOderType.up_down then
|
|
|
|
|
obj.y = obj.y + math.floor((area.height - obj.height * (num + 2)) / 2)
|
|
|
|
|
obj.x = obj.x - col * 7 + 7 * (row + 1)
|
|
|
|
|
elseif oder == AreaOderType.down_up then
|
|
|
|
|
obj.y = obj.y - math.floor((area.height - obj.height * (num + 2)) / 2)
|
|
|
|
|
obj.x = obj.x - col * 7 - 7 * (row - 1)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if oder == AreaOderType.left_right then
|
|
|
|
|
obj.x = obj.x + math.floor((area.width - obj.width * num) / 2)
|
|
|
|
|
elseif oder == AreaOderType.right_left then
|
|
|
|
|
obj.x = obj.x - math.floor((area.width - obj.width * num) / 2)
|
|
|
|
|
elseif oder == AreaOderType.up_down then
|
|
|
|
|
obj.y = obj.y + math.floor((area.height - obj.height * num) / 2)
|
|
|
|
|
obj.x = obj.x - index * 7
|
|
|
|
|
elseif oder == AreaOderType.down_up then
|
|
|
|
|
obj.y = obj.y - math.floor((area.height - obj.height * num) / 2)
|
|
|
|
|
obj.x = obj.x - index * 7
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-24 21:48:34 +08:00
|
|
|
function M:FillHandCard(i, btn_card, tem_card, event)
|
|
|
|
|
local handCardName = self._viewText_cardInfo['Hand_Card']
|
|
|
|
|
|
|
|
|
|
self:fillCard2(btn_card, handCardName, tem_card)
|
|
|
|
|
local c_v = NewCardView(btn_card, tem_card)
|
|
|
|
|
c_v.index = i
|
|
|
|
|
c_v.old_postion = btn_card.xy
|
|
|
|
|
c_v.touch_pos = Vector2.New(btn_card.width / 2, btn_card.height / 2)
|
|
|
|
|
btn_card.data = c_v
|
|
|
|
|
if event then
|
|
|
|
|
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
|
|
|
|
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
|
|
|
|
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
function M:UpdateOutCardList(outcard, card_item, cursor)
|
|
|
|
|
outcard = outcard or nil
|
|
|
|
|
card_item = card_item or 0
|
|
|
|
|
cursor = cursor or nil
|
|
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
local outCardName = self._viewText_cardInfo['Out_Card']
|
2025-04-24 17:25:42 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
local outlist = self._player.outcard_list
|
2025-04-24 17:25:42 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
self._view_outCardList:RemoveChildrenToPool()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
for i = 0, #outlist - 1 do
|
2025-05-19 16:21:21 +08:00
|
|
|
local outcard = self._view_outCardList:AddItemFromPool()
|
2025-09-16 21:35:09 +08:00
|
|
|
outcard.data = outlist[i + 1]
|
2025-05-19 16:21:21 +08:00
|
|
|
self:fillCard2(outcard, outCardName, outlist[i + 1])
|
2025-06-10 19:28:53 +08:00
|
|
|
if cursor and i == #outlist - 1 then
|
2025-08-11 16:14:56 +08:00
|
|
|
Timer.New(function()
|
|
|
|
|
self._view:AddChild(cursor)
|
|
|
|
|
-- GRoot.inst:AddChild(cursor)
|
|
|
|
|
cursor.xy = self._view_outCardList.xy +
|
|
|
|
|
self._view_outCardList:GlobalToLocal(outcard:LocalToGlobal(Vector2.New(outcard.width * 0.5,
|
2025-09-10 20:32:26 +08:00
|
|
|
outcard.height * 0.4)))
|
2025-08-11 16:14:56 +08:00
|
|
|
end, Time.deltaTime, 1, false):Start()
|
2025-06-10 18:48:57 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 设置添加角标的方法
|
|
|
|
|
function M:SetAddFlag(cb)
|
|
|
|
|
self.__addFlag = cb
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 给麻将牌添加flag
|
|
|
|
|
function M:AddFlag(index, card, btn)
|
|
|
|
|
if not self.__addFlag then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local str_flag = self.__addFlag(index, card, btn)
|
|
|
|
|
btn:GetController('hun').selectedIndex = str_flag == '' and 0 or 1
|
|
|
|
|
btn:GetChild('flag').icon = str_flag
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function getPos(my_seat, other_seat, total)
|
|
|
|
|
local pos = 0
|
|
|
|
|
pos = other_seat - my_seat + 1
|
|
|
|
|
if pos <= 0 then
|
2025-04-01 13:56:18 +08:00
|
|
|
pos = pos + total
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
if total ~= 4 and pos == total then
|
|
|
|
|
pos = total + 1
|
|
|
|
|
end
|
|
|
|
|
return pos
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateFzList(fz, index, show_card)
|
2025-05-19 16:21:21 +08:00
|
|
|
local room = DataManager.CurrenRoom
|
|
|
|
|
-- local seat = (room.room_config.people_num == 2 and fz.from_seat == 2) and 2 or fz.from_seat - 1
|
2025-06-24 21:48:34 +08:00
|
|
|
local seat = ViewUtil.GetPos(room.self_player.seat, fz.from_seat or 1, room.room_config.people_num)
|
2025-05-19 16:21:21 +08:00
|
|
|
seat = (room.room_config.people_num == 2 and seat == 2) and 2 or seat - 1
|
|
|
|
|
print("lingmengUpdateFzList", fz, index, show_card, seat)
|
|
|
|
|
local FZame = self._viewText_cardInfo['FZ_Card']
|
|
|
|
|
index = index or 0
|
|
|
|
|
show_card = show_card or nil
|
|
|
|
|
|
|
|
|
|
local outCard = self._view_FZList:AddItemFromPool()
|
|
|
|
|
outCard:GetController("seat").selectedIndex = seat or 0
|
|
|
|
|
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])
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-24 17:10:13 +08:00
|
|
|
else
|
2025-05-19 16:21:21 +08:00
|
|
|
local ctr_Four = outCard:GetController("isFour")
|
|
|
|
|
outCard.data = fz.card
|
2025-04-24 17:25:42 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
for i = 1, 3 do
|
|
|
|
|
local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
|
|
|
|
|
self:fillCard2(FZCard, FZame, fz.card)
|
2025-04-24 17:10:13 +08:00
|
|
|
end
|
2025-05-19 16:21:21 +08:00
|
|
|
if fz.type == FZType.Peng then
|
|
|
|
|
ctr_Four.selectedIndex = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-05-19 16:21:21 +08:00
|
|
|
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
|
2025-09-01 23:30:10 +08:00
|
|
|
outCard:GetController("not_arrow").selectedIndex = 1
|
2025-05-19 16:21:21 +08:00
|
|
|
self:fillCard2(FZCard, FZame, '00')
|
|
|
|
|
if FZCard:GetController('jing') then
|
|
|
|
|
FZCard:GetController('jing').selectedIndex = 0
|
2025-04-24 17:25:42 +08:00
|
|
|
end
|
2025-05-19 16:21:21 +08:00
|
|
|
elseif fz.type == FZType.Gang_Peng then
|
|
|
|
|
for i = 1, self._view_FZList.numItems do
|
|
|
|
|
if self._view_FZList:GetChildAt(i - 1).data and self._view_FZList:GetChildAt(i - 1).data == fz.card then
|
|
|
|
|
outCard:GetController("seat").selectedIndex = self._view_FZList:GetChildAt(i - 1):GetController(
|
|
|
|
|
"seat").selectedIndex
|
|
|
|
|
self._view_FZList:RemoveChildrenToPool(i - 1, i - 1)
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-04-24 17:25:42 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-19 16:21:21 +08:00
|
|
|
-- self:fillCard2(outcard, outCardName, card_item)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetOutCardByIndex(index)
|
2025-09-16 21:35:09 +08:00
|
|
|
-- local outcard_list = self._mask_data['outcard_list']
|
|
|
|
|
-- local oder = outcard_list['oder']
|
|
|
|
|
-- local multi_draw_oder = 0
|
|
|
|
|
-- if (outcard_list['multi_draw_oder']) then
|
|
|
|
|
-- multi_draw_oder = outcard_list['multi_draw_oder']
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-09-16 21:35:09 +08:00
|
|
|
-- if (oder == AreaOderType.down_up or (multi_draw_oder == 1)) then
|
|
|
|
|
-- return self._area_outcard_list:GetChildAt(self._area_outcard_list.numChildren - index)
|
|
|
|
|
-- else
|
|
|
|
|
-- return self._area_outcard_list:GetChildAt(index - 1)
|
|
|
|
|
-- end
|
|
|
|
|
return self._view_outCardList:GetChildAt(index - 1)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ResetFzList()
|
|
|
|
|
for i = 1, #self._player.fz_list do
|
2025-05-19 16:21:21 +08:00
|
|
|
print("lingmengResetFzList")
|
|
|
|
|
pt(self._player)
|
2025-04-01 10:48:36 +08:00
|
|
|
local fz = self._player.fz_list[i]
|
|
|
|
|
-- if fz.type ~= FZType.Gang_Peng then
|
|
|
|
|
self:UpdateFzList(fz, -1)
|
|
|
|
|
-- else
|
|
|
|
|
-- self:UpdateFzList(fz, i)
|
|
|
|
|
-- end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function replace_card(obj, prefix)
|
|
|
|
|
local url = obj.icon
|
|
|
|
|
if url then
|
|
|
|
|
local len = string.len(url)
|
|
|
|
|
local pos = string.len('ui://Main_Majiang/') + 1
|
|
|
|
|
local head_char = string.sub(url, pos, pos)
|
|
|
|
|
local card = string.sub(url, pos, len)
|
|
|
|
|
if head_char >= 'a' then
|
|
|
|
|
card = string.sub(card, 2, len)
|
|
|
|
|
end
|
|
|
|
|
obj.icon = 'ui://Main_Majiang/' .. prefix .. card
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ResetCardType()
|
2025-05-19 16:21:21 +08:00
|
|
|
-- local old_card_type = self._current_card_type
|
|
|
|
|
-- self._current_card_type = DataManager.CurrenRoom.card_type
|
|
|
|
|
|
|
|
|
|
-- --设置3d标志
|
|
|
|
|
-- if self._current_card_type == 2 then
|
|
|
|
|
-- local c3d = self._view:GetController('3d')
|
|
|
|
|
-- if c3d ~= nil then
|
|
|
|
|
-- c3d.selectedIndex = 1
|
|
|
|
|
|
|
|
|
|
-- self._area_fz_list.x = self._src_fz_list_3d.x
|
|
|
|
|
-- self._area_fz_list.y = self._src_fz_list_3d.y
|
|
|
|
|
-- self._area_fz_list.width = self._src_fz_list_3d.z
|
|
|
|
|
-- self._area_fz_list.height = self._src_fz_list_3d.w
|
|
|
|
|
-- end
|
|
|
|
|
-- else
|
|
|
|
|
-- local c3d = self._view:GetController('3d')
|
|
|
|
|
-- if c3d ~= nil then
|
|
|
|
|
-- c3d.selectedIndex = 0
|
|
|
|
|
-- self._area_fz_list.x = self._src_fz_list.x
|
|
|
|
|
-- self._area_fz_list.y = self._src_fz_list.y
|
|
|
|
|
-- self._area_fz_list.width = self._src_fz_list.z
|
|
|
|
|
-- self._area_fz_list.height = self._src_fz_list.w
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
-- local change2d = false
|
|
|
|
|
-- if old_card_type == 2 and self._current_card_type ~= 2 then
|
|
|
|
|
-- change2d = true
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
-- local change3d = false
|
|
|
|
|
-- if old_card_type ~= 2 and self._current_card_type == 2 then
|
|
|
|
|
-- change3d = true
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
-- if change2d == false and change3d == false and self._current_card_type ~= 2 then
|
|
|
|
|
-- local prefix = self:GetPrefix()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
-- --更新已出牌
|
|
|
|
|
-- for i = 1, self._area_outcard_list.numChildren do
|
|
|
|
|
-- local obj = self._area_outcard_list:GetChildAt(i - 1)
|
|
|
|
|
-- replace_card(obj, prefix)
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
-- --更新手牌
|
|
|
|
|
-- for i = 1, self._area_handcard_list.numChildren do
|
|
|
|
|
-- local obj = self._area_handcard_list:GetChildAt(i - 1)
|
|
|
|
|
-- replace_card(obj, prefix)
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-05-19 16:21:21 +08:00
|
|
|
-- --更新放子牌
|
|
|
|
|
-- for i = 1, self._area_fz_list.numChildren do
|
|
|
|
|
-- local com = self._area_fz_list:GetChildAt(i - 1)
|
|
|
|
|
-- for j = 1, 4 do
|
|
|
|
|
-- local obj = com:GetChild('card_' .. j)
|
|
|
|
|
-- if obj then
|
|
|
|
|
-- replace_card(obj, prefix)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-07-18 16:28:57 +08:00
|
|
|
function M:ShowHand(cards)
|
2025-08-18 21:44:31 +08:00
|
|
|
local list = self._view_handCardList
|
2025-09-03 16:52:14 +08:00
|
|
|
local cardType = self._viewText_cardInfo["Hand_Card"]
|
2025-08-18 21:44:31 +08:00
|
|
|
if self._viewText_cardInfo['IS_SIDE'] == "true" then
|
2025-09-11 21:11:49 +08:00
|
|
|
self._view_handCardList:RemoveChildren()
|
2025-08-18 21:44:31 +08:00
|
|
|
list = self._view:GetChild('List_HandCard2')
|
|
|
|
|
cardType = self._viewText_cardInfo["Hand_Card"]
|
|
|
|
|
end
|
2025-09-04 16:10:14 +08:00
|
|
|
--存在show_columnGap字段则调控列表间距
|
|
|
|
|
if self._viewText_cardInfo['show_columnGap'] and list.columnGap ~= tonumber(self._viewText_cardInfo['show_columnGap']) then
|
|
|
|
|
list.columnGap = tonumber(self._viewText_cardInfo['show_columnGap'])
|
|
|
|
|
end
|
2025-09-13 20:41:59 +08:00
|
|
|
list:RemoveChildren(0, -1, true)
|
2025-08-18 21:44:31 +08:00
|
|
|
--list:RemoveChildren()
|
2025-08-19 22:17:52 +08:00
|
|
|
local passcard = false
|
2025-09-19 16:34:16 +08:00
|
|
|
if self._mainView:GetPos(self._player.seat) == 2 or self._mainView:GetPos(self._player.seat) == 3 then
|
|
|
|
|
local tem = {}
|
|
|
|
|
for i = #cards, 1, -1 do
|
|
|
|
|
table.insert(tem, cards[i])
|
|
|
|
|
end
|
|
|
|
|
cards = tem
|
|
|
|
|
end
|
2025-07-28 20:42:56 +08:00
|
|
|
for _, card in pairs(cards) do
|
2025-08-19 22:17:52 +08:00
|
|
|
if self.winCard == cards and passcard == false then
|
|
|
|
|
passcard = true
|
|
|
|
|
else
|
2025-08-18 21:44:31 +08:00
|
|
|
local obj = list:AddItemFromPool()
|
2025-08-21 21:35:24 +08:00
|
|
|
self:fillCard2(obj, cardType, card, 1)
|
2025-07-28 20:42:56 +08:00
|
|
|
end
|
2025-07-18 16:28:57 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
function M:ShowHuCard(card, flag_isme)
|
2025-07-28 20:42:56 +08:00
|
|
|
self.winCard = card
|
2025-08-04 15:35:45 +08:00
|
|
|
self._view_getCard:RemoveChildrenToPool()
|
2025-09-11 21:11:49 +08:00
|
|
|
local list = self._view_getCard
|
|
|
|
|
if self._viewText_cardInfo['IS_SIDE'] == "true" then
|
|
|
|
|
list = self._view:GetChild('Btn_HandCard2')
|
|
|
|
|
end
|
|
|
|
|
local btn_card = list:AddItemFromPool()
|
2025-08-19 22:17:52 +08:00
|
|
|
self._ctr_getCard.selectedIndex = 1
|
2025-09-11 21:11:49 +08:00
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
if flag_isme then
|
2025-09-19 23:25:36 +08:00
|
|
|
self:fillCard2(btn_card, self._viewText_cardInfo['Out_Card'], card, 1)
|
|
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
self._view_getCard:GetChildAt(0):GetController('showhang').selectedIndex = 1
|
|
|
|
|
self._view_getCard:GetChildAt(0):GetController('special_jing').selectedIndex = self._view_getCard:GetChildAt(0)
|
|
|
|
|
:GetController('jing').selectedIndex
|
|
|
|
|
self._view_getCard:GetChildAt(0):GetController('jing').selectedIndex = 0
|
2025-09-11 21:11:49 +08:00
|
|
|
else
|
|
|
|
|
self:fillCard2(btn_card, self._viewText_cardInfo['Hand_Card'], card, 1)
|
2025-09-03 16:52:14 +08:00
|
|
|
end
|
2025-07-28 20:42:56 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
return M
|