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

65 lines
1.5 KiB
Lua

---
--- Created by 谌建军.
--- DateTime: 2017/12/13 16:35
---
local EXPlayerPokerInfoView = {
_view = nil,
_mainView = nil,
_mask_liangpai = nil,
}
local M = EXPlayerPokerInfoView
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)
self._view_handCardList = view:GetChild('list_handCard')
end
function M:UpdateHandPoker(cardList)
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
end
function M:FillPoker(poker2, code)
code = code == 0 and "00" or code
if not poker2.icon then
poker2:GetChild('icon').url = string.format("ui://Main_Poker/%s", code)
else
poker2.icon = string.format("ui://Main_Poker/%s", code)
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
end
function M:Clear()
self.hand_card_list:RemoveChildren(0, -1, true)
end
function M:Destroy()
end
return M