UISimpleNoticeView.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. local UISimpleNoticeView = require("UICommonTips/UISimpleNoticeView_Generate")
  2. function UISimpleNoticeView:OnAwake(data)
  3. self.controller = require("UICommonTips/UISimpleNoticeCtr"):new()
  4. self.controller:Init(self)
  5. self.controller:SetData(data)
  6. end
  7. function UISimpleNoticeView:AddEventListener()
  8. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
  9. end
  10. function UISimpleNoticeView: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 UISimpleNoticeView:Init()
  21. local titleLangKey = self.controller:GetTitle()
  22. local contentLangKey = self.controller:GetContent()
  23. self.titleLab.text.text = titleLangKey and string.formatbykey(titleLangKey) or ''
  24. self.contentLab.text.text = contentLangKey and string.formatbykey(contentLangKey) or ''
  25. end
  26. function UISimpleNoticeView:RemoveEventListener()
  27. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  28. end
  29. function UISimpleNoticeView:AddUIEventListener()
  30. self.uiBase:AddButtonUniqueEventListener(self.AnyBtn.button, self, self.OnClickCloseBtn)
  31. self.uiBase:AddButtonUniqueEventListener(self.btnClose.button, self, self.OnClickCloseBtn)
  32. end
  33. function UISimpleNoticeView:OnHide()
  34. end
  35. function UISimpleNoticeView:OnShow(data)
  36. self.controller:SetData(data)
  37. end
  38. function UISimpleNoticeView:OnClose()
  39. end
  40. function UISimpleNoticeView:OnDispose()
  41. self.controller:OnDispose()
  42. end
  43. function UISimpleNoticeView:OnClickCloseBtn()
  44. self:UIClose()
  45. end
  46. return UISimpleNoticeView