KLUIBuffInfoListPanel.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---@class KLUIBuffInfoListPanel:UIKmlLuaPanelBase
  2. ---@field view KLUIBuffInfoListPanelView
  3. ---@field args table<number,Buff>
  4. local KLUIBuffInfoListPanel = class(UIKmlLuaPanelBase)
  5. local this =KLUIBuffInfoListPanel
  6. ---创建时调用一次
  7. function this:Init()
  8. self.buffTemplateList = {}
  9. end
  10. ---创建或者刷新界面数据时调用
  11. function this:Refresh()
  12. self:Clear()
  13. for i, v in pairs(self.args) do
  14. local buffTemplate = GUI:UIPanel_Open("dev/ui/MainUI/Item/KLBuffInfo/KLBuffInfoItem",self.view.buffInfo_list,self,v,true)
  15. table.insert(self.buffTemplateList,buffTemplate)
  16. end
  17. end
  18. ---注册UI事件和服务器消息
  19. function this:RegistEvents()
  20. GUI:AddOnClickEvent(self.view.closeBtn,self,self.Close)
  21. end
  22. function this:Close()
  23. GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfo/KLUIBuffInfoPanel")
  24. GUI:UIPanel_Close("dev/ui/MainUI/Panel/KLUIBuffInfoList/KLUIBuffInfoListPanel")
  25. end
  26. ---清除数据
  27. function this:Clear()
  28. ---@param buffTemplate KLBuffInfoItem
  29. for i, buffTemplate in pairs(self.buffTemplateList) do
  30. GUI:UIPanel_Close(nil,buffTemplate)
  31. end
  32. self.buffTemplateList = {}
  33. end
  34. return this