UIDojoBuyTimesCtr.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. local UIDojoBuyTimesCtr = class("UIDojoBuyTimesCtr", require("UICtrBase"))
  2. function UIDojoBuyTimesCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIDojoBuyTimesCtr:SetData(data)
  6. self.asyncIdx = 0
  7. if data == nil then return end
  8. self.data = data
  9. end
  10. function UIDojoBuyTimesCtr:GetAsyncIdx()
  11. self.asyncIdx = self.asyncIdx + 1
  12. return self.asyncIdx
  13. end
  14. function UIDojoBuyTimesCtr:GetData()
  15. return self.data
  16. end
  17. function UIDojoBuyTimesCtr:OnDispose()
  18. self.data = nil
  19. self.view = nil
  20. end
  21. function UIDojoBuyTimesCtr:GetCostNum()
  22. if self.data then
  23. return self.data[1] or 0
  24. end
  25. return 0
  26. end
  27. function UIDojoBuyTimesCtr:GetRemainCount()
  28. if self.data then
  29. return self.data[2]
  30. end
  31. return nil
  32. end
  33. function UIDojoBuyTimesCtr:HandleCallback()
  34. if self.data then
  35. local cb = self.data[3]
  36. local ownerCb = self.data[4]
  37. local param = self.data[5]
  38. if cb then
  39. if ownerCb then
  40. cb(ownerCb,param)
  41. else
  42. cb(param)
  43. end
  44. end
  45. end
  46. end
  47. function UIDojoBuyTimesCtr:GetCostType()
  48. if self.data then
  49. return self.data[6]
  50. end
  51. return nil
  52. end
  53. return UIDojoBuyTimesCtr