KLMapHookPointItem.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---@class KLMapHookPointItem:UIKmlLuaPanelBase
  2. ---@field view KLMapHookPointItemView
  3. local KLMapHookPointItem = class(UIKmlLuaPanelBase)
  4. local this =KLMapHookPointItem
  5. ---创建时调用一次
  6. function this:Init()
  7. SL:KeepOpenPanel("KLMapHookPointItemKml",true)
  8. end
  9. ---注册UI事件和服务器消息
  10. function this:RegistEvents()
  11. GUI:AddOnClickEvent(self.view.btnPos, self, self.GoOnClick)
  12. end
  13. ---创建或者刷新界面数据时调用
  14. function this:Refresh()
  15. local index = self.args.index
  16. GUI:Text_setString(self.view.txtIndex, index)
  17. local pos = self.args.pos
  18. GUI:Text_setString(self.view.txtPos, string.format("[%s,%s]", pos[1], pos[2]))
  19. end
  20. function this:GoOnClick()
  21. GUI:UIPanel_Close("dev/outui/Hook/Panel/KLOnHook/KLOnHookPanel")
  22. GUI:UIPanel_Close("dev/outui/Hook/Panel/KLMapHookPoints/KLMapHookPointsPanel")
  23. SL.ShowMainPanel()
  24. local line = SL:GetMetaValue("MAP_LINE")
  25. SL:Pathfinding(self.args.mapId, line, self.args.pos[1], self.args.pos[2], function()
  26. SL:StartOnHook(true,true)
  27. end)
  28. end
  29. function this:Close()
  30. SL:KeepOpenPanel("KLMapHookPointItemKml",false)
  31. end
  32. return this