-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 跨服社团排行玩法奖励预览界面
|
|
-- *>
|
|
GuildCSGRRewardView = GuildCSGRRewardView or BaseClass(BaseView)
|
|
local GuildCSGRRewardView = GuildCSGRRewardView
|
|
|
|
function GuildCSGRRewardView:__init()
|
|
self.base_file = "guildCSGR"
|
|
self.layout_file = "GuildCSGRRewardView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true --全屏界面默认使用这个参数,非全屏界面自行设置
|
|
self.change_scene_close = true --是否切换场景时关闭(弹出界面使用)
|
|
self.tab_list = {
|
|
{id = 1, name = "1号战场"},
|
|
{id = 2, name = "其他战场"},
|
|
{id = 3, name = "个人排行"},
|
|
}
|
|
self.tab_index = 1 -- 当前页签
|
|
self.model = GuildModel:getInstance()
|
|
-- 获取奖励配置
|
|
self.guild_reward_list, self.guild_normal_reward_list, self.role_reward_list = self.model:GetCSGRRankRewardCfg()
|
|
self.reward_data = {
|
|
[1] = self.guild_reward_list,
|
|
[2] = self.guild_normal_reward_list,
|
|
[3] = self.role_reward_list,
|
|
}
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:SwitchTab(self.tab_index)
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function GuildCSGRRewardView:Open( )
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GuildCSGRRewardView:LoadSuccess()
|
|
local nodes = {
|
|
"content",
|
|
"content/item_scroll",
|
|
"content/item_scroll/Viewport/item_con",
|
|
"content/tips:tmp",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
local function close_callback()
|
|
self:Close()
|
|
end
|
|
local function select_callback(index)
|
|
self:SwitchTab(index)
|
|
end
|
|
self.tabWindowComponent = UITabWindow.New(self.transform, self.tab_list, select_callback, close_callback, self.background_wnd, self.content, UITabWindow.SizeSmall, nil, nil, false)
|
|
self.tabWindowComponent:SetTitleText("奖励预览")
|
|
self.tabWindowComponent:SetBackgroundRes("rw_raward_bg")
|
|
|
|
self.tips_tmp.text = "奖励根据战场中<color=#fdffc2>对图腾造成的伤害</color>排名发放"
|
|
end
|
|
|
|
function GuildCSGRRewardView:AddEvent()
|
|
|
|
end
|
|
|
|
function GuildCSGRRewardView:UpdateView()
|
|
self.reward_item_creator = self.reward_item_creator or self:AddUIComponent(UI.ItemListCreator)
|
|
local info = {
|
|
data_list = self.reward_data[self.tab_index],
|
|
item_con = self.item_con,
|
|
scroll_view = self.item_scroll,
|
|
item_class = GuildCSGRRewardItem,
|
|
item_height = 89,
|
|
create_frequency = 0.01,
|
|
is_scroll_back_on_update = true,
|
|
alignment = UnityEngine.TextAnchor.UpperLeft,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(v, self.tab_index)
|
|
end,
|
|
}
|
|
self.reward_item_creator:UpdateItems(info)
|
|
end
|
|
|
|
function GuildCSGRRewardView:SwitchTab(index)
|
|
self.tab_index = index
|
|
if self.tabWindowComponent then
|
|
self.tabWindowComponent:SetTabBarIndex(self.tab_index)
|
|
end
|
|
self:UpdateView()
|
|
end
|
|
|
|
function GuildCSGRRewardView:DestroySuccess( )
|
|
if self.tabWindowComponent then
|
|
self.tabWindowComponent:DeleteMe()
|
|
self.tabWindowComponent = nil
|
|
end
|
|
end
|