GiftActNormalItem = GiftActNormalItem or BaseClass(BaseItem)
|
|
local GiftActNormalItem = GiftActNormalItem
|
|
function GiftActNormalItem:__init(parent_wnd)
|
|
self.base_file = "gift"
|
|
self.layout_file = "GiftActNormalItem"
|
|
self.model = GiftModel:getInstance()
|
|
|
|
self:Load()
|
|
end
|
|
|
|
function GiftActNormalItem:__delete()
|
|
if self.item then
|
|
self.item:ReleaseObj()
|
|
self.item = nil
|
|
end
|
|
end
|
|
|
|
function GiftActNormalItem:Load_callback()
|
|
self:LoadSuccess()
|
|
self:addEvents()
|
|
end
|
|
|
|
function GiftActNormalItem:LoadSuccess()
|
|
local nodes = {
|
|
"icon", "goodsNameText:tmp",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
if self.item == nil then
|
|
self.item = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem, self.icon, nil, self.layer_name)
|
|
self.item:SetItemSize(78, 78)
|
|
end
|
|
|
|
if self.need_refreshData then
|
|
self:SetData(self.index,self.data,self.only_read_goods_type_id)
|
|
end
|
|
end
|
|
|
|
function GiftActNormalItem:addEvents()
|
|
|
|
end
|
|
|
|
function GiftActNormalItem:SetData(index, data,only_read_goods_type_id)
|
|
self.index = index
|
|
self.data = data
|
|
self.only_read_goods_type_id = only_read_goods_type_id
|
|
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
if not self.only_read_goods_type_id then
|
|
local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(self.data[1], self.data[2])
|
|
local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id)
|
|
local stren_data = nil
|
|
if goodVo then
|
|
self.item:SetData(goods_Id, self.data[3], nil, stren_data, lock,true,nil)
|
|
end
|
|
else
|
|
self.item:SetData(self.data[2], self.data[3])
|
|
end
|
|
if self.data[4] then
|
|
self.item:SetNumLimitVisible( true, self.data[4])
|
|
end
|
|
local goods_name = GoodsModel:getInstance():getGoodsName(self.data[2], true)
|
|
self.goodsNameText_tmp.text = goods_name
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|