UINotifyTipsSimpleView.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. local UINotifyTipsSimpleView = require("UINotifyTips/UINotifyTipsSimpleView_Generate")
  2. function UINotifyTipsSimpleView:OnAwake(data)
  3. self.controller = require("UINotifyTips/UINotifyTipsSimpleCtr"):new()
  4. self.controller:Init(self)
  5. self.controller:SetData(data)
  6. end
  7. function UINotifyTipsSimpleView:AddEventListener()
  8. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
  9. end
  10. function UINotifyTipsSimpleView:FillContent(data, uiBase)
  11. self.uiBase = uiBase
  12. local gameObject = self.uiBase:GetRoot()
  13. if gameObject ~= nil then
  14. self.gameObject = gameObject
  15. self.transform = gameObject.transform
  16. end
  17. self:InitGenerate(self.transform, data)
  18. self:Init()
  19. end
  20. function UINotifyTipsSimpleView:Init(isRefresh)
  21. local title, content = self.controller:GetTitleAndContent()
  22. self.boardTitle.text.text = string.formatbykey(title)
  23. self.desTxt.text.text = content
  24. if not isRefresh then
  25. self.scrollView.scrollRect.enabled = false
  26. end
  27. end
  28. function UINotifyTipsSimpleView:RemoveEventListener()
  29. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  30. end
  31. function UINotifyTipsSimpleView:AddUIEventListener()
  32. self.uiBase:AddButtonUniqueEventListener(self.AnyBtn.button, self, self.OnClickCloseBtn)
  33. self.uiBase:AddButtonUniqueEventListener(self.BtnClose.button, self, self.OnClickCloseBtn)
  34. end
  35. function UINotifyTipsSimpleView:OnHide()
  36. end
  37. function UINotifyTipsSimpleView:OnShow(data)
  38. if self.controller:SetData(data) then
  39. self:Init(true)
  40. end
  41. end
  42. function UINotifyTipsSimpleView:OnClose()
  43. end
  44. function UINotifyTipsSimpleView:OnDispose()
  45. self.controller:OnDispose()
  46. end
  47. function UINotifyTipsSimpleView:OnPageInEnd()
  48. self.super.OnPageInEnd(self)
  49. self.scrollView.scrollRect.enabled = true
  50. end
  51. function UINotifyTipsSimpleView:OnClickCloseBtn()
  52. self:UIClose()
  53. end
  54. return UINotifyTipsSimpleView