KLLockPanel.lua 884 B

12345678910111213141516171819202122232425262728293031323334353637
  1. ---@class KLLockPanel:UIKmlLuaPanelBase
  2. ---@field view KLLockPanelView
  3. local KLLockPanel = class(UIKmlLuaPanelBase)
  4. local this =KLLockPanel
  5. ---创建时调用一次
  6. function this:Init()
  7. end
  8. ---创建或者刷新界面数据时调用
  9. function this:Refresh()
  10. end
  11. ---注册UI事件和服务器消息
  12. function this:RegistEvents()
  13. GUI:SetSliderOnValueChange(self.view.Slider,self,self.SliderOnValueChange)
  14. GUI:AddOnTouchEvent(self.view.Slider,self,self.SliderOnEndDrag)
  15. end
  16. function this:SliderOnValueChange(control,_,data)
  17. local value = math.ceil(data[1])
  18. if value >= 100 then
  19. GUI:UIPanel_Close("dev/ui/Setting/Panel/KLLock/KLLockPanel")
  20. end
  21. end
  22. function this:SliderOnEndDrag(control,eventType, data)
  23. if eventType == EUIEventName.OnEndDrag then
  24. GUI:Slider_setPercent(self.view.Slider,0)
  25. end
  26. end
  27. function this:Close()
  28. end
  29. return this