UISkillResetTipsCtr.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. local UISkillResetTipsCtr = class("UISkillResetTipsCtr", require("UICtrBase"))
  2. function UISkillResetTipsCtr:Init(view)
  3. self.view = view
  4. end
  5. ---@param data table|nil {[1] = {[1] = ownerCB, [2] = owner}, [2] = {[1] = ownerCB, [2] = owner}}
  6. function UISkillResetTipsCtr:SetData(data)
  7. self.asyncIdx = 0
  8. if data == nil then return end
  9. self.data = data
  10. end
  11. function UISkillResetTipsCtr:GetAsyncIdx()
  12. self.asyncIdx = self.asyncIdx + 1
  13. return self.asyncIdx
  14. end
  15. function UISkillResetTipsCtr:GetData()
  16. return self.data
  17. end
  18. function UISkillResetTipsCtr:OnDispose()
  19. self.data = nil
  20. self.view = nil
  21. self.costCfgId = nil
  22. self.constNum = nil
  23. end
  24. function UISkillResetTipsCtr:GetResetCost()
  25. return CommonUtil.GetResetSkillLvCost()
  26. end
  27. function UISkillResetTipsCtr:GetIsAdvance()
  28. return self.data and self.data[3] or false
  29. end
  30. function UISkillResetTipsCtr:GetOwnResCountByItemId(itemCfgId)
  31. return CommonUtil.GetOwnResCountByItemId(itemCfgId)
  32. end
  33. function UISkillResetTipsCtr:CancelCallback()
  34. if not self.data then return end
  35. local cancelBtn = self.data[2]
  36. if not cancelBtn then return end
  37. local ownerCB = cancelBtn[1]
  38. local owner = cancelBtn[2]
  39. if ownerCB then
  40. if owner then
  41. ownerCB(owner)
  42. else
  43. ownerCB()
  44. end
  45. end
  46. end
  47. function UISkillResetTipsCtr:ResetCallback(type)
  48. if not self.data then return end
  49. local resetBtn = self.data[1]
  50. if not resetBtn then return end
  51. local ownerCB = resetBtn[1]
  52. local owner = resetBtn[2]
  53. if ownerCB then
  54. if owner then
  55. ownerCB(owner,type)
  56. else
  57. ownerCB(type)
  58. end
  59. end
  60. end
  61. return UISkillResetTipsCtr