KLNavTipPanel.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ---@class KLNavTipPanel:UIKmlLuaPanelBase
  2. ---@field view KLNavTipPanelView
  3. local KLNavTipPanel = class(UIKmlLuaPanelBase)
  4. local this =KLNavTipPanel
  5. function this:AsyncLoadUI()
  6. end
  7. ---创建时调用一次
  8. function this:Init()
  9. end
  10. ---注册UI事件和服务器消息
  11. function this:RegistEvents()
  12. SL:RegisterLUAEvent(LUA_EVENT_UI_SHOW_ME_PATH_MOVE, self.ShowMePathMove, self)
  13. SL:RegisterLUAEvent(LUA_EVENT_UI_SHOW_ME_PATH_STOP, self.ShowMePathStop, self)
  14. end
  15. function this:ShowMePathMove()
  16. GUI:SetActive(self.view.panel_content, true)
  17. self.animIndex = 0
  18. self.enableAnim = true
  19. end
  20. function this:ShowMePathStop()
  21. GUI:SetActive(self.view.panel_content, false)
  22. self.enableAnim = false
  23. end
  24. ---界面显示时调用一次
  25. function this:Show()
  26. self.tickTimer = SL:Schedule(self.tickTimer,0,1,-1,self.Tick,self)
  27. end
  28. ---创建或者刷新界面数据时调用
  29. function this:Refresh()
  30. end
  31. function this:Hide()
  32. end
  33. function this:Close()
  34. SL:UnSchedule(self.tickTimer)
  35. end
  36. function this:Tick()
  37. if not self.enableAnim then
  38. return
  39. end
  40. GUI:Text_setText(self.view.text_tip, "自动寻路中" .. string.rep(".", self.animIndex))
  41. self.animIndex = (self.animIndex + 1) % 6
  42. end
  43. return this