源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

94 行
2.6 KiB

--[[@------------------------------------------------------------------
@description:登录公告
@author:wyb
----------------------------------------------------------------------]]
FuliNoticeTab = FuliNoticeTab or BaseClass(BaseItem)
function FuliNoticeTab:__init()
self.base_file = "Fuli"
self.layout_file = "FuliNoticeTab"
self.is_delay_callback = true
self:Load()
end
function FuliNoticeTab:Load_callback()
self.imSelect = self:GetChild("imSelect").gameObject
self.txtName = self:GetChild("txtName"):GetComponent("TextMeshProUGUI")
self.type_image_img = self:GetChild("type_image"):GetComponent("Image")
self.click_con_obj = self:GetChild("click_con").gameObject
self.redDot = self:GetChild("redDot").gameObject
if self.need_refreshData then
self:SetData(self.data, self.index)
end
self:InitEvent()
end
function FuliNoticeTab:InitEvent()
local function onBtnClickHandler(target)
if target == self.click_con_obj then
if self.callback and self.data then
self.callback(self.index)
end
end
end
AddClickEvent(self.click_con_obj, onBtnClickHandler)
end
function FuliNoticeTab:SetData(data, index)
self.data = data
self.index = index
if not self.is_loaded then
self.need_refreshData = true
return
end
self.need_refreshData = false
-- self.type_text_txt.text = "活动"
-- self.type_text_txt.color = ColorUtil:ConvertHexToRGBColor("ffdff5")
-- if tonumber(data.tag) == 1 then
-- lua_resM:setImageSprite(self,self.type_image_img, "account_asset", "account_notice_type1")
-- self.type_text_txt.text = "系统"
-- self.type_text_txt.color = ColorUtil:ConvertHexToRGBColor("79fffd")
-- end
self.txtName.text = data.tiltle
if self.isSelect ~= nil then
self:SetSelectState(self.isSelect)
end
if self.isShowRed ~= nil then
self:ShowRedDot(self.isShowRed)
end
end
function FuliNoticeTab:SetCallBack(callback)
self.callback = callback
end
function FuliNoticeTab:SetSelectState(isShow)
if self.is_loaded then
self.imSelect:SetActive(isShow)
-- local color = isShow and Color(64/255, 70/255, 90/255, 1) or Color(140/255, 149/255, 172/255, 1)
local color = isShow and ColorUtil:ConvertHexToRGBColor("FFFFFF") or ColorUtil:ConvertHexToRGBColor("7D91AC")
self.txtName.color = color
if isShow then
SetTMPSharedMaterial(self.txtName, ShaderTools.TMPSharedMaterialType.FZZZOutlineBlueTab)
else
SetTMPSharedMaterial(self.txtName, ShaderTools.TMPSharedMaterialType.FZZZDefault)
end
self.isSelect = nil
else
self.isSelect = isShow
end
end
function FuliNoticeTab:ShowRedDot(bool)
if self.is_loaded then
self.redDot:SetActive(bool)
self,isShowRed = nil
else
self.isShowRed = bool
end
end