源战役客户端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

98 行
2.8 KiB

  1. GuildCollectHelpRankItem = GuildCollectHelpRankItem or BaseClass(BaseItem)
  2. local GuildCollectHelpRankItem = GuildCollectHelpRankItem
  3. GuildCollectHelpRankItem.Width = 386
  4. GuildCollectHelpRankItem.Height = 29
  5. function GuildCollectHelpRankItem:__init()
  6. self.base_file = "boss"
  7. self.layout_file = "BossWorldSceneRankItem"
  8. self.model = GuildModel:getInstance()
  9. self.enemy_list = {}
  10. self.show_data = false
  11. self.show_time = 0--显示的时间
  12. self:Load()
  13. end
  14. function GuildCollectHelpRankItem:Load_callback()
  15. self.nodes = {
  16. "img_rank:img:obj","lb_rank:txt","lb_name:txt","lb_att:txt",
  17. }
  18. self:GetChildren(self.nodes)
  19. self:AddEvents()
  20. if self.need_refreshData then
  21. self:UpdateView()
  22. end
  23. end
  24. function GuildCollectHelpRankItem:AddEvents( )
  25. end
  26. function GuildCollectHelpRankItem:GetShortNameStr( str )
  27. str = str or ""
  28. if SubStringGetTotalIndex(str) > 4 then
  29. return SubStringUTF8(str, 1, 4) .. "..."
  30. else
  31. return str
  32. end
  33. end
  34. function GuildCollectHelpRankItem:GetHurtNumStr( num )
  35. num = num or 0
  36. if num >= 0 and num <= 99999 then
  37. return num
  38. elseif num >= 100000 and num <= 99999999 then
  39. return string.format("%.1f万", num / 10000)
  40. elseif num >= 100000000 and num <= 99999999999 then
  41. return string.format("%.2f亿", num / 100000000)
  42. elseif num >= 100000000000 and num <= 999999999999 then
  43. return string.format("%.2f千亿", num / 100000000000)
  44. elseif num >= 1000000000000 and num <= 9999999999999 then
  45. return string.format("%.1f千亿", num / 100000000000)
  46. end
  47. return string.format("%.1f千亿", num / 100000000000)
  48. end
  49. function GuildCollectHelpRankItem:UpdateView( )
  50. if not self.data then return end
  51. if self.data.role_id <= 2147483647 then
  52. self.lb_name_txt.text = self:GetShortNameStr(string.format( "%s队", self.data.name ))
  53. else
  54. self.lb_name_txt.text = self:GetShortNameStr(self.data.name)
  55. end
  56. -------------------------
  57. -- local boss_id = self.model:GetCurFightBossId()
  58. -- if not boss_id then return end
  59. -- local boss_type = self.model:GetBossTypeByBossId( boss_id )
  60. -------------------------
  61. -- local boss_max_hp = boss_type and self.model:GetSceneBossHp(boss_type) or 0
  62. -- if boss_max_hp == 0 then
  63. -- self.lb_att_txt.text = "获取中"
  64. -- else
  65. self.lb_att_txt.text = self:GetHurtNumStr(self.data.hurt)--string.format("%0.2f%%",self.data.hurt / boss_max_hp * 100)
  66. -- end
  67. self.img_rank_obj:SetActive(self.index <= 3)
  68. if self.index <= 3 then
  69. self.lb_rank_txt.text = ""
  70. lua_resM:setImageSprite(self, self.img_rank_img, "common_asset", "com_rank_3_" .. self.index,true)
  71. else
  72. self.lb_rank_txt.text = self.index
  73. end
  74. end
  75. function GuildCollectHelpRankItem:SetData( index, data )
  76. self.index = index
  77. self.data = data
  78. if self.is_loaded then
  79. self.need_refreshData = false
  80. self:UpdateView()
  81. else
  82. self.need_refreshData = true
  83. end
  84. end
  85. function GuildCollectHelpRankItem:__delete( )
  86. end