--不够天数查看奖励界面
|
|
GiftShowAllView = GiftShowAllView or BaseClass(BaseView)
|
|
|
|
function GiftShowAllView:__init()
|
|
self.base_file = "gift"
|
|
self.layout_file = "GiftShowAllView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.is_set_zdepth = true
|
|
self.close_mode = CloseMode.CloseDestroy
|
|
self.model = GiftModel:getInstance()
|
|
|
|
self.reward_item_list = {}
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:addEvents()
|
|
end
|
|
|
|
self.open_callback = function ()
|
|
self:setData()
|
|
end
|
|
|
|
self.close_callback = function ()
|
|
|
|
end
|
|
|
|
self.destroy_callback = function ()
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function GiftShowAllView:Open(type_id, need_day)
|
|
self.type_id = tonumber(type_id)
|
|
self.need_day = tonumber(need_day)
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GiftShowAllView:DestroySuccess()
|
|
for _, item in pairs(self.reward_item_list) do
|
|
item:ReleaseObj()
|
|
end
|
|
self.reward_item_list = {}
|
|
end
|
|
|
|
function GiftShowAllView:LoadSuccess()
|
|
self.close_btn = self:GetChild("close_btn").gameObject
|
|
self.name_text = self:GetChild("name_text"):GetComponent("Text")
|
|
self.tips_text = self:GetChild("tips_text"):GetComponent("Text")
|
|
self.sure_btn = self:GetChild("sure_btn").gameObject
|
|
self.scroll_view = self:GetChild("scroll_view/Viewport/Content")
|
|
end
|
|
|
|
function GiftShowAllView:addEvents()
|
|
local function click_func(target)
|
|
if target == self.close_btn then
|
|
self:Close()
|
|
elseif target == self.sure_btn then
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.close_btn, click_func)
|
|
AddClickEvent(self.sure_btn, click_func)
|
|
end
|
|
|
|
function GiftShowAllView:setData()
|
|
local goods_base = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
|
|
local str_color = WordManager.GetGoodsColor(goods_base.color)
|
|
self.name_text.text = Language.substitute("<color={0}>{1}</color>", str_color, Trim(goods_base.goods_name))
|
|
local tips_str = "再登录<color='#31ee4a'>" .. self.need_day .. "</color>天即可领取下列奖励"
|
|
self.tips_text.text = tips_str
|
|
local config = self.model:getRewardConfig(self.type_id)
|
|
if config then
|
|
for i,v in ipairs(config.fixed_list) do
|
|
local item = self.reward_item_list[i]
|
|
if not item then
|
|
item = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem, self.scroll_view, nil, self.layer_name)
|
|
item:SetItemSize(80, 80)
|
|
self.reward_item_list[i] = item
|
|
end
|
|
local type_id = GoodsModel:getInstance():GetMappingTypeId(v.goods_type, v.goods_id)
|
|
item:SetData(type_id, v.goods_count)
|
|
item:SetVisible(true)
|
|
end
|
|
end
|
|
end
|