源战役客户端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

110 rader
3.3 KiB

--[[@------------------------------------------------------------------
@description:社团协助信息主界面tab
@author:huangcong
----------------------------------------------------------------------]]
GuildSupportInfoMainTab = GuildSupportInfoMainTab or BaseClass(BaseItem)
GuildSupportInfoMainTab.Height = 72
GuildSupportInfoMainTab.Width = 140
local GuildSupportInfoMainTab = GuildSupportInfoMainTab
function GuildSupportInfoMainTab:__init()
self.base_file = "guild"
self.layout_file = "GuildSupportInfoMainTab"
self.is_delay_callback = true
self.choose = false
self.need_red = false
self.choose_index = 1
self.model = GuildModel:getInstance()
self:Load()
end
function GuildSupportInfoMainTab:Load_callback()
self.nodes = {
"selct:obj:img","redDot:obj","bg:obj","tabName:tmp", "touch:obj", "tabChooseName:tmp",
}
self:GetChildren(self.nodes)
if self.need_refreshData then
self:SetData(self.data,self.index,self.choose_index)
self:SetRedDot(self.need_red)
end
self:InitEvent()
end
function GuildSupportInfoMainTab:InitEvent()
local function clickHandler(target)
if target == self.touch_obj then
if self.callback then
self.callback(self.index)
end
end
end
AddClickEvent(self.touch_obj , clickHandler,2)
local function updateThankDataInfo( )
if not self.is_loaded then
return
end
if self.index == GuildModel.SupportTab.Thank then
self:SetRedDot(self.model.support_red_list[GuildModel.SupportTab.Thank] or false)
end
end
self:BindEvent(self.model, GuildModel.UPDATE_SUPPORT_THANK_LIST, updateThankDataInfo)--刷新协助信息列表
local function updateGiftDataInfo( )
if not self.is_loaded then
return
end
if self.index == GuildModel.SupportTab.Gift then
self:SetRedDot(self.model.support_red_list[GuildModel.SupportTab.Gift] or false)
end
end
self:BindEvent(self.model, GuildModel.UPDATE_SUPPORT_GIFT_LIST, updateGiftDataInfo)--刷新协助信息列表
end
function GuildSupportInfoMainTab:__delete()
-- for k,v in pairs(self.item_list) do
-- UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, v)
-- end
-- self.item_list = {}
end
function GuildSupportInfoMainTab:SetData(data,index,choose_index)
self.data = data or self.data
self.index = index or self.index
self.choose_index = choose_index or self.choose_index
if self.is_loaded then
self.need_refreshData = false
else
self.need_refreshData = true
return
end
self.tabName_tmp.text = self.choose_index == self.index and "" or self.data.name
self.tabChooseName_tmp.text = self.choose_index == self.index and self.data.name or ""
self.selct_obj:SetActive(self.choose_index == self.index)
self:SetRedDot(self.need_red)
end
function GuildSupportInfoMainTab:SetSelect( index )
self.choose_index = index or self.choose_index
if self.is_loaded then
self.tabName_tmp.text = self.choose_index == self.index and "" or self.data.name
self.tabChooseName_tmp.text = self.choose_index == self.index and self.data.name or ""
self.selct_obj:SetActive(self.choose_index == self.index)
else
self.need_refreshData = true
end
end
function GuildSupportInfoMainTab:SetCallBack( callback )
self.callback = callback
end
function GuildSupportInfoMainTab:SetRedDot( bool )
self.need_red = bool
if self.is_loaded then
self.redDot_obj:SetActive(self.need_red)
else
self.need_refreshData = true
end
end