源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

87 lines
2.8 KiB

-- <*
-- @Author: Saber
-- @Description: 社团boss排行item
-- *>
GuildEventBossRankItem = GuildEventBossRankItem or BaseClass(BaseItem)
local GuildEventBossRankItem = GuildEventBossRankItem
function GuildEventBossRankItem:__init(parent_wnd,prefab_asset,layer_name)
self.base_file = "guild"
self.layout_file = "GuildEventBossRankItem"
self.parent_wnd = parent_wnd
self.layer_name = layer_name
self.model = GuildModel:getInstance()
self:Load()
end
function GuildEventBossRankItem:Load_callback()
self.nodes = {
"name:tmp", "val:tmp","txt_rank:tmp", "img_rank:obj:img", "no_rank:tmp",
}
self:GetChildren(self.nodes)
self:AddEvents()
if self.need_refreshData then
self:UpdateView()
end
end
function GuildEventBossRankItem:AddEvents( )
end
function GuildEventBossRankItem:UpdateView( )
if not self.data.rank or self.data.rank <= 0 then
self.img_rank_obj:SetActive(false)
self.txt_rank_tmp.text = ""
self.no_rank_tmp.text = ""
elseif self.data.rank <= 3 then
self.img_rank_obj:SetActive(true)
self.txt_rank_tmp.text = ""
self.no_rank_tmp.text = ""
lua_resM:setImageSprite(self, self.img_rank_img, "guild_asset", "guild_event_rank" .. self.data.rank .. "_pointfilter", true)
else
self.no_rank_tmp.text = ""
self.img_rank_obj:SetActive(false)
self.txt_rank_tmp.text = self.data.rank
end
self.val_tmp.text = self.data.hurt >0 and CalUnitNum(self.data.hurt) or "暂无"
local nameStr = self.data.name or self.data.gname
if utf8len(nameStr) > 5 then
nameStr = SubStringUTF8(nameStr, 1, 4) .. "..."
end
self.name_tmp.text = nameStr
if self.is_my_rank then
self.name_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
self.val_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
self.txt_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
self.no_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
else
self.name_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
self.val_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
self.txt_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
self.no_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
end
if not self.show_line then
-- self.line_obj:SetActive(false)
end
end
function GuildEventBossRankItem:SetData(data, show_line,is_my_rank)
self.data = data
self.show_line = show_line or false
self.is_my_rank = is_my_rank or false
if self.is_loaded then
self.need_refreshData = false
self:UpdateView()
else
self.need_refreshData = true
end
end
function GuildEventBossRankItem:__delete( )
end