源战役客户端
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.

91 line
2.9 KiB

  1. -- <*
  2. -- @Author: Saber
  3. -- @Description: 社团列表社团排行节点
  4. -- *>
  5. GuildListGuildItem = GuildListGuildItem or BaseClass(BaseItem)
  6. local GuildListGuildItem = GuildListGuildItem
  7. function GuildListGuildItem:__init(parent_wnd,prefab_asset,layer_name)
  8. self.base_file = "guild"
  9. self.layout_file = "GuildListGuildItem"
  10. self.parent_wnd = parent_wnd
  11. self.layer_name = layer_name
  12. self.model = GuildModel:getInstance()
  13. self:Load()
  14. end
  15. function GuildListGuildItem:Load_callback()
  16. local nodes = {
  17. "rank_icon:img",
  18. "info_con/vip_con", "info_con/sex_flag:img", "info_con/name:tmp",
  19. "power_val:txt",
  20. "guild_num:tmp",
  21. "guild_lv:tmp",
  22. "guild_name:tmp",
  23. "rank:tmp",
  24. }
  25. self:GetChildren(nodes)
  26. -- 加载vip节点
  27. self.vipItem = RoleVipItem.New(self.vip_con)
  28. self.vipItem:SetAnchoredPosition(0, 0)
  29. self:AddEvents()
  30. if self.need_refreshData then
  31. self:UpdateView()
  32. end
  33. end
  34. function GuildListGuildItem:AddEvents( )
  35. end
  36. function GuildListGuildItem:SetData( data, index )
  37. self.data = data
  38. self.index = index
  39. if self.is_loaded then
  40. self.need_refreshData = false
  41. self:UpdateView()
  42. else
  43. self.need_refreshData = true
  44. end
  45. end
  46. function GuildListGuildItem:UpdateView( )
  47. -- 加载徽章
  48. -- local icon_name = "guild_badge_1001"
  49. -- if self.index >= 1 and self.index <= 5 then
  50. -- icon_name = "guild_badge_1003"
  51. -- elseif self.index > 5 and self.index <= 10 then
  52. -- icon_name = "guild_badge_1002"
  53. -- end
  54. -- lua_resM:setImageSprite(self, self.rank_icon_img, "guildBadge_asset", icon_name, true)
  55. -- 加载排名
  56. if self.index >= 1 and self.index <= 3 then
  57. self.rank_icon_img.enabled = true
  58. lua_resM:setImageSprite(self, self.rank_icon_img, "guild_asset", "guild_rank_" .. self.index, true)
  59. self.rank_tmp.text = ""
  60. else
  61. self.rank_icon_img.enabled = false
  62. self.rank_tmp.text = self.index
  63. end
  64. self.vipItem:SetData(self.data.vip_flag,self.data.sup_vip_type)
  65. lua_resM:setImageSprite(self, self.sex_flag_img, "common_asset", self.data.sex == 1 and "com_boy" or "com_girl", true)
  66. SetAnchoredPositionX(self.name, self.data.vip_flag == 0 and 5 or 46)
  67. self.name_tmp.text = self.data.name
  68. local sex_pos_x = (self.data.vip_flag == 0 and 10 or 51) + self.name_tmp.preferredWidth
  69. SetAnchoredPositionX(self.sex_flag, sex_pos_x)
  70. self.guild_name_tmp.text = self.data.guild_name
  71. self.guild_lv_tmp.text = self.data.guild_lv
  72. local guild_lv_cfg = Config.Guildlv[self.data.guild_lv]
  73. self.guild_num_tmp.text = self.data.members_num .. "/" .. (guild_lv_cfg.member_capacity + self.data.add_mem_num)
  74. self.power_val_txt.text = self.data.first_value
  75. end
  76. function GuildListGuildItem:__delete( )
  77. if self.vipItem then
  78. self.vipItem:DeleteMe()
  79. self.vipItem = nil
  80. end
  81. end