KLShortcurKeyExplainPanel.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ---@class KLShortcurKeyExplainPanel:UIKmlLuaPanelBase
  2. ---@field view KLShortcurKeyExplainPanelView
  3. local KLShortcurKeyExplainPanel = class(UIKmlLuaPanelBase)
  4. local this = KLShortcurKeyExplainPanel
  5. this.datas = {}
  6. --this.datas[0] = "测试01"
  7. --this.datas[1] = "测试02"
  8. --this.datas[2] = "测试03"
  9. --this.datas[3] = "测试04"
  10. --this.datas[4] = "测试05"
  11. --this.datas[5] = "测试06"
  12. --this.datas[6] = "测试07"
  13. --this.datas[7] = "测试08"
  14. --this.datas[8] = "测试09"
  15. --this.datas[9] = "测试10"
  16. function this:AsyncLoadUI()
  17. end
  18. ---创建时调用一次
  19. function this:Init()
  20. local width, height = GUI:getSizeDelta(self.view.layout1)
  21. SL:ScheduleOnce(0.1, function()
  22. GUI:setContentSize(self.view.bg, width, height + 35)
  23. end)
  24. end
  25. ---注册UI事件和服务器消息
  26. function this:RegistEvents()
  27. end
  28. ---界面显示时调用一次
  29. function this:Show()
  30. this:GetConfigData()
  31. if this.datas and table.count(this.datas) > 0 then
  32. GUI:DataListInitData(self.view.datalist3, function()
  33. return table.count(this.datas)
  34. end, function()
  35. end, function()
  36. end, function(realIndex)
  37. self:ItemUpdateFunc(realIndex)
  38. end)
  39. GUI:DataListUpdateData(self.view.datalist3)
  40. end
  41. ---GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUILeftUp/KLUILeftUpPanel")
  42. SL.HideMainSinglePanel("KLUILeftUpPanel")
  43. end
  44. ---创建或者刷新界面数据时调用
  45. function this:Refresh()
  46. end
  47. function this:Hide()
  48. ---GUI:UIPanel_Open("dev/ui/MainUI/Panel/KLUILeftUp/KLUILeftUpPanel")
  49. SL.ShowMainSinglePanel("KLUILeftUpPanel")
  50. end
  51. function this:Close()
  52. PCPlatformMgr.ShowedShortcutKeyPanel = false
  53. end
  54. function this:ItemUpdateFunc(realIndex)
  55. local data = this.datas[realIndex + 1].text
  56. local text = GUI:GetChildControl(self.view.datalist3, realIndex, 'text5')
  57. if text then
  58. GUI:Text_setString(text, tostring(data))
  59. end
  60. end
  61. function this:GetConfigData()
  62. this.datas = SL:GetConfigTable("cfg_shortcutKey")
  63. if this.datas and table.count(this.datas) > 0 then
  64. table.sort(this.datas, function(a, b)
  65. return a.order < b.order
  66. end)
  67. end
  68. end
  69. return this