ChildHandbookSuitRewardView = ChildHandbookSuitRewardView or BaseClass(BaseView)
|
|
local ChildHandbookSuitRewardView = ChildHandbookSuitRewardView
|
|
-- ChildHandbookSuitRewardView.TabData = {
|
|
-- [1] = {name = "人物", level = 1},
|
|
-- [2] = {name = "人", level = 1},
|
|
-- [3] = {name = "物", level = 1},
|
|
-- }
|
|
|
|
function ChildHandbookSuitRewardView:__init()
|
|
self.base_file = "child"
|
|
self.layout_file = "ChildHandbookSuitRewardView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true --全屏界面默认使用这个参数
|
|
self.hide_maincancas = true
|
|
self.change_scene_close = true
|
|
self.append_to_ctl_queue = false --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
self.is_set_zdepth = true
|
|
self.blur_activity_bg = true
|
|
|
|
self.reward_item_list = {}
|
|
self.model = ChildModel:GetInstance()
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:OpenSuccess()
|
|
end
|
|
self.switch_callback = function(index)
|
|
self:SwitchTab(index)
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function ChildHandbookSuitRewardView:Open( )
|
|
--self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function ChildHandbookSuitRewardView:LoadSuccess()
|
|
local nodes = {
|
|
"container","container/ScrollView_item/Viewport/Content_item",
|
|
}
|
|
self:GetChildren(nodes)
|
|
local closeWin_callback = function()
|
|
self:Close()
|
|
end
|
|
self.tabWindowComponent = UITabWindow.New(self.transform,{},select_callback,closeWin_callback,self.background_wnd,self.container, UITabWindow.SizeSmallNoTab, false,nil,true)
|
|
self.tabWindowComponent:SetBackgroundRes("chat_dress_bg2")
|
|
self.tabWindowComponent:SetTitleText("套装奖励")
|
|
self.tabWindowComponent:ChangeShowFlag("Child")
|
|
end
|
|
|
|
function ChildHandbookSuitRewardView:AddEvent()
|
|
local function updata_child_suit_reward_info_fun()
|
|
if self:HasOpen() then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
self.updata_child_suit_reward_info = self.model:Bind(ChildConst.UPDATA_CHILD_HB_SUIT_REWARD_INFO, updata_child_suit_reward_info_fun) --
|
|
|
|
end
|
|
|
|
function ChildHandbookSuitRewardView:OpenSuccess()
|
|
self:UpdateView()
|
|
end
|
|
|
|
function ChildHandbookSuitRewardView:UpdateView()
|
|
local suitRewardList = self.model:GetChildSuitRewardList()
|
|
local index = 0
|
|
local max_count = TableSize(suitRewardList)
|
|
for k,v in pairs(suitRewardList) do
|
|
local item = self.reward_item_list[k]
|
|
index = index + 1
|
|
if item == nil then
|
|
item = ChildHandbookSuitRewardItem.New(self.Content_item)
|
|
self.reward_item_list[k] = item
|
|
end
|
|
--local data = self.model:GetConfigChildSkillInfo(v.skill_id,v.skill_lv)
|
|
self.reward_item_list[k]:SetData(v, index == max_count)
|
|
end
|
|
self:UpDateRedDot()
|
|
end
|
|
|
|
|
|
function ChildHandbookSuitRewardView:UpDateRedDot()
|
|
-- local red_dot_list = self.model:GetRedDotChildHandbook()
|
|
for k,v in pairs(self.reward_item_list) do
|
|
if v.data.status == 1 then
|
|
v:SetRedDot(true)
|
|
else
|
|
v:SetRedDot(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
function ChildHandbookSuitRewardView:SwitchTab( index )
|
|
|
|
end
|
|
|
|
function ChildHandbookSuitRewardView:DestroySuccess( )
|
|
if self.rank_view then
|
|
self.rank_view:DeleteMe()
|
|
self.rank_view = nil
|
|
end
|
|
if self.tabWindowComponent then
|
|
self.tabWindowComponent:DeleteMe()
|
|
self.tabWindowComponent = nil
|
|
end
|
|
|
|
for i, v in ipairs(self.reward_item_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.reward_item_list = {}
|
|
|
|
if self.updata_child_suit_reward_info then
|
|
self.model:UnBind(self.updata_child_suit_reward_info)
|
|
self.updata_child_suit_reward_info = nil
|
|
end
|
|
end
|