UIGuildDemonRewardCtr.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. local UIGuildDemonRewardCtr = class("UIGuildDemonRewardCtr", require("UICtrBase"))
  2. function UIGuildDemonRewardCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIGuildDemonRewardCtr:SetData(data)
  6. self.asyncIdx = 0
  7. if data == nil then return end
  8. self.data = data
  9. end
  10. function UIGuildDemonRewardCtr:GetAsyncIdx()
  11. self.asyncIdx = self.asyncIdx + 1
  12. return self.asyncIdx
  13. end
  14. function UIGuildDemonRewardCtr:GetData()
  15. return self.data
  16. end
  17. function UIGuildDemonRewardCtr:GetShowId()
  18. return self.data and self.data.showId or 0
  19. end
  20. function UIGuildDemonRewardCtr:GetShowData()
  21. if not self.data then
  22. return nil
  23. end
  24. local demonData = ManagerContainer.CfgMgr:GetGuildDemonCfgCfgById(self.data.BossId)
  25. if not demonData then
  26. return {}
  27. end
  28. local awards = {}
  29. for i = #demonData.DamageReward, 1, -1 do
  30. local reviewAwards = {}
  31. local award = demonData.ReviewAwards[i]
  32. if type(award) == "number" then
  33. table.insert(reviewAwards,award)
  34. else
  35. if award and #award > 0 then
  36. for i = 1, #award do
  37. table.insert(reviewAwards,award[i])
  38. end
  39. end
  40. end
  41. table.insert(awards,{rewardItemId = demonData.DamageReward[i][1],reviewAwards = reviewAwards})
  42. end
  43. return awards
  44. end
  45. function UIGuildDemonRewardCtr:OnDispose()
  46. self.data = nil
  47. self.view = nil
  48. end
  49. return UIGuildDemonRewardCtr