UIActivationCodeView.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. local UIActivationCodeView = require("UIActivationCode/UIActivationCodeView_Generate")
  2. function UIActivationCodeView:OnAwake(data)
  3. self.controller = require("UIActivationCode/UIActivationCodeCtr"):new()
  4. self.controller:Init(self)
  5. self.controller:SetData(data)
  6. end
  7. function UIActivationCodeView:AddEventListener()
  8. end
  9. function UIActivationCodeView:FillContent(data, uiBase)
  10. self.uiBase = uiBase
  11. local gameObject = self.uiBase:GetRoot()
  12. if gameObject ~= nil then
  13. self.gameObject = gameObject
  14. self.transform = gameObject.transform
  15. end
  16. self:InitGenerate(self.transform, data)
  17. self:Init()
  18. end
  19. function UIActivationCodeView:Init()
  20. end
  21. function UIActivationCodeView:RemoveEventListener()
  22. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  23. end
  24. function UIActivationCodeView:AddUIEventListener()
  25. self.uiBase:AddButtonEventListener(self.okBtn.button,self, self.OnClickOkBtn)
  26. self.uiBase:AddButtonEventListener(self.AnyBtn.button,self, self.OnClickCancelBtn)
  27. end
  28. function UIActivationCodeView:OnClickCancelBtn()
  29. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_CLOSED_ACTIVATIONCODE)
  30. ManagerContainer.LuaUIMgr:ClosePage(Enum.UIPageName.UIActivationCodePage)
  31. end
  32. function UIActivationCodeView:OnClickOkBtn()
  33. local codeTxt = self.codeInput.inputField.text
  34. if codeTxt == nil or codeTxt == "" then
  35. ManagerContainer.LuaUIMgr:ErrorNoticeDisplay("请输入正确的冒险码!")
  36. return
  37. end
  38. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_USED_ACTIVATIONCODE,codeTxt)
  39. ManagerContainer.LuaUIMgr:ClosePage(Enum.UIPageName.UIActivationCodePage)
  40. end
  41. function UIActivationCodeView:OnHide()
  42. end
  43. function UIActivationCodeView:OnShow(data)
  44. self.controller:SetData(data)
  45. self:Init()
  46. end
  47. function UIActivationCodeView:OnClose()
  48. end
  49. function UIActivationCodeView:OnDispose()
  50. end
  51. return UIActivationCodeView