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

  1. -- <*
  2. -- @Author: Saber
  3. -- @Description: 社团boss排行item
  4. -- *>
  5. GuildEventBossRankItem = GuildEventBossRankItem or BaseClass(BaseItem)
  6. local GuildEventBossRankItem = GuildEventBossRankItem
  7. function GuildEventBossRankItem:__init(parent_wnd,prefab_asset,layer_name)
  8. self.base_file = "guild"
  9. self.layout_file = "GuildEventBossRankItem"
  10. self.parent_wnd = parent_wnd
  11. self.layer_name = layer_name
  12. self.model = GuildModel:getInstance()
  13. self:Load()
  14. end
  15. function GuildEventBossRankItem:Load_callback()
  16. self.nodes = {
  17. "name:tmp", "val:tmp","txt_rank:tmp", "img_rank:obj:img", "no_rank:tmp",
  18. }
  19. self:GetChildren(self.nodes)
  20. self:AddEvents()
  21. if self.need_refreshData then
  22. self:UpdateView()
  23. end
  24. end
  25. function GuildEventBossRankItem:AddEvents( )
  26. end
  27. function GuildEventBossRankItem:UpdateView( )
  28. if not self.data.rank or self.data.rank <= 0 then
  29. self.img_rank_obj:SetActive(false)
  30. self.txt_rank_tmp.text = ""
  31. self.no_rank_tmp.text = ""
  32. elseif self.data.rank <= 3 then
  33. self.img_rank_obj:SetActive(true)
  34. self.txt_rank_tmp.text = ""
  35. self.no_rank_tmp.text = ""
  36. lua_resM:setImageSprite(self, self.img_rank_img, "guild_asset", "guild_event_rank" .. self.data.rank .. "_pointfilter", true)
  37. else
  38. self.no_rank_tmp.text = ""
  39. self.img_rank_obj:SetActive(false)
  40. self.txt_rank_tmp.text = self.data.rank
  41. end
  42. self.val_tmp.text = self.data.hurt >0 and CalUnitNum(self.data.hurt) or "暂无"
  43. local nameStr = self.data.name or self.data.gname
  44. if utf8len(nameStr) > 5 then
  45. nameStr = SubStringUTF8(nameStr, 1, 4) .. "..."
  46. end
  47. self.name_tmp.text = nameStr
  48. if self.is_my_rank then
  49. self.name_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
  50. self.val_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
  51. self.txt_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
  52. self.no_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("2cf86f")
  53. else
  54. self.name_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
  55. self.val_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
  56. self.txt_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
  57. self.no_rank_tmp.color = ColorUtil:ConvertHexToRGBColor("ffffff")
  58. end
  59. if not self.show_line then
  60. -- self.line_obj:SetActive(false)
  61. end
  62. end
  63. function GuildEventBossRankItem:SetData(data, show_line,is_my_rank)
  64. self.data = data
  65. self.show_line = show_line or false
  66. self.is_my_rank = is_my_rank or false
  67. if self.is_loaded then
  68. self.need_refreshData = false
  69. self:UpdateView()
  70. else
  71. self.need_refreshData = true
  72. end
  73. end
  74. function GuildEventBossRankItem:__delete( )
  75. end