UIBattleReplayCtr.lua 987 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. local UIBattleReplayCtr = class("UIBattleReplayCtr", require("UICtrBase"))
  2. function UIBattleReplayCtr:Init(view)
  3. self.view = view
  4. self.latestData = nil
  5. self.lowestData = nil
  6. end
  7. -- RecordIdx=1表示最近通关 =2表示最低战力通关
  8. function UIBattleReplayCtr:SetData(data)
  9. self.asyncIdx = 0
  10. if data == nil then return end
  11. self.data = data
  12. if self.data ~= nil then
  13. for i=1, #self.data do
  14. if self.data[i].record_idx == 1 then
  15. self.latestData = self.data[i]
  16. elseif self.data[i].record_idx == 2 then
  17. self.lowestData = self.data[i]
  18. end
  19. end
  20. end
  21. end
  22. function UIBattleReplayCtr:LatestData()
  23. return self.latestData
  24. end
  25. function UIBattleReplayCtr:LowestData()
  26. return self.lowestData
  27. end
  28. function UIBattleReplayCtr:GetAsyncIdx()
  29. self.asyncIdx = self.asyncIdx + 1
  30. return self.asyncIdx
  31. end
  32. function UIBattleReplayCtr:GetData()
  33. return self.data
  34. end
  35. function UIBattleReplayCtr:OnDispose()
  36. self.data = nil
  37. self.view = nil
  38. end
  39. return UIBattleReplayCtr