hengyang_client/lua_probject/extend_project/extend/poker2/suoha/ExPlayerPokerInfoView.lua

65 lines
1.5 KiB
Lua
Raw Permalink Normal View History

2025-05-07 10:29:37 +08:00
---
--- Created by 谌建军.
--- DateTime: 2017/12/13 16:35
---
2025-05-14 10:59:30 +08:00
local EXPlayerPokerInfoView = {
2025-05-07 10:29:37 +08:00
_view = nil,
_mainView = nil,
_mask_liangpai = nil,
}
2025-05-14 10:59:30 +08:00
local M = EXPlayerPokerInfoView
2025-05-07 10:29:37 +08:00
function M.new(view, mainView)
local self = {}
setmetatable(self, { __index = M })
self._view = view
self._mainView = mainView
self:init()
return self
end
function M:init()
local view = self._view
self._gameCtr = ControllerManager.GetController(GameController)
2025-05-14 10:59:30 +08:00
self._view_handCardList = view:GetChild('list_handCard')
end
function M:UpdateHandPoker(cardList)
2025-05-15 16:49:18 +08:00
print("lingmengUpdateHandPoker", #cardList)
self._view_handCardList:RemoveChildren()
for i = 1, #cardList do
local obj = self._view_handCardList:AddItemFromPool()
print("lingmengUpdateHandPoker2", obj, cardList[i], string.format("ui://Main_Poker/%s", cardList[i]))
self:FillPoker(obj, cardList[i])
end
2025-05-14 10:59:30 +08:00
end
2025-05-15 16:49:18 +08:00
function M:FillPoker(poker2, code)
code = code == 0 and "00" or code
2025-05-14 10:59:30 +08:00
if not poker2.icon then
2025-05-15 16:49:18 +08:00
poker2:GetChild('icon').url = string.format("ui://Main_Poker/%s", code)
2025-05-14 10:59:30 +08:00
else
2025-05-15 16:49:18 +08:00
poker2.icon = string.format("ui://Main_Poker/%s", code)
2025-05-14 10:59:30 +08:00
end
end
function M:ChangeCodeByTo(card)
local flower = card % 10
local number = math.floor(card / 10)
if number == 15 then
number = 2
end
return flower * 100 + number
2025-05-07 10:29:37 +08:00
end
function M:Clear()
self.hand_card_list:RemoveChildren(0, -1, true)
end
function M:Destroy()
end
return M