GuildCollectHelpRankItem = GuildCollectHelpRankItem or BaseClass(BaseItem) local GuildCollectHelpRankItem = GuildCollectHelpRankItem GuildCollectHelpRankItem.Width = 386 GuildCollectHelpRankItem.Height = 29 function GuildCollectHelpRankItem:__init() self.base_file = "boss" self.layout_file = "BossWorldSceneRankItem" self.model = GuildModel:getInstance() self.enemy_list = {} self.show_data = false self.show_time = 0--显示的时间 self:Load() end function GuildCollectHelpRankItem:Load_callback() self.nodes = { "img_rank:img:obj","lb_rank:txt","lb_name:txt","lb_att:txt", } self:GetChildren(self.nodes) self:AddEvents() if self.need_refreshData then self:UpdateView() end end function GuildCollectHelpRankItem:AddEvents( ) end function GuildCollectHelpRankItem:GetShortNameStr( str ) str = str or "" if SubStringGetTotalIndex(str) > 4 then return SubStringUTF8(str, 1, 4) .. "..." else return str end end function GuildCollectHelpRankItem:GetHurtNumStr( num ) num = num or 0 if num >= 0 and num <= 99999 then return num elseif num >= 100000 and num <= 99999999 then return string.format("%.1f万", num / 10000) elseif num >= 100000000 and num <= 99999999999 then return string.format("%.2f亿", num / 100000000) elseif num >= 100000000000 and num <= 999999999999 then return string.format("%.2f千亿", num / 100000000000) elseif num >= 1000000000000 and num <= 9999999999999 then return string.format("%.1f千亿", num / 100000000000) end return string.format("%.1f千亿", num / 100000000000) end function GuildCollectHelpRankItem:UpdateView( ) if not self.data then return end if self.data.role_id <= 2147483647 then self.lb_name_txt.text = self:GetShortNameStr(string.format( "%s队", self.data.name )) else self.lb_name_txt.text = self:GetShortNameStr(self.data.name) end ------------------------- -- local boss_id = self.model:GetCurFightBossId() -- if not boss_id then return end -- local boss_type = self.model:GetBossTypeByBossId( boss_id ) ------------------------- -- local boss_max_hp = boss_type and self.model:GetSceneBossHp(boss_type) or 0 -- if boss_max_hp == 0 then -- self.lb_att_txt.text = "获取中" -- else self.lb_att_txt.text = self:GetHurtNumStr(self.data.hurt)--string.format("%0.2f%%",self.data.hurt / boss_max_hp * 100) -- end self.img_rank_obj:SetActive(self.index <= 3) if self.index <= 3 then self.lb_rank_txt.text = "" lua_resM:setImageSprite(self, self.img_rank_img, "common_asset", "com_rank_3_" .. self.index,true) else self.lb_rank_txt.text = self.index end end function GuildCollectHelpRankItem:SetData( index, data ) self.index = index self.data = data if self.is_loaded then self.need_refreshData = false self:UpdateView() else self.need_refreshData = true end end function GuildCollectHelpRankItem:__delete( ) end