KLPlayVideoPanel.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ---@class KLPlayVideoPanel:UIKmlLuaPanelBase
  2. ---@field view KLPlayVideoPanelView
  3. local KLPlayVideoPanel = class(UIKmlLuaPanelBase)
  4. local this = KLPlayVideoPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. end
  10. ---注册UI事件和服务器消息
  11. function this:RegistEvents()
  12. GUI:AddOnClickEvent(self.view.Close, self, self.CloseOnClick)
  13. GUI:AddOnClickEvent(self.view.btn_open, self, self.btn_openOnClick)
  14. end
  15. function this:CloseOnClick()
  16. GUI:UIPanel_Close("dev/outui/Recharge/Panel/KLPlayVideo/KLPlayVideoPanel")
  17. end
  18. function this:btn_openOnClick()
  19. GUI:PlayVideo(self.videoKml)
  20. GUI:SetActive(self.view.btn_open,false)
  21. self.Timer = SL:Schedule(self.Timer, 1, 1, -1, function()
  22. if not GUI:IsVideoPlaying(self.videoKml) then
  23. GUI:SetActive(self.view.btn_open,true)
  24. return
  25. end
  26. end)
  27. end
  28. ---界面显示时调用一次
  29. function this:Show()
  30. if self.args and self.args.path then
  31. self.videoKml = GUI:UIVideo_Create(self.view.VideoPlayer,{})
  32. GUI:SetVideo( self.videoKml, self.args.path, 838, 446, "0", "0")
  33. GUI:SetImageNativeSize(self.videoKml)
  34. GUI:StopVideo(self.videoKml)
  35. end
  36. end
  37. ---创建或者刷新界面数据时调用
  38. function this:Refresh()
  39. end
  40. function this:Close()
  41. if self.Timer then
  42. SL:UnSchedule(self.Timer)
  43. end
  44. self.Timer= nil
  45. end
  46. return this