CSMainExploitRankItem = CSMainExploitRankItem or BaseClass(BaseItem)
|
|
local CSMainExploitRankItem = CSMainExploitRankItem
|
|
|
|
function CSMainExploitRankItem:__init()
|
|
self.base_file = "csMain"
|
|
self.layout_file = "CSMainExploitRankItem"
|
|
self.model = CSMainModel:getInstance()
|
|
|
|
self:Load()
|
|
end
|
|
|
|
function CSMainExploitRankItem:Load_callback()
|
|
self.nodes = {
|
|
"sex:img", "rankIcon:img:obj", "vipCon",
|
|
"rank:tmp", "name:tmp", "guildName:tmp", "exploitNum:tmp", "militaryRank:img",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
|
|
self.vipItem = RoleVipItem.New(self.vipCon)
|
|
|
|
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
function CSMainExploitRankItem:AddEvents( )
|
|
|
|
end
|
|
|
|
function CSMainExploitRankItem:UpdateView( )
|
|
self.name_tmp.text = GetCSLongName(self.data.name,self.data.ser_num)
|
|
if self.data.gname and self.data.gname ~= "" then
|
|
self.guildName_tmp.text = self.data.gname
|
|
else
|
|
self.guildName_tmp.text = "暂无社团"
|
|
end
|
|
self.exploitNum_tmp.text = self.data.score
|
|
|
|
self.vipItem:SetData(self.data.vip_flag, self.data.sup_vip_type)
|
|
local sex_res = self.data.sex == 1 and "com_boy" or "com_girl"
|
|
lua_resM:setImageSprite(self, self.sex_img, "common_asset", sex_res, true)
|
|
SetAnchoredPositionX(self.sex, -288+self.name_tmp.preferredWidth+15)
|
|
|
|
lua_resM:setOutsideImageSprite(self, self.militaryRank_img, GameResPath.GetMilitaryImage("military_ranks_"..self.data.post), true)
|
|
|
|
if self.data.rank >= 1 and self.data.rank <= 5 then
|
|
self.rankIcon_obj:SetActive(true)
|
|
self.rank_tmp.text = ""
|
|
lua_resM:setImageSprite(self, self.rankIcon_img, "csMain_asset","cs_main_rank_"..self.data.rank,true)
|
|
else
|
|
self.rank_tmp.text = self.data.rank
|
|
self.rankIcon_obj:SetActive(false)
|
|
end
|
|
end
|
|
|
|
function CSMainExploitRankItem:SetData( data,index )
|
|
self.data = data
|
|
self.index = index
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
self:UpdateView()
|
|
else
|
|
self.need_refreshData = true
|
|
end
|
|
end
|
|
|
|
function CSMainExploitRankItem:__delete( )
|
|
if self.vipItem then
|
|
self.vipItem:DeleteMe()
|
|
self.vipItem = nil
|
|
end
|
|
end
|