-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 社团列表社团排行节点
|
|
-- *>
|
|
GuildListGuildItem = GuildListGuildItem or BaseClass(BaseItem)
|
|
local GuildListGuildItem = GuildListGuildItem
|
|
|
|
function GuildListGuildItem:__init(parent_wnd,prefab_asset,layer_name)
|
|
self.base_file = "guild"
|
|
self.layout_file = "GuildListGuildItem"
|
|
self.parent_wnd = parent_wnd
|
|
self.layer_name = layer_name
|
|
|
|
self.model = GuildModel:getInstance()
|
|
self:Load()
|
|
end
|
|
|
|
function GuildListGuildItem:Load_callback()
|
|
local nodes = {
|
|
"rank_icon:img",
|
|
"info_con/vip_con", "info_con/sex_flag:img", "info_con/name:tmp",
|
|
"power_val:txt",
|
|
"guild_num:tmp",
|
|
"guild_lv:tmp",
|
|
"guild_name:tmp",
|
|
"rank:tmp",
|
|
}
|
|
self:GetChildren(nodes)
|
|
-- 加载vip节点
|
|
self.vipItem = RoleVipItem.New(self.vip_con)
|
|
self.vipItem:SetAnchoredPosition(0, 0)
|
|
self:AddEvents()
|
|
if self.need_refreshData then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
|
|
function GuildListGuildItem:AddEvents( )
|
|
|
|
end
|
|
|
|
function GuildListGuildItem: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 GuildListGuildItem:UpdateView( )
|
|
-- 加载徽章
|
|
-- local icon_name = "guild_badge_1001"
|
|
-- if self.index >= 1 and self.index <= 5 then
|
|
-- icon_name = "guild_badge_1003"
|
|
-- elseif self.index > 5 and self.index <= 10 then
|
|
-- icon_name = "guild_badge_1002"
|
|
-- end
|
|
-- lua_resM:setImageSprite(self, self.rank_icon_img, "guildBadge_asset", icon_name, true)
|
|
-- 加载排名
|
|
if self.index >= 1 and self.index <= 3 then
|
|
self.rank_icon_img.enabled = true
|
|
lua_resM:setImageSprite(self, self.rank_icon_img, "guild_asset", "guild_rank_" .. self.index, true)
|
|
self.rank_tmp.text = ""
|
|
else
|
|
self.rank_icon_img.enabled = false
|
|
self.rank_tmp.text = self.index
|
|
end
|
|
self.vipItem:SetData(self.data.vip_flag,self.data.sup_vip_type)
|
|
|
|
lua_resM:setImageSprite(self, self.sex_flag_img, "common_asset", self.data.sex == 1 and "com_boy" or "com_girl", true)
|
|
SetAnchoredPositionX(self.name, self.data.vip_flag == 0 and 5 or 46)
|
|
self.name_tmp.text = self.data.name
|
|
local sex_pos_x = (self.data.vip_flag == 0 and 10 or 51) + self.name_tmp.preferredWidth
|
|
SetAnchoredPositionX(self.sex_flag, sex_pos_x)
|
|
|
|
self.guild_name_tmp.text = self.data.guild_name
|
|
self.guild_lv_tmp.text = self.data.guild_lv
|
|
local guild_lv_cfg = Config.Guildlv[self.data.guild_lv]
|
|
self.guild_num_tmp.text = self.data.members_num .. "/" .. (guild_lv_cfg.member_capacity + self.data.add_mem_num)
|
|
self.power_val_txt.text = self.data.first_value
|
|
end
|
|
|
|
function GuildListGuildItem:__delete( )
|
|
if self.vipItem then
|
|
self.vipItem:DeleteMe()
|
|
self.vipItem = nil
|
|
end
|
|
end
|