UITipsExchangeCtr.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. local UITipsExchangeCtr = class("UITipsExchangeCtr", require("UICtrBase"))
  2. function UITipsExchangeCtr:Init(view)
  3. self.view = view
  4. end
  5. function UITipsExchangeCtr:SetData(data)
  6. self.asyncIdx = 0
  7. if data == nil then return end
  8. self.data = data
  9. self.selectedCount = 1
  10. end
  11. function UITipsExchangeCtr:GetAsyncIdx()
  12. self.asyncIdx = self.asyncIdx + 1
  13. return self.asyncIdx
  14. end
  15. function UITipsExchangeCtr:GetData()
  16. return self.data
  17. end
  18. function UITipsExchangeCtr:GetCfgId()
  19. return self.data.cfgId
  20. end
  21. function UITipsExchangeCtr:GetCfgCount()
  22. return self.data.count or 0
  23. end
  24. function UITipsExchangeCtr:GetisExchangeRadioDesc()
  25. return self.data.desc or ""
  26. end
  27. function UITipsExchangeCtr:GetisExchangeDesc()
  28. return self.data.desc
  29. end
  30. function UITipsExchangeCtr:GetisExchangeItem()
  31. return self.data.isExchangeItem or false
  32. end
  33. function UITipsExchangeCtr:GetRadio()
  34. return self.data.radio or 1
  35. end
  36. function UITipsExchangeCtr:GetTargetCfgId()
  37. return self.data.targetCfgId or 0
  38. end
  39. function UITipsExchangeCtr:GetisSetColor()
  40. return self.data.isSetColor or false
  41. end
  42. function UITipsExchangeCtr:GetEnterType()
  43. return self.data.EnterType or 0
  44. end
  45. function UITipsExchangeCtr:GetMaxExchangeCount()
  46. return self.data.maxExchangeCount
  47. end
  48. function UITipsExchangeCtr:RefreshSelectedCount(offset)
  49. self.selectedCount = self.selectedCount + offset
  50. self.selectedCount = Mathf.Clamp(self.selectedCount, 1, self.data.maxExchangeCount)
  51. end
  52. function UITipsExchangeCtr:SetSelectedCount(count)
  53. self.selectedCount = count
  54. self.selectedCount = Mathf.Clamp(self.selectedCount, 1, self.data.maxExchangeCount)
  55. end
  56. function UITipsExchangeCtr:GetSelectedCount()
  57. return self.selectedCount
  58. end
  59. function UITipsExchangeCtr:OnExchangeClick()
  60. if self.data.owner and self.data.ownerCB then
  61. self.data.ownerCB(self.data.owner, self.data.idx, self.selectedCount)
  62. end
  63. end
  64. function UITipsExchangeCtr:OnDispose()
  65. self.data = nil
  66. self.view = nil
  67. end
  68. return UITipsExchangeCtr