UIStoryPlayVideoView.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. local UIStoryPlayVideoView = require("UIStory/UIStoryPlayVideoView_Generate")
  2. function UIStoryPlayVideoView:OnAwake(data)
  3. self.controller = require("UIStory/UIStoryPlayVideoCtr"):new()
  4. self.controller:Init(self)
  5. self.controller:SetData(data)
  6. end
  7. function UIStoryPlayVideoView:AddEventListener()
  8. end
  9. function UIStoryPlayVideoView: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 UIStoryPlayVideoView:Init()
  20. self.videoPlayer.uIPlayVideo:BindLuaCallBack(self, self.PlayComplete)
  21. self.videoPlayer.uIPlayVideo:Play(UnityEngine.Application.streamingAssetsPath .. '/' .. self.controller:GetVideoPath())
  22. end
  23. function UIStoryPlayVideoView:RemoveEventListener()
  24. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  25. end
  26. function UIStoryPlayVideoView:AddUIEventListener()
  27. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
  28. end
  29. function UIStoryPlayVideoView:OnHide()
  30. end
  31. function UIStoryPlayVideoView:OnShow(data)
  32. self.controller:SetData(data)
  33. end
  34. function UIStoryPlayVideoView:OnClose()
  35. end
  36. function UIStoryPlayVideoView:OnDispose()
  37. self.videoPlayer.uIPlayVideo:BindLuaCallBack(nil, nil)
  38. self.controller:OnDispose()
  39. end
  40. function UIStoryPlayVideoView:PlayComplete(errorCode)
  41. self:UIClose()
  42. end
  43. return UIStoryPlayVideoView